/* ============================================
   MUXBE - Affiliate Pipeline CRM
   Styles v5.0 - Multi-Page Layout + Sidebar
   ============================================ */

/* Accessibility: Skip Link */
.skip-link {
    position: absolute;
    top: -100%;
    left: 16px;
    z-index: 100000;
    padding: 8px 16px;
    background: var(--accent-primary);
    color: #fff;
    border-radius: 0 0 8px 8px;
    font-weight: 600;
    font-size: 0.875rem;
    text-decoration: none;
    transition: top 0.2s;
}
.skip-link:focus {
    top: 0;
}

/* Dark Theme (Default) */
:root, [data-theme="dark"] {
    color-scheme: dark;
    --bg-primary: #0D0D0D;
    --bg-secondary: #141414;
    --bg-tertiary: #1A1A1A;
    --bg-card: #141414;
    --border-color: #2A2A2A;
    --border-light: #3A3A3A;
    --text-primary: #F5F5F5;
    --text-secondary: #A3A3A3;
    --text-muted: #6B6B6B;
    
    /* Brand accent: Gold */
    --accent-primary: #C8A249;
    --accent-secondary: #D4B86A;
    /* Status colors unchanged */
    --accent-blue: #3b82f6;
    --accent-green: #10b981;
    --accent-yellow: #f59e0b;
    --accent-red: #ef4444;
    --accent-purple: #8b5cf6;
    --accent-cyan: #06b6d4;
    --accent-orange: #f97316;
    --accent-pink: #ec4899;
    --accent-lime: #84cc16;
    --accent-teal: #14b8a6;
    
    /* Gradients */
    --gradient-1: linear-gradient(135deg, #C8A249 0%, #D4B86A 100%);
    --gradient-2: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    --gradient-header: linear-gradient(90deg, #0D0D0D 0%, #141414 100%);
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(200, 162, 73, 0.15);
}

/* Light Theme */
[data-theme="light"] {
    color-scheme: light;
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f5f9;
    --bg-card: #ffffff;
    --border-color: #e2e8f0;
    --border-light: #cbd5e1;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    
    /* Brand accent: Gold (darker for light backgrounds) */
    --accent-primary: #A68532;
    --accent-secondary: #8B6F2A;
    /* Status colors for light mode */
    --accent-blue: #2563eb;
    --accent-green: #059669;
    --accent-yellow: #d97706;
    --accent-red: #dc2626;
    --accent-purple: #7c3aed;
    --accent-cyan: #0891b2;
    --accent-orange: #ea580c;
    --accent-pink: #db2777;
    --accent-lime: #65a30d;
    --accent-teal: #0d9488;
    
    /* Gradients */
    --gradient-1: linear-gradient(135deg, #A68532 0%, #C8A249 100%);
    --gradient-2: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
    --gradient-header: linear-gradient(90deg, #f8fafc 0%, #ffffff 100%);
    
    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.15);
    --shadow-glow: 0 0 20px rgba(166, 133, 50, 0.1);
}

/* ============================================
   FLAG IMAGES (Windows doesn't support flag emojis)
   ============================================ */
.flag-icon {
    width: 20px;
    height: 15px;
    display: inline-block;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    border-radius: 2px;
    vertical-align: middle;
    margin-right: 4px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.flag-uk { background-image: url('https://flagcdn.com/w40/gb.png'); }
.flag-nl { background-image: url('https://flagcdn.com/w40/nl.png'); }
.flag-de { background-image: url('https://flagcdn.com/w40/de.png'); }
.flag-es { background-image: url('https://flagcdn.com/w40/es.png'); }
.flag-it { background-image: url('https://flagcdn.com/w40/it.png'); }
.flag-fr { background-image: url('https://flagcdn.com/w40/fr.png'); }
.flag-us { background-image: url('https://flagcdn.com/w40/us.png'); }
.flag-ca { background-image: url('https://flagcdn.com/w40/ca.png'); }
.flag-au { background-image: url('https://flagcdn.com/w40/au.png'); }
.flag-br { background-image: url('https://flagcdn.com/w40/br.png'); }
.flag-pl { background-image: url('https://flagcdn.com/w40/pl.png'); }
.flag-se { background-image: url('https://flagcdn.com/w40/se.png'); }
.flag-no { background-image: url('https://flagcdn.com/w40/no.png'); }
.flag-dk { background-image: url('https://flagcdn.com/w40/dk.png'); }
.flag-fi { background-image: url('https://flagcdn.com/w40/fi.png'); }
.flag-at { background-image: url('https://flagcdn.com/w40/at.png'); }
.flag-ch { background-image: url('https://flagcdn.com/w40/ch.png'); }
.flag-be { background-image: url('https://flagcdn.com/w40/be.png'); }
.flag-ie { background-image: url('https://flagcdn.com/w40/ie.png'); }
.flag-pt { background-image: url('https://flagcdn.com/w40/pt.png'); }

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

body {
    font-family: 'Plus Jakarta Sans', -apple-system, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    background-image: 
        radial-gradient(ellipse at 0% 0%, rgba(74, 158, 255, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 100% 50%, rgba(168, 85, 247, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 100%, rgba(34, 197, 94, 0.04) 0%, transparent 50%);
}

/* ============================================
   LOGIN SCREEN
   ============================================ */
.login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
}

.login-box {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 3rem;
    width: 100%;
    max-width: 420px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}

.login-logo {
    width: 72px;
    height: 72px;
    background: var(--gradient-1);
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin: 0 auto 1.5rem;
    box-shadow: 0 8px 30px rgba(74, 158, 255, 0.3);
}

.login-box h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-box p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-size: 0.95rem;
}

.login-box input {
    width: 100%;
    padding: 1rem 1.25rem;
    font-size: 1rem;
    margin-bottom: 1rem;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    transition: all 0.2s;
}

.login-box input:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 4px rgba(74, 158, 255, 0.1);
}

.login-box button {
    width: 100%;
    padding: 1rem;
    font-size: 1rem;
    font-weight: 600;
}

.login-error {
    color: var(--accent-red);
    font-size: 0.875rem;
    margin-bottom: 1rem;
    display: none;
    padding: 0.75rem;
    background: rgba(239, 68, 68, 0.1);
    border-radius: 8px;
}

.setup-notice {
    background: rgba(234, 179, 8, 0.1);
    border: 1px solid rgba(234, 179, 8, 0.3);
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    text-align: left;
    font-size: 0.85rem;
    color: var(--accent-yellow);
}

.setup-notice a {
    color: var(--accent-blue);
}

/* ============================================
   MAIN APP CONTAINER
   ============================================ */
.app-container {
    display: none;
}

.app-container.active {
    display: flex;
    min-height: 100vh;
}

/* ============================================
   SIDEBAR NAVIGATION
   ============================================ */

.sidebar {
    width: 260px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 100;
    transition: transform 0.3s ease, width 0.3s ease;
}

.sidebar-header {
    padding: 0 1.5rem;
    border-bottom: 1px solid var(--border-color);
    height: 65px;
    min-height: 65px;
    max-height: 65px;
    display: flex;
    align-items: center;
}

.sidebar-header .logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-header .logo-text {
    font-size: 0.85rem;
    font-weight: 800;
    color: #C8A249;
    letter-spacing: 0.2em;
}

.sidebar-logo-img {
    height: 34px;
    width: auto;
    object-fit: contain;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
    overflow-y: auto;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.875rem 1.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
    position: relative;
}

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

.nav-link.active {
    background: rgba(200, 162, 73, 0.1);
    color: var(--accent-primary);
    border-left-color: var(--accent-primary);
}

.nav-link.has-unread {
    position: relative;
}

.nav-link.has-unread::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 1rem;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    background: var(--accent-red);
    border-radius: 50%;
    animation: unread-pulse 1.5s ease-in-out infinite;
}

@keyframes unread-pulse {
    0%, 100% { opacity: 1; transform: translateY(-50%) scale(1); }
    50% { opacity: 0.5; transform: translateY(-50%) scale(1.3); }
}

.nav-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.nav-icon svg {
    width: 18px;
    height: 18px;
    color: currentColor;
    transition: transform 0.2s ease;
}

.nav-link:hover .nav-icon svg {
    transform: scale(1.1);
}

.nav-link.active .nav-icon svg {
    color: var(--accent-primary);
}

.nav-text {
    flex: 1;
}

.nav-badge {
    background: var(--accent-red);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
    transition: transform 200ms ease;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.3);
}

.nav-badge:hover {
    transform: scale(1.05);
}

.nav-badge.nav-new {
    background: var(--accent-primary);
    box-shadow: 0 2px 6px rgba(16, 185, 129, 0.3);
}

.nav-badge.nav-beta {
    background: var(--accent-purple);
    box-shadow: 0 2px 6px rgba(139, 92, 246, 0.3);
}

.nav-badge.signal-count {
    background: var(--accent-yellow);
    color: #000;
    box-shadow: 0 2px 6px rgba(245, 158, 11, 0.3);
}

/* Nav Group (collapsible sections) */
.nav-group {
    display: flex;
    flex-direction: column;
}

.nav-group-toggle {
    cursor: pointer;
}

.nav-group-toggle .nav-arrow {
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
    margin-left: auto;
    opacity: 0.6;
}

.nav-group-toggle .nav-arrow svg {
    width: 14px;
    height: 14px;
}

.nav-group.collapsed .nav-arrow {
    transform: rotate(-90deg);
}

.nav-group-items {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    max-height: 500px;
    transition: max-height 0.3s ease;
}

.nav-group.collapsed .nav-group-items {
    max-height: 0;
}

.nav-link.sub-link,
.nav-sublink {
    display: block;
    padding: 0.5rem 1rem 0.5rem 3.25rem;
    font-size: 0.875rem;
    color: var(--text-muted);
    border-left: none;
    background: rgba(0, 0, 0, 0.1);
    text-decoration: none;
    transition: all 0.2s ease;
}

.nav-sublink:hover {
    color: var(--text-primary);
    background: rgba(139, 92, 246, 0.1);
}

.nav-sublink.active {
    color: var(--accent-purple);
    background: rgba(139, 92, 246, 0.15);
}

.nav-badge.nav-new {
    background: linear-gradient(135deg, #C8A249 0%, #D4B86A 100%) !important;
    animation: none;
}

.nav-sublink .nav-badge {
    margin-left: 0.5rem;
}

.nav-link.sub-link:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.nav-link.sub-link.active {
    color: var(--accent-primary);
    background: rgba(16, 185, 129, 0.08);
}

.sidebar-divider {
    height: 1px;
    background: var(--border-color);
    margin: 0.5rem 1.5rem;
}

.sidebar-actions {
    padding: 0.5rem 1rem;
}

.sidebar-action-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 0.5rem;
}

.sidebar-action-btn:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent-primary);
    color: var(--text-primary);
}

.sidebar-footer {
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}

/* Online Panel - Always visible in sidebar */
.online-panel {
    background: var(--bg-tertiary);
}

.online-panel-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.online-panel-title {
    flex: 1;
    font-weight: 600;
}

.online-panel-count {
    background: var(--accent-green);
    color: white;
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    font-weight: 600;
}

.online-panel-list {
    max-height: 200px;
    overflow-y: auto;
    padding: 0.5rem;
}

.online-panel-user {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0.6rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.online-panel-user:hover {
    background: var(--bg-secondary);
}

.online-panel-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--gradient-1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 600;
    color: white;
    position: relative;
}

.online-panel-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.online-panel-avatar::after {
    content: '';
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 10px;
    height: 10px;
    background: var(--accent-green);
    border: 2px solid var(--bg-tertiary);
    border-radius: 50%;
}

.online-panel-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 1px;
}

.online-panel-name {
    font-size: 0.8rem;
    color: var(--text-primary);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.online-panel-duration {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.online-panel-role {
    font-size: 0.65rem;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    text-transform: uppercase;
    font-weight: 600;
    flex-shrink: 0;
}

.online-panel-role.admin { background: rgba(239, 68, 68, 0.2); color: var(--accent-red); }
.online-panel-role.manager { background: rgba(59, 130, 246, 0.2); color: var(--accent-blue); }
.online-panel-role.retention { background: rgba(168, 85, 247, 0.2); color: var(--accent-purple); }
.online-panel-role.viewer { background: rgba(100, 116, 139, 0.2); color: var(--text-muted); }

.online-panel-empty {
    padding: 1rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* Header action buttons */
.btn-header-action {
    padding: 0.5rem 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    height: 40px;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.btn-header-action:hover {
    background: var(--gradient-1);
    border-color: var(--accent-primary);
    color: white;
}

/* Fancy Sync Button */
.sync-btn-fancy {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.4rem 1rem 0.4rem 0.75rem;
    height: 40px;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border: 1px solid var(--accent-primary);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.sync-btn-fancy::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--gradient-1);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sync-btn-fancy:hover::before {
    opacity: 1;
}

.sync-btn-fancy:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.3);
}

.sync-btn-fancy.syncing {
    cursor: progress;
}

.sync-btn-fancy.syncing .sync-btn-icon {
    animation: spin 1s linear infinite;
}

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

.sync-btn-icon {
    font-size: 1.1rem;
    position: relative;
    z-index: 1;
}

.sync-btn-content {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    position: relative;
    z-index: 1;
}

.sync-btn-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: white;
    line-height: 1;
}

.sync-btn-time {
    font-size: 0.65rem;
    color: var(--accent-primary);
    line-height: 1;
    margin-top: 2px;
}

.sync-btn-fancy:hover .sync-btn-time {
    color: rgba(255, 255, 255, 0.8);
}

.sync-btn-spinner {
    display: none;
}

.sync-btn-fancy.syncing .sync-btn-spinner {
    display: block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    position: relative;
    z-index: 1;
}

/* ============================================
   CHANGELOG POPUP
   ============================================ */

.changelog-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease;
}

.changelog-overlay.closing {
    animation: fadeOut 0.3s ease forwards;
}

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

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

.changelog-modal {
    background: var(--bg-secondary);
    border-radius: 20px;
    width: 90%;
    max-width: 600px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.5), 0 0 0 1px var(--border-color);
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.changelog-header {
    text-align: center;
    padding: 2rem 2rem 1.5rem;
    background: var(--gradient-1);
    position: relative;
}

.changelog-logo {
    font-size: 3rem;
    margin-bottom: 0.75rem;
    animation: bounce 1s ease infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.changelog-header h2 {
    margin: 0;
    font-size: 1.75rem;
    color: white;
    font-weight: 700;
}

.changelog-subtitle {
    margin: 0.5rem 0 0;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.95rem;
}

.changelog-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem 2rem;
}

.changelog-version {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.changelog-version:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.changelog-version-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.changelog-version-badge {
    background: var(--gradient-1);
    color: white;
    padding: 0.3rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
}

.changelog-version-date {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.changelog-version-title {
    margin: 0 0 1rem;
    font-size: 1.1rem;
    color: var(--text-primary);
    font-weight: 600;
}

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

.changelog-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.5rem 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.4;
}

.changelog-badge {
    font-size: 0.65rem;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
}

.changelog-badge.new {
    background: rgba(16, 185, 129, 0.2);
    color: var(--accent-green);
}

.changelog-badge.improved {
    background: rgba(59, 130, 246, 0.2);
    color: var(--accent-blue);
}

.changelog-badge.fixed {
    background: rgba(249, 115, 22, 0.2);
    color: var(--accent-orange);
}

.changelog-badge.removed {
    background: rgba(239, 68, 68, 0.2);
    color: var(--accent-red);
}

.changelog-footer {
    padding: 1.5rem 2rem;
    background: var(--bg-tertiary);
    border-top: 1px solid var(--border-color);
}

.changelog-btn {
    width: 100%;
    padding: 1rem 2rem;
    background: var(--gradient-1);
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.changelog-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.changelog-btn:not(:disabled):hover {
    transform: scale(1.02);
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.4);
}

.changelog-btn-timer {
    width: 28px;
    height: 28px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}

.changelog-btn-text {
    letter-spacing: 0.5px;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s ease;
    margin: 0.75rem 0;
}

.sidebar-user:hover {
    background: var(--bg-card);
}

.sidebar-user .user-avatar {
    width: 36px;
    height: 36px;
    font-size: 0.9rem;
}

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

.sidebar-user .user-name {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user .user-role {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.sidebar-controls {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

.btn-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    padding: 0;
}

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

.btn-icon.btn-logout:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--accent-red);
    color: var(--accent-red);
}

/* Make theme toggle same size as other icons */
.sidebar-controls .btn-theme-toggle {
    width: 32px;
    height: 32px;
    min-width: 32px;
    padding: 0;
}

/* ============================================
   MAIN CONTENT AREA
   ============================================ */

.main-content {
    flex: 1;
    margin-left: 260px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.3s ease;
}


.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    height: 65px;
    min-height: 65px;
    max-height: 65px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 50;
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.sidebar-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.2rem;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.header-divider {
    width: 1px;
    height: 28px;
    background: var(--border-color);
    margin: 0 0.5rem;
}

.user-info-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.4rem 0.75rem;
    background: var(--bg-tertiary);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.user-info-header:hover {
    background: var(--bg-card);
}

.user-info-header .user-avatar {
    width: 32px;
    height: 32px;
    font-size: 0.8rem;
}

.user-info-header .user-details {
    display: flex;
    flex-direction: column;
}

.user-info-header .user-name {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.user-info-header .user-role {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: capitalize;
}

.btn-icon-header {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1rem;
}

.btn-icon-header:hover {
    background: var(--bg-card);
    color: var(--text-primary);
    border-color: var(--border-light);
}

.btn-logout-header:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--accent-red);
    color: var(--accent-red);
}

/* Page Sections */
.page-section {
    flex: 1;
    padding: 1.5rem 2rem;
    display: none;
}

.page-section.active {
    display: block;
}

/* Keep old container for backward compatibility */
.container {
    max-width: 1500px;
    margin: 0 auto;
}

/* ============================================
   EVENTS PAGE (Sports Intelligence Dashboard)
   ============================================ */

.events-page {
    padding: 24px;
    max-width: 1200px;
    margin: 0 auto;
}

.events-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.events-page-header h2 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 22px;
    font-weight: 700;
}

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

.events-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 24px;
    padding: 12px 16px;
    background: var(--card-bg);
    border-radius: 10px;
    border: 1px solid var(--border-color);
}

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

.events-filters select {
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--bg);
    color: var(--text);
    font-size: 13px;
}

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

/* Test Mode Banner */
.events-test-mode-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    margin-bottom: 16px;
    border-radius: 8px;
    font-size: 13px;
    background: rgba(255, 171, 0, 0.12);
    border: 1px solid rgba(255, 171, 0, 0.3);
    color: var(--text-primary);
}

/* Stats Bar */
.events-stats-bar {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
}

.stats-item {
    flex: 1;
    padding: 14px 18px;
    border-radius: 10px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    font-size: 14px;
    font-weight: 600;
    text-align: center;
}

.stats-must { border-left: 3px solid #ef4444; }
.stats-urgent { border-left: 3px solid #f59e0b; }
.stats-total { border-left: 3px solid #3b82f6; }

/* Urgency Section */
.events-urgency-section {
    margin-bottom: 24px;
}

.urgency-header {
    font-size: 14px;
    font-weight: 600;
    color: #f59e0b;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.urgency-cards {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 8px;
}

.urgency-card {
    min-width: 220px;
    padding: 14px;
    border-radius: 10px;
    background: var(--card-bg);
    border: 1px solid #f59e0b33;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}

.urgency-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.urgency-card .urgency-deadline {
    font-size: 13px;
    font-weight: 600;
    color: #f59e0b;
    margin-top: 8px;
}

/* Stats Cards */
.events-stat-card {
    flex: 1;
    padding: 14px 18px;
    border-radius: 10px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    text-align: center;
}

.events-stat-card.must { border-left: 3px solid #ef4444; }
.events-stat-card.urgent { border-left: 3px solid #f59e0b; }
.events-stat-card.total { border-left: 3px solid #3b82f6; }

.events-stat-card.clickable {
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}
.events-stat-card.clickable:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
.events-stat-card.clickable.active {
    background: rgba(239, 68, 68, 0.1);
    border-color: #ef4444;
}

.events-stat-value {
    font-size: 28px;
    font-weight: 700;
    line-height: 1.2;
}

.events-stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-top: 4px;
}

/* Urgency Scroll Strip */
.urgency-scroll {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 8px;
}

.urgency-card-name {
    font-size: 14px;
    font-weight: 600;
}

.urgency-card-comp {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.urgency-card-deadline {
    font-size: 13px;
    font-weight: 600;
    color: #f59e0b;
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.urgency-bumped-tag {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    background: #8b5cf6;
    color: #fff;
    padding: 2px 8px;
    border-radius: 4px;
    margin-top: 6px;
}

.events-section-title {
    font-size: 14px;
    font-weight: 700;
    color: #f59e0b;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Weekly Timeline (event-row based) */
.events-timeline {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.events-day-group {
    margin-bottom: 8px;
}

.events-day-heading {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--accent-color, #6366f1);
    padding: 10px 16px;
    margin-bottom: 6px;
    background: var(--card-bg, rgba(255,255,255,0.03));
    border-radius: 8px;
    border-left: 3px solid var(--accent-color, #6366f1);
}

.events-day-rows {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.event-row {
    display: grid;
    grid-template-columns: 8px 90px 200px 1fr 60px;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
    border: 1px solid transparent;
}

.event-row:hover {
    background: var(--card-bg);
    border-color: var(--border-color);
}

.event-row.must-promote {
    background: rgba(239, 68, 68, 0.08);
    border-left: 3px solid #ef4444;
    position: relative;
}
.event-row.must-promote::before {
    content: 'MUST PROMOTE';
    position: absolute;
    right: 80px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.5px;
    padding: 3px 8px;
    border-radius: 4px;
    background: #ef4444;
    color: #fff;
}
.event-row.must-promote:hover {
    background: rgba(239, 68, 68, 0.12);
    border-color: #ef4444;
}

.event-row.should-promote {
    border-left: 3px solid #f59e0b;
}

.event-detail-fallback-notice {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.event-detail-fallback-notice p {
    margin: 0;
    font-size: 12px;
    color: #f59e0b;
}

.event-importance-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 0 6px currentColor;
}

.event-row-sport {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 3px 10px;
    border-radius: 4px;
    background: var(--accent-color, #4f46e5);
    color: #fff;
    text-align: center;
    white-space: nowrap;
}

.event-row-comp {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.event-row-main {
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow: hidden;
}

.event-row-teams {
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.event-row-headline {
    font-size: 11px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0.6;
}

.event-row-time {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-align: right;
    white-space: nowrap;
}

/* Events Empty State */
.events-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.events-empty-icon {
    margin-bottom: 16px;
    opacity: 0.5;
}

.events-empty h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
}

.events-empty p {
    font-size: 14px;
    max-width: 400px;
    margin: 0 auto 16px;
}

/* Legacy timeline classes kept for backward compat */
.timeline-day {
    margin-bottom: 20px;
}

.timeline-day-header {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    padding-bottom: 8px;
    margin-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.timeline-event {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
    margin-bottom: 4px;
}

.timeline-event:hover {
    background: var(--card-bg);
}

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

.importance-dot.must { background: #ef4444; }
.importance-dot.should { background: #f59e0b; }
.importance-dot.could { background: #94a3b8; }

.timeline-event-competition {
    font-size: 12px;
    color: var(--text-secondary);
    width: 140px;
    flex-shrink: 0;
}

.timeline-event-name {
    font-size: 14px;
    font-weight: 600;
    flex: 1;
}

.timeline-event-headline {
    font-size: 13px;
    color: var(--text-secondary);
    flex: 1;
    text-align: right;
}

.timeline-event-time {
    font-size: 12px;
    color: var(--text-secondary);
    width: 50px;
    text-align: right;
    flex-shrink: 0;
}

/* Event Detail Modal */
.event-detail-modal {
    max-width: 600px;
}

.event-detail-header {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.event-detail-teams {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 18px;
    font-weight: 700;
    flex-wrap: wrap;
}

.event-detail-sport-tag {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    background: var(--accent-color, #4f46e5);
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.event-detail-odds {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 4px;
}

.odds-chip {
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 6px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.odds-chip strong {
    color: var(--accent-color, #4f46e5);
    margin-left: 4px;
}

.odds-bookmakers {
    font-size: 11px;
    color: var(--text-secondary);
}

.event-detail-meta {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

/* Sport tag colors by sport type */
.event-row-sport[data-sport="soccer"] { background: #16a34a; }
.event-row-sport[data-sport="basketball"] { background: #ea580c; }
.event-row-sport[data-sport="tennis"] { background: #ca8a04; }
.event-row-sport[data-sport="icehockey"] { background: #0891b2; }
.event-row-sport[data-sport="mma"] { background: #dc2626; }

/* Sport group checkboxes in config */
.sport-groups-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 8px;
    margin-top: 4px;
}

.sport-group-checkbox {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    transition: background 0.15s;
}

.sport-group-checkbox:hover {
    background: var(--hover-bg);
}

.sport-group-checkbox input[type="checkbox"] {
    accent-color: var(--accent-color, #4f46e5);
}

.importance-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 12px;
}

.importance-badge.must { background: #ef444420; color: #ef4444; }
.importance-badge.should { background: #f59e0b20; color: #f59e0b; }
.importance-badge.could { background: #94a3b820; color: #94a3b8; }

.event-detail-why {
    font-size: 15px;
    line-height: 1.5;
    margin-bottom: 20px;
}

.promo-suggestion {
    padding: 12px;
    border-radius: 8px;
    background: var(--bg);
    border: 1px solid var(--border-color);
    margin-bottom: 8px;
}

.promo-suggestion-type {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 4px;
}

.promo-suggestion-desc {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
}

.promo-suggestion-reasoning {
    font-size: 13px;
    color: var(--text-secondary);
}

.event-phases {
    margin: 16px 0;
}

.phase-item {
    display: flex;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

.phase-label {
    width: 80px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.phase-focus {
    font-size: 13px;
    flex: 1;
}

.event-deadlines {
    display: flex;
    gap: 16px;
    margin: 16px 0;
}

.deadline-item {
    flex: 1;
    padding: 10px;
    border-radius: 8px;
    background: var(--bg);
    border: 1px solid var(--border-color);
    text-align: center;
}

.deadline-label {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.deadline-value {
    font-size: 14px;
    font-weight: 600;
    margin-top: 4px;
}

.channel-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin: 12px 0;
}

.channel-tag {
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    background: var(--accent-bg, var(--bg));
    border: 1px solid var(--border-color);
}

.event-detail-home,
.event-detail-away {
    font-weight: 600;
    font-size: 16px;
}

.event-detail-vs {
    color: var(--text-secondary);
    margin: 0 8px;
    font-size: 13px;
}

.event-detail-pending {
    padding: 20px;
    text-align: center;
    color: var(--text-secondary);
    background: var(--bg);
    border-radius: 8px;
    margin-top: 12px;
}

.event-detail-importance {
    padding: 10px 14px;
    border-radius: 8px;
    background: var(--bg);
    margin-top: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.importance-score {
    font-size: 13px;
    color: var(--text-secondary);
}

.event-detail-insight {
    margin-top: 12px;
}

.event-detail-insight h4 {
    font-size: 15px;
    margin-bottom: 4px;
}

.event-detail-insight p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.event-detail-promos {
    margin-top: 16px;
}

.event-detail-promos h4 {
    font-size: 14px;
    margin-bottom: 8px;
}

.promo-cards {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.promo-card {
    background: var(--bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 14px;
}

.promo-type {
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 4px;
}

.promo-desc {
    font-size: 14px;
}

.promo-reason {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
    font-style: italic;
}

.event-detail-phases {
    margin-top: 16px;
}

.event-detail-phases h4 {
    font-size: 14px;
    margin-bottom: 8px;
}

.phase-card {
    background: var(--bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 6px;
}

.phase-card strong {
    font-size: 13px;
    text-transform: uppercase;
    color: var(--accent);
}

.phase-card p {
    font-size: 14px;
    margin-top: 4px;
    color: var(--text-secondary);
}

.phase-starts {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.event-detail-deadlines {
    margin-top: 16px;
}

.event-detail-deadlines h4 {
    font-size: 14px;
    margin-bottom: 8px;
}

.deadline-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    font-size: 14px;
    color: var(--text-secondary);
}

.event-detail-actions {
    display: flex;
    gap: 8px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

/* Config Modal */
.sports-config-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.config-field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
}

.config-field input,
.config-field textarea,
.config-field select {
    width: 100%;
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--bg);
    color: var(--text);
    font-size: 13px;
}

.config-field textarea {
    min-height: 80px;
    resize: vertical;
}

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

.events-empty-state h3 {
    font-size: 18px;
    margin-bottom: 8px;
    color: var(--text);
}

.events-empty-state p {
    font-size: 14px;
    margin-bottom: 20px;
}

/* ============================================
   INBOX PAGE
   ============================================ */

.inbox-page {
    max-width: 1200px;
    margin: 0 auto;
}

.inbox-page-header {
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.inbox-page-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--text-primary);
}

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

.inbox-tabs {
    display: flex;
    gap: 0.25rem;
    background: var(--bg-secondary);
    padding: 0.25rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
}

.inbox-tab {
    padding: 0.75rem 1.5rem;
    background: transparent;
    border: none;
    border-radius: 10px;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

.inbox-tab.active {
    background: var(--gradient-1);
    color: white;
}

.inbox-content {
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    min-height: 400px;
}

.inbox-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: var(--text-muted);
}

/* Inbox Empty State */
.inbox-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    text-align: center;
}

.inbox-empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.inbox-empty h3 {
    margin: 0 0 0.5rem;
    color: var(--text-primary);
    font-size: 1.25rem;
}

.inbox-empty p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Inbox List */
.inbox-list {
    padding: 0.5rem;
}

.inbox-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid var(--border-color);
}

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

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

.inbox-item.unread {
    background: rgba(16, 185, 129, 0.05);
    border-left: 3px solid var(--accent-green);
}

.inbox-item.mention {
    background: rgba(249, 115, 22, 0.05);
    border-left: 3px solid var(--accent-orange);
}

.inbox-item-icon {
    font-size: 1.5rem;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border-radius: 10px;
    flex-shrink: 0;
}

.inbox-item-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--gradient-1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 600;
    color: white;
    flex-shrink: 0;
}

.inbox-item-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

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

.inbox-item-title {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.inbox-item-title strong {
    color: var(--accent-primary);
}

.inbox-item-preview {
    font-size: 0.85rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0.25rem;
}

.inbox-item-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.mention-badge {
    background: var(--accent-orange);
    color: white;
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    font-weight: 600;
}

.unread-badge {
    background: var(--accent-red);
    color: white;
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    font-weight: 600;
    margin-left: auto;
}

.tab-badge {
    background: rgba(255,255,255,0.2);
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    font-size: 0.75rem;
    margin-left: 0.25rem;
}

.inbox-tab.active .tab-badge {
    background: rgba(255,255,255,0.3);
}

/* ============================================
   SETTINGS PAGE
   ============================================ */

.settings-page {
    max-width: 900px;
    margin: 0 auto;
}

.settings-page-header {
    margin-bottom: 1.5rem;
}

.settings-page-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--text-primary);
}

.settings-sections {
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    padding: 1.5rem;
}

/* ============================================
   RESPONSIVE - SIDEBAR
   ============================================ */

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
}

@media (max-width: 1024px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: 260px;
        transform: translateX(-100%);
        z-index: 1000;
    }
    
    .sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.3);
    }
    
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        display: none;
    }
    
    .sidebar.open ~ .sidebar-overlay {
        display: block;
    }
    
    .main-content {
        margin-left: 0;
        width: 100%;
    }
    
    .sidebar-toggle {
        display: flex;
    }
}

@media (max-width: 768px) {
    .page-section {
        padding: 1rem;
    }
    
    .top-bar {
        padding: 0.75rem 1rem;
    }
    
    .page-title {
        font-size: 1.25rem;
    }
    
    .events-page-header,
    .inbox-page-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .inbox-tabs {
        flex-wrap: wrap;
    }
}

/* ============================================
   HEADER
   ============================================ */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
}

.logo-icon img, .logo-icon svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 2px 8px rgba(200, 162, 73, 0.3));
    transition: all 0.3s ease;
}

.logo-icon:hover img, .logo-icon:hover svg {
    transform: scale(1.1);
    filter: drop-shadow(0 4px 16px rgba(200, 162, 73, 0.5));
}

h1 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.sync-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-left: 1rem;
    padding: 0.4rem 0.85rem;
    background: var(--bg-tertiary);
    border-radius: 20px;
    border: 1px solid var(--border-color);
}

.sync-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-green);
    box-shadow: 0 0 8px var(--accent-green);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 8px var(--accent-green); }
    50% { opacity: 0.6; box-shadow: 0 0 4px var(--accent-green); }
}

.sync-dot.offline {
    background: var(--accent-red);
    box-shadow: 0 0 8px var(--accent-red);
    animation: none;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.header-actions button {
    padding: 0.5rem 0.85rem;
    font-size: 0.8rem;
    white-space: nowrap;
}

/* ============================================
   BUTTONS
   ============================================ */
button {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 0.875rem;
    font-weight: 600;
    padding: 0.625rem 1.125rem;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--border-color);
}

.btn-secondary:hover {
    background: var(--border-color);
    border-color: var(--border-light);
    transform: translateY(-1px);
}

.btn-primary {
    background: var(--gradient-1);
    color: white;
    border: none;
    box-shadow: 0 4px 15px rgba(74, 158, 255, 0.3);
    position: relative;
    overflow: hidden;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s ease;
}

.btn-primary:hover::before {
    left: 100%;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(74, 158, 255, 0.5);
}

.btn-primary:disabled,
.btn-secondary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-success {
    background: var(--gradient-2);
    color: white;
    border: none;
}

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

.btn-danger:hover {
    background: #dc2626;
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: none;
    padding: 0.5rem;
}

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

.btn-small {
    padding: 0.4rem 0.7rem;
    font-size: 0.8rem;
    border-radius: 8px;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.btn-archive {
    background: rgba(249, 115, 22, 0.08);
    border: 1px solid rgba(249, 115, 22, 0.2);
    color: var(--accent-orange);
}

.btn-archive:hover {
    background: rgba(249, 115, 22, 0.15);
    border-color: var(--accent-orange);
}

.btn-danger.btn-icon {
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: var(--accent-red);
}

.btn-danger.btn-icon:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: var(--accent-red);
}

.btn-logout {
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: var(--accent-red);
    padding: 0.55rem;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-logout:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: var(--accent-red);
    transform: translateX(3px);
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.2);
}

.btn-logout svg {
    display: block;
}

/* Theme Toggle Button */
.btn-theme-toggle {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.55rem 0.75rem;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    position: relative;
    overflow: hidden;
}

.btn-theme-toggle:hover {
    background: var(--bg-card);
    border-color: var(--accent-primary);
    transform: rotate(-10deg);
    box-shadow: var(--shadow-glow);
}

.theme-icon-dark,
.theme-icon-light {
    transition: all 0.3s ease;
}

/* Dark mode: show moon, hide sun */
[data-theme="dark"] .theme-icon-dark,
:root .theme-icon-dark {
    display: inline;
}
[data-theme="dark"] .theme-icon-light,
:root .theme-icon-light {
    display: none;
}

/* Light mode: show sun, hide moon */
[data-theme="light"] .theme-icon-dark {
    display: none;
}
[data-theme="light"] .theme-icon-light {
    display: inline;
}

/* ============================================
   FILTERS
   ============================================ */
.filters {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
    background: var(--bg-secondary);
    padding: 1rem 1.25rem;
    border-radius: 14px;
    border: 1px solid var(--border-color);
}

.filter-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

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

select, input[type="text"], input[type="password"], input[type="date"], input[type="email"], input[type="url"], textarea {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 0.875rem;
    padding: 0.6rem 0.9rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    outline: none;
    transition: all 0.2s;
}
input[type="date"] { color-scheme: dark; }
[data-theme="light"] input[type="date"] { color-scheme: light; }

select:focus, input:focus, textarea:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(74, 158, 255, 0.1);
}

select {
    cursor: pointer;
    min-width: 130px;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
}

/* Force dark background on select dropdowns */
select option {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    padding: 8px 12px;
}

select option:hover,
select option:focus,
select option:checked {
    background-color: var(--accent-primary);
    color: white;
}

select optgroup {
    background-color: var(--bg-tertiary);
    color: var(--text-secondary);
}

.reset-btn {
    color: var(--accent-blue);
    background: none;
    border: none;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    margin-left: auto;
}

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

/* Partners Info Notice */
.partners-info-notice {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.partners-info-notice .info-icon {
    flex-shrink: 0;
}

.partners-info-notice strong {
    color: var(--accent-primary);
}

/* Partners page period selector — replaces the old info notice so that
   the whole table can be filtered to a specific time range. */
.partners-period-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.partners-period-label {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.03em;
}

.partners-period-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.partners-period-status {
    margin-left: auto;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.partners-period-status strong {
    color: var(--accent-primary);
}

.partners-period-status.loading strong {
    color: var(--text-secondary);
    opacity: 0.75;
}

.partners-custom-dates {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.5rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.8rem;
}

.partners-custom-dates label {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.partners-custom-dates input[type="date"] {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 4px;
    padding: 0.25rem 0.4rem;
    font-size: 0.8rem;
}

/* ============================================
   TABLE
   ============================================ */
.table-container {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow-x: auto;
    overflow-y: auto;
    position: relative;
    max-width: 100%;
}

table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;  /* Forces columns to fit */
}

/* Default column widths for fixed layout */
table th, table td {
    overflow: visible;
    white-space: nowrap;
}

/* Only apply ellipsis to partner name column */
table td.col-partner {
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

/* Hide NGR column by default - less important than Deposits */
.hide-desktop {
    display: none;
}

/* Sticky Actions column */
.sticky-actions {
    position: sticky;
    right: 0;
    background: var(--bg-secondary);
    z-index: 2;
    box-shadow: -4px 0 8px rgba(0, 0, 0, 0.15);
}

thead .sticky-actions {
    background: var(--bg-tertiary);
}

tr:hover .sticky-actions {
    background: var(--bg-tertiary);
}

thead {
    background: var(--bg-tertiary);
    position: sticky;
    top: 0;
    z-index: 10;
}

th {
    text-align: left;
    padding: 0.75rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
    overflow: visible;
}

th.sortable {
    cursor: pointer;
    user-select: none;
    transition: all 0.2s;
}

/* Table column widths */
.col-checkbox { width: 40px; padding: 0.75rem 0.5rem; text-align: center; }
.col-num { width: 40px; text-align: center; }
.col-id { width: 80px; min-width: 70px; }
.col-partner { min-width: 150px; }
.col-geo { width: 110px; min-width: 100px; max-width: 130px; overflow: hidden; }
.col-source { width: 100px; min-width: 95px; }
.col-manager { width: 100px; min-width: 90px; }
.col-stat { width: 65px; text-align: right; }

.manager-badge {
    font-size: 0.75rem;
    color: var(--accent-purple);
    font-weight: 500;
    white-space: nowrap;
}

.manager-extra {
    opacity: 0.7;
    font-size: 0.7rem;
    margin-left: 2px;
}

.source-extra {
    opacity: 0.7;
    font-size: 0.65rem;
    padding: 0.2rem 0.4rem;
}

.assignee-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

.assignee-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.8rem;
    color: var(--text-primary);
}

.chip-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0 2px;
    font-size: 14px;
    line-height: 1;
}

.chip-remove:hover {
    color: var(--accent-red);
}

.col-money { width: 100px; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.col-ratio { width: 62px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.col-status { width: 95px; min-width: 85px; }
.col-actions { width: 110px; text-align: center; }

/* Stat displays - consistent styling */
.stat-deposits,
.stat-ngr,
.stat-commission {
    font-variant-numeric: tabular-nums;
    font-weight: 500;
}

.stat-deposits {
    color: var(--accent-green);
}

.stat-commission {
    color: var(--accent-purple);
    font-weight: 600;
}

.stat-ngr.positive {
    color: var(--accent-green);
}

.stat-ngr.negative {
    color: var(--accent-red);
}

/* Cost Ratio Indicators */
.stat-cost-ratio {
    font-weight: 600;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-variant-numeric: tabular-nums;
    display: inline-block;
    min-width: 40px;
    text-align: center;
}

.stat-cost-ratio.cost-good {
    color: #22c55e;
    background: rgba(34, 197, 94, 0.15);
}

.stat-cost-ratio.cost-ok {
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.15);
}

.stat-cost-ratio.cost-high {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.15);
}

th.sortable:hover {
    color: var(--accent-blue);
    background: rgba(74, 158, 255, 0.05);
}

th.sortable.active {
    color: var(--accent-blue);
}

.sort-icon {
    font-size: 0.6rem;
    margin-left: 2px;
    opacity: 0.3;
    transition: opacity 0.2s;
    vertical-align: middle;
}

th.sortable:hover .sort-icon {
    opacity: 0.6;
}

th.sortable.active .sort-icon {
    opacity: 1;
    color: var(--accent-blue);
}

td {
    padding: 0.75rem 0.5rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

td.col-checkbox { text-align: center; }
td.col-num { text-align: center; color: var(--text-muted); font-size: 0.8rem; }
td.col-stat { text-align: right; }
td.col-money { text-align: right; }
td.col-actions { text-align: center; }

tr:last-child td {
    border-bottom: none;
}

tbody tr {
    transition: background 0.15s;
}

tbody tr:hover {
    background: rgba(74, 158, 255, 0.04);
}

.row-number {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg-tertiary);
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
}

.crm-id {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    font-weight: 700;
    color: #1e1e2e;
    background: #fbbf24;
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    border: 1px solid #f59e0b;
}

/* ============================================
   CHECKBOX GROUPS
   ============================================ */
.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.85rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.85rem;
}

.checkbox-item:hover {
    border-color: var(--accent-blue);
    background: rgba(74, 158, 255, 0.05);
}

.checkbox-item:has(input:checked) {
    background: rgba(74, 158, 255, 0.15);
    border-color: var(--accent-blue);
}

.checkbox-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent-blue);
    cursor: pointer;
}

.checkbox-label {
    font-weight: 500;
    color: var(--text-primary);
}

/* ============================================
   MODEL FIELDS
   ============================================ */
.model-fields {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
    animation: slideDown 0.2s ease;
}

/* ============================================
   NETWORK DETAILS
   ============================================ */
.network-details {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.1) 0%, rgba(168, 85, 247, 0.1) 100%);
    border: 1px solid rgba(6, 182, 212, 0.3);
    border-radius: 12px;
    padding: 0.75rem;
    margin-bottom: 1rem;
    animation: slideDown 0.2s ease;
}

.network-details-header {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--accent-cyan);
    margin-bottom: 0.25rem;
}

.network-details > p {
    margin-bottom: 0.5rem !important;
}

.network-sources-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-top: 0.5rem;
}

.network-source-item {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 0.4rem 0.6rem;
    transition: all 0.2s ease;
}

.network-source-item:hover {
    background: rgba(0, 0, 0, 0.3);
}

.network-source-toggle {
    margin: 0;
    padding: 0;
}

.network-source-toggle .checkbox-label {
    font-size: 0.8rem;
}

.network-source-details {
    margin-top: 0.4rem;
    padding-top: 0.4rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.network-source-input {
    width: 100%;
    padding: 0.4rem 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.3);
    color: var(--text-primary);
    font-size: 0.75rem;
}

.network-source-input:focus {
    outline: none;
    border-color: var(--accent-cyan);
    box-shadow: 0 0 0 2px rgba(6, 182, 212, 0.2);
}

.network-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    background: rgba(6, 182, 212, 0.15);
    color: var(--accent-cyan);
    border: 1px solid rgba(6, 182, 212, 0.3);
}

.network-sources-display {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.network-source-view-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.5rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    border-left: 3px solid var(--accent-cyan);
}

.network-source-tag {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
}

.network-source-detail {
    font-size: 0.7rem;
    color: var(--text-secondary);
    padding-left: 1rem;
    font-style: italic;
}

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

.model-fields-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* ============================================
   URLS CONTAINER
   ============================================ */
.urls-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.url-entry {
    animation: slideDown 0.2s ease;
}

.url-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.url-input {
    flex: 1;
    min-width: 0;
}

.url-indexed-btn {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.url-indexed-btn:hover {
    border-color: var(--accent-blue);
    color: var(--accent-blue);
}

.url-indexed-btn.indexed {
    background: rgba(16, 185, 129, 0.15);
    border-color: var(--accent-green);
    color: var(--accent-green);
}

.position-select {
    width: 70px;
    text-align: center;
}

.remove-url {
    flex-shrink: 0;
}

/* ============================================
   COMMENTS CELL
   ============================================ */
.comments-cell {
    max-width: 200px;
}

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

/* ============================================
   VIEW MODAL URL LIST
   ============================================ */
.url-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.url-list-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.url-position {
    background: var(--accent-purple);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    min-width: 32px;
    text-align: center;
    font-family: 'JetBrains Mono', monospace;
}

.url-link {
    flex: 1;
    color: var(--accent-blue);
    text-decoration: none;
    word-break: break-all;
    font-size: 0.9rem;
}

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

/* ============================================
   KPI BADGES
   ============================================ */
.kpi-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.kpi-badge {
    padding: 0.35rem 0.7rem;
    background: rgba(168, 85, 247, 0.15);
    color: var(--accent-purple);
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

/* ============================================
   RATE DISPLAY
   ============================================ */
.rate-display {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.rate-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0.75rem 1rem;
}

.rate-label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.rate-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent-green);
    font-family: 'JetBrains Mono', monospace;
}

/* ============================================
   PARTNER & BADGES
   ============================================ */
.partner-cell {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

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

.partner-source {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.geo-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.35rem 0.65rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
}

.model-badge {
    display: inline-block;
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.model-cpa { background: rgba(74, 158, 255, 0.15); color: var(--accent-blue); }
.model-revshare { background: rgba(168, 85, 247, 0.15); color: var(--accent-purple); }
.model-hybrid { background: rgba(236, 72, 153, 0.15); color: var(--accent-pink); }
.model-flat-fee { background: rgba(34, 197, 94, 0.15); color: var(--accent-green); }
.model-fee-hybrid { background: rgba(249, 115, 22, 0.15); color: var(--accent-orange); }
.model-fee-cpa { background: rgba(6, 182, 212, 0.15); color: var(--accent-cyan); }
.model-fee-rs { background: rgba(132, 204, 22, 0.15); color: var(--accent-lime); }

.source-badge {
    display: inline-block;
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(249, 115, 22, 0.15);
    color: var(--accent-orange);
}

.assigned-badge {
    display: inline-block;
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    background: rgba(168, 85, 247, 0.15);
    color: var(--accent-purple);
}

/* ============================================
   TAGS
   ============================================ */
.tag-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    background: rgba(236, 72, 153, 0.2);
    color: var(--accent-pink);
    border: 1px solid rgba(236, 72, 153, 0.3);
    margin-right: 0.25rem;
    margin-bottom: 0.25rem;
}

.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.tags-input-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.5rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    min-height: 42px;
    align-items: center;
}

.tags-input-wrapper:focus-within {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(74, 158, 255, 0.1);
}

.tag-item {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.5rem;
    background: rgba(236, 72, 153, 0.2);
    color: var(--accent-pink);
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
}

.tag-remove {
    cursor: pointer;
    opacity: 0.7;
    font-size: 0.9rem;
}

.tag-remove:hover {
    opacity: 1;
}

.tag-input {
    flex: 1;
    min-width: 100px;
    border: none !important;
    background: transparent !important;
    padding: 0.25rem !important;
    box-shadow: none !important;
}

.tag-input:focus {
    outline: none !important;
}

/* ============================================
   PER-GEO RATES
   ============================================ */
.geo-rates-container {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
    margin-top: 1rem;
    animation: slideDown 0.2s ease;
}

.geo-rate-item {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border-radius: 8px;
    margin-bottom: 0.5rem;
}

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

.geo-rate-label {
    font-weight: 700;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    min-width: 60px;
    flex-shrink: 0;
}

.geo-rate-input {
    flex: 1;
    min-width: 120px;
    padding: 0.6rem 0.75rem;
    font-size: 0.85rem;
}

.geo-rate-view {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.geo-rate-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0.75rem 1rem;
    min-width: 120px;
}

.geo-rate-card-geo {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.geo-rate-card-values {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.geo-rate-card-value {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--accent-green);
    font-family: 'JetBrains Mono', monospace;
}

/* ============================================
   STATUS BADGES
   ============================================ */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
}

.status-new { background: rgba(74, 158, 255, 0.15); color: var(--accent-blue); }
.status-new .status-dot { background: var(--accent-blue); }
.status-hunting { background: rgba(236, 72, 153, 0.15); color: var(--accent-pink); }
.status-hunting .status-dot { background: var(--accent-pink); animation: pulse 1.5s infinite; }
.status-contacted { background: rgba(234, 179, 8, 0.15); color: var(--accent-yellow); }
.status-contacted .status-dot { background: var(--accent-yellow); }
.status-negotiating { background: rgba(168, 85, 247, 0.15); color: var(--accent-purple); }
.status-negotiating .status-dot { background: var(--accent-purple); }
.status-approved { background: rgba(34, 197, 94, 0.15); color: var(--accent-green); }
.status-approved .status-dot { background: var(--accent-green); }
.status-live { background: var(--accent-green); color: #fff; border: 1px solid var(--accent-green); }
.status-live .status-dot { background: #fff; box-shadow: 0 0 6px rgba(255, 255, 255, 0.5); }
.status-hold { background: rgba(249, 115, 22, 0.15); color: var(--accent-orange); }
.status-hold .status-dot { background: var(--accent-orange); }
.status-waiting { background: rgba(6, 182, 212, 0.15); color: var(--accent-cyan); }
.status-waiting .status-dot { background: var(--accent-cyan); animation: pulse 1.5s infinite; }
.status-rejected { background: rgba(239, 68, 68, 0.15); color: var(--accent-red); }
.status-rejected .status-dot { background: var(--accent-red); }
.status-archived { background: rgba(96, 96, 112, 0.15); color: var(--text-muted); }
.status-archived .status-dot { background: var(--text-muted); }

.status-badge.clickable {
    cursor: pointer;
    transition: all 0.2s;
}

.status-badge.clickable:hover {
    transform: scale(1.05);
    filter: brightness(1.2);
}

/* ============================================
   BULK SELECTION
   ============================================ */
.bulk-checkbox {
    width: 18px;
    height: 18px;
    accent-color: var(--accent-blue);
    cursor: pointer;
}

.bulk-actions-bar {
    display: none;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1.25rem;
    background: linear-gradient(135deg, rgba(74, 158, 255, 0.15) 0%, rgba(168, 85, 247, 0.15) 100%);
    border: 1px solid var(--accent-blue);
    border-radius: 12px;
    margin-bottom: 1rem;
    animation: slideDown 0.2s ease;
}

.bulk-actions-bar.active {
    display: flex;
}

.bulk-count {
    font-weight: 700;
    color: var(--accent-blue);
}

/* ============================================
   ACTIVITY LOG
   ============================================ */
.activity-log {
    max-height: 200px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.activity-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-secondary);
    border-radius: 8px;
    font-size: 0.8rem;
    border-left: 3px solid var(--accent-blue);
}

.activity-time {
    color: var(--text-muted);
    font-size: 0.7rem;
    white-space: nowrap;
}

.activity-text {
    color: var(--text-secondary);
}

/* ============================================
   DATE DISPLAY
   ============================================ */
.date-badge {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
}

.date-badge.fresh {
    color: var(--accent-green);
    font-weight: 600;
}

.date-badge.recent {
    color: var(--accent-cyan);
}

.date-badge.stale {
    color: var(--accent-orange);
}

.date-badge.very-stale {
    color: var(--accent-red);
}

/* ============================================
   STATUS DROPDOWN
   ============================================ */
.status-dropdown {
    position: absolute;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.5rem;
    box-shadow: 0 10px 40px rgba(0,0,0,0.4);
    z-index: 50;
    min-width: 160px;
    animation: fadeIn 0.15s ease;
}

.status-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: background 0.15s;
}

.status-dropdown-item:hover {
    background: var(--bg-tertiary);
}

/* ============================================
   SETTINGS MODAL
   ============================================ */
.settings-section {
    margin-bottom: 1.5rem;
}

.settings-section-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.settings-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.settings-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.75rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.85rem;
}

.settings-item-remove {
    cursor: pointer;
    color: var(--text-muted);
    font-size: 1rem;
}

.settings-item-remove:hover {
    color: var(--accent-red);
}

.settings-add-input {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.settings-add-input input {
    flex: 1;
}

.geo-suggestions-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: calc(-1 * 60px);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    max-height: 280px;
    overflow-y: auto;
    z-index: 100;
    box-shadow: 0 10px 30px rgba(0,0,0,0.35);
    margin-top: 4px;
    padding: 4px 0;
}

.geo-suggestion-item {
    padding: 9px 14px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.15s, transform 0.1s;
    border-left: 3px solid transparent;
}

.geo-suggestion-item:hover {
    background: var(--bg-tertiary);
    border-left-color: var(--accent-blue);
}

.geo-suggestion-item:active {
    transform: scale(0.99);
}

.geo-suggestion-item strong {
    min-width: 30px;
    color: var(--accent-blue);
}

.geo-suggestion-item .flag-icon {
    flex-shrink: 0;
}

/* Partner edit GEO search input */
.geo-search-input {
    width: 100%;
    padding: 7px 12px;
    margin-bottom: 8px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s;
}

.geo-search-input:focus {
    border-color: var(--accent-blue);
}

.geo-checkbox-list {
    max-height: 200px;
    overflow-y: auto;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.geo-checkbox-item {
    transition: opacity 0.15s;
}

/* ============================================
   FILTER COUNT BADGES
   ============================================ */
.filter-count {
    background: var(--accent-blue);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.15rem 0.4rem;
    border-radius: 10px;
    margin-left: 0.3rem;
}

.next-steps-cell {
    max-width: 200px;
}

.next-steps-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.actions-cell {
    display: flex;
    gap: 0.25rem;
    flex-wrap: nowrap;
    justify-content: center;
}

.actions-cell .btn-icon.btn-small {
    width: 26px;
    height: 26px;
    font-size: 0.75rem;
    padding: 0;
}

/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state {
    text-align: center;
    padding: 5rem 2rem;
    color: var(--text-secondary);
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    opacity: 0.3;
}

.empty-state h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    font-weight: 600;
}

/* ============================================
   MODAL STYLES
   ============================================ */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.modal-overlay.active {
    display: flex;
}

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

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.5);
}

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

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

.modal-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
}

.modal-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 10px;
    font-size: 1.25rem;
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--accent-red);
    border-color: var(--accent-red);
    color: white;
}

.modal-body {
    padding: 1.75rem;
}

/* Export Modal Styles */
.export-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.export-section:last-of-type {
    border-bottom: none;
    margin-bottom: 1rem;
}

.export-section h3 {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.export-period-options,
.export-format-options {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.export-radio,
.export-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.export-radio input,
.export-checkbox input {
    width: 16px;
    height: 16px;
    accent-color: var(--accent-primary);
    cursor: pointer;
}

.export-options-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
}

.export-date-range {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    padding: 1rem;
    background: var(--bg-tertiary);
    border-radius: 8px;
}

.export-date-range .date-input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.export-date-range label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.export-date-range input[type="date"] {
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.875rem;
}

.export-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

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

.form-section-title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

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

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.form-group label .required {
    color: var(--accent-red);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
}

/* Exception for amount input group - don't force 100% width */
.amount-input-group input,
.amount-input-group select {
    width: auto;
}

.form-group textarea {
    min-height: 90px;
    resize: vertical;
    line-height: 1.5;
}

.form-group small {
    display: block;
    margin-top: 0.4rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1.25rem 1.75rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-tertiary);
}

/* ============================================
   VIEW DEAL MODAL
   ============================================ */
.view-modal {
    max-width: 700px;
}

.view-header {
    padding: 1.5rem 2rem;
    background: var(--gradient-1);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.view-header::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.view-header-content {
    position: relative;
    z-index: 1;
    flex: 1;
}

.view-header-actions {
    position: relative;
    z-index: 1;
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.view-header-actions button,
.view-header-actions .btn-small,
.view-header-actions .btn-secondary,
.view-header-actions .btn-primary,
.view-header-actions .btn-danger {
    padding: 0.4rem 0.6rem !important;
    border-radius: 6px !important;
    background: rgba(255, 255, 255, 0.15) !important;
    border: 1px solid rgba(255, 255, 255, 0.25) !important;
    color: white !important;
    backdrop-filter: blur(4px);
}

.view-header-actions button:hover,
.view-header-actions .btn-small:hover,
.view-header-actions .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.25) !important;
    border-color: rgba(255, 255, 255, 0.4) !important;
}

.view-header-actions .btn-primary {
    background: rgba(255, 255, 255, 0.9) !important;
    color: #0d9488 !important;
    border-color: transparent !important;
}

.view-header-actions .btn-primary:hover {
    background: white !important;
}

.view-header-actions .btn-danger {
    background: rgba(239, 68, 68, 0.8) !important;
    border-color: rgba(239, 68, 68, 0.5) !important;
    color: white !important;
}

.view-header-actions .btn-danger:hover {
    background: rgba(239, 68, 68, 1) !important;
}

.view-partner-name {
    font-size: 1.75rem;
    font-weight: 800;
    color: white;
    margin-bottom: 0.5rem;
}

.view-badges {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.view-badges .status-badge,
.view-badges .model-badge,
.view-badges .geo-badge {
    background: rgba(255,255,255,0.2);
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
}

.view-body {
    padding: 2rem;
}

.view-section {
    margin-bottom: 2rem;
}

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

.view-section-title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent-blue);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.view-section-content {
    font-size: 1rem;
    line-height: 1.7;
    color: var(--text-primary);
    background: var(--bg-tertiary);
    padding: 1.25rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.view-section-content.empty {
    color: var(--text-muted);
    font-style: italic;
}

.view-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.view-meta-item {
    background: var(--bg-tertiary);
    padding: 0.75rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    min-width: 0;
}

.view-meta-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
}

.view-meta-value {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    word-break: break-word;
    overflow-wrap: break-word;
}

.view-meta-value a {
    word-break: break-all;
}

.view-footer {
    display: flex;
    justify-content: space-between;
    padding: 1.25rem 2rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-tertiary);
}

.view-timestamp {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ============================================
   DASHBOARD GRID
   ============================================ */
.dashboard-grid {
    margin-bottom: 1.25rem;
}

/* ============================================
   STATS BAR
   ============================================ */
.stats-bar {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.stat-card {
    background: rgba(20, 26, 35, 0.7);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(16, 185, 129, 0.1);
    border-radius: 14px;
    padding: 1rem 1.5rem;
    min-width: 140px;
    flex: 1;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.2);
}

.stat-card.clickable {
    cursor: pointer;
}

.stat-card.clickable:hover {
    border-color: var(--accent-cyan);
    box-shadow: 0 8px 25px rgba(0,0,0,0.2), 0 0 0 1px var(--accent-cyan);
}

.stat-card.clickable:active {
    transform: translateY(0);
}

[data-theme="light"] .stat-card {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(5, 150, 105, 0.08);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
}

.stat-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    opacity: 0.05;
    transform: translate(20px, 20px);
}

.stat-total::before { background: var(--gradient-1); }
.stat-total::after { background: var(--accent-blue); }
.stat-live::before { background: var(--accent-green); box-shadow: 0 0 10px var(--accent-green); }
.stat-live::after { background: var(--accent-green); }
.stat-pending::before { background: var(--accent-yellow); }
.stat-pending::after { background: var(--accent-yellow); }
.stat-rejected::before { background: var(--accent-red); }
.stat-rejected::after { background: var(--accent-red); }

.stat-value {
    font-size: 2rem;
    font-weight: 800;
    font-family: 'JetBrains Mono', monospace;
    line-height: 1;
}

.stat-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-top: 0.4rem;
}

.stat-total .stat-value { color: var(--accent-blue); }
.stat-live .stat-value { color: var(--accent-green); }
.stat-pending .stat-value { color: var(--accent-yellow); }
.stat-rejected .stat-value { color: var(--accent-red); }

/* ============================================
   CHARTS ROW
   ============================================ */
.charts-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1rem;
}

.chart-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 1rem;
    min-height: 160px;
}

.chart-title {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.chart-bars {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.chart-bar-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chart-bar-item.chart-bar-clickable {
    cursor: pointer;
    border-radius: 4px;
    padding: 2px 4px;
    margin: -2px -4px;
    transition: background-color 0.2s ease;
}

.chart-bar-item.chart-bar-clickable:hover {
    background: rgba(255, 255, 255, 0.05);
}

.chart-bar-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 70px;
    white-space: nowrap;
}

.chart-bar-track {
    flex: 1;
    height: 20px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.chart-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 6px;
}

.chart-bar-value {
    font-size: 0.65rem;
    font-weight: 700;
    color: white;
    font-family: 'JetBrains Mono', monospace;
}

.bar-blue { background: var(--accent-blue); }
.bar-green { background: var(--accent-green); }
.bar-yellow { background: var(--accent-yellow); }
.bar-purple { background: var(--accent-purple); }
.bar-orange { background: var(--accent-orange); }
.bar-red { background: var(--accent-red); }
.bar-cyan { background: var(--accent-cyan); }
.bar-pink { background: var(--accent-pink); }

/* ============================================
   ONLINE USERS
   ============================================ */
.online-users {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.online-count {
    background: rgba(34, 197, 94, 0.15);
    color: var(--accent-green);
    padding: 0.3rem 0.6rem;
    border-radius: 12px;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
.toast-container {
    position: fixed;
    top: 5rem;
    right: 2rem;
    z-index: 2147483647; /* Maximum z-index value */
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: 350px;
    isolation: isolate;
    pointer-events: none;
}

.toast-container .toast {
    pointer-events: auto;
}

.toast {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: slideIn 0.3s ease;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    font-weight: 500;
}

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

.toast-success { border-left: 4px solid var(--accent-green); }
.toast-error { border-left: 4px solid var(--accent-red); }
.toast-info { border-left: 4px solid var(--accent-blue); }

/* ============================================
   LOADING STATES
   ============================================ */
.loading-spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.loading-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    flex-direction: column;
    gap: 1.5rem;
}

.loading-overlay.hidden {
    display: none;
}

.loading-overlay p {
    color: var(--text-secondary);
    font-weight: 500;
}

/* Table Loading Skeleton */
.table-loading {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.skeleton-row {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.skeleton {
    background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--border-color) 50%, var(--bg-tertiary) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 6px;
}

.skeleton-cell {
    height: 40px;
    flex: 1;
}

.skeleton-cell-sm {
    width: 60px;
    height: 40px;
}

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

/* Button Loading State */
.btn-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* ============================================
   SCROLLBAR
   ============================================ */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

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

::-webkit-scrollbar-thumb:hover {
    background: var(--border-light);
}

/* ============================================
   KEYBOARD SHORTCUTS HINT
   ============================================ */
.keyboard-hint {
    position: fixed;
    bottom: 1rem;
    left: 260px;
    right: 0;
    width: fit-content;
    margin: 0 auto;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    font-size: 0.7rem;
    color: var(--text-muted);
    display: flex;
    gap: 1rem;
    z-index: 50;
    pointer-events: none;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.keyboard-hint:hover {
    opacity: 1;
    pointer-events: auto;
}

.keyboard-hint span {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    white-space: nowrap;
}

.keyboard-hint span + span {
    padding-left: 1rem;
    border-left: 1px solid var(--border-color);
}

.keyboard-hint kbd {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 0.1rem 0.4rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.65rem;
}

/* ============================================
   RESPONSIVE - SMALL LAPTOPS (13" screens)
   Table FITS - no horizontal scrolling!
   ============================================ */
/* Covers: 13" MacBooks, smaller laptops, and zoomed browsers */
@media (max-width: 1680px) {
    /* =========================================
       CLEAN COMPACT VIEW FOR SMALLER SCREENS
       ========================================= */
    
    /* Container fits content */
    .table-container {
        overflow-x: auto;
        overflow-y: auto;
    }
    
    table {
        table-layout: auto !important;  /* Let columns size naturally */
        width: 100% !important;
    }
    
    /* Hide less important columns cleanly - ONLY for Partners table */
    /* Hide: Checkbox, Row #, Deposits, Commission, Cost% */
    .deals-table-container table th:nth-child(1), .deals-table-container table td:nth-child(1),
    .deals-table-container table th:nth-child(2), .deals-table-container table td:nth-child(2),
    .deals-table-container table th:nth-child(10), .deals-table-container table td:nth-child(10),
    .deals-table-container table th:nth-child(11), .deals-table-container table td:nth-child(11),
    .deals-table-container table th:nth-child(12), .deals-table-container table td:nth-child(12) {
        display: none !important;
    }
    
    /* Clean cell styling */
    table th, table td {
        padding: 0.5rem 0.4rem !important;
        font-size: 0.75rem !important;
        white-space: nowrap;
    }
    
    /* GEO column specifically - contain overflow */
    table td.col-geo {
        overflow: hidden !important;
        max-width: 110px !important;
    }
    
    /* ID column - show full ID */
    table td:nth-child(3) .crm-id {
        font-size: 0.7rem !important;
        padding: 0.25rem 0.5rem !important;
        min-width: 50px !important;
        max-width: none !important;
    }
    
    /* Partner name - reasonable width */
    table th:nth-child(4), table td:nth-child(4) {
        min-width: 120px;
        max-width: 180px;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    /* GEO column - contain multiple flags */
    .col-geo {
        max-width: 110px !important;
        overflow: hidden !important;
    }
    
    .geo-badge {
        font-size: 0.7rem !important;
        padding: 0.15rem 0.25rem !important;
    }
    
    /* Source badge - don't crop */
    .source-badge {
        min-width: fit-content !important;
        white-space: nowrap !important;
    }
    
    /* Action buttons - proper spacing */
    .action-btn {
        padding: 0.25rem 0.35rem !important;
        font-size: 0.7rem !important;
        margin: 0 1px !important;
    }
    
    /* Status badge - don't crop */
    .status-badge {
        font-size: 0.65rem !important;
        padding: 0.2rem 0.5rem !important;
        white-space: nowrap !important;
        min-width: fit-content !important;
    }
    
    /* Tags clean */
    .tag-badge {
        font-size: 0.6rem !important;
        padding: 0.15rem 0.3rem !important;
    }
    
    /* GEO badge clean */
    .geo-badge {
        font-size: 0.65rem !important;
        padding: 0.15rem 0.3rem !important;
    }
    
    /* =========================================
       FILTERS - Uniform sizing
       ========================================= */
    .filters {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
        align-items: center;
    }
    
    .filter-group select,
    .filter-group input[type="text"] {
        padding: 0.5rem 0.6rem;
        font-size: 0.75rem;
        min-width: 100px;
        min-height: 32px;
        line-height: 1.2;
        border-radius: 6px;
        border: 1px solid var(--border-color);
        background: var(--bg-tertiary);
        color: var(--text-primary);
    }
    
    /* Search input specific */
    #searchInput {
        min-width: 140px !important;
        max-width: 180px;
    }
    
    .filter-label {
        font-size: 0.7rem;
    }
    
    /* =========================================
       SIDEBAR & LAYOUT
       ========================================= */
    .sidebar {
        width: 180px;
    }
    
    .main-content {
        margin-left: 180px;
        overflow-x: hidden !important;
    }
    
    .keyboard-hint {
        left: 180px;
    }
    
    .nav-link {
        padding: 0.6rem 0.8rem;
        font-size: 0.8rem;
    }
    
    /* =========================================
       DASHBOARD CARDS
       ========================================= */
    .stat-card {
        padding: 0.6rem 0.8rem;
    }
    
    .stat-value {
        font-size: 1.3rem;
    }
    
    .stat-label {
        font-size: 0.75rem;
    }
    
    .live-perf-summary {
        gap: 0.4rem;
    }
    
    .live-perf-card {
        padding: 0.4rem;
    }
    
    /* =========================================
       TOP BAR
       ========================================= */
    .top-bar {
        padding: 0.4rem 0.75rem;
        gap: 0.4rem;
    }
    
    .page-title {
        font-size: 1rem;
    }
    
    .sync-btn {
        padding: 0.3rem 0.6rem;
        font-size: 0.75rem;
    }
    
}

/* ============================================
   RESPONSIVE - TABLET
   ============================================ */
@media (max-width: 1200px) {
    .charts-row {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Even smaller for tablets */
    .stat-value {
        font-size: 1.25rem;
    }
    
    .sidebar {
        width: 200px;
    }
    
    .main-content {
        margin-left: 200px;
    }
    
    .keyboard-hint {
        left: 200px;
    }
}

@media (max-width: 1024px) {
    /* On tablets, table still fits but more compact */
    .table-container {
        overflow-x: auto;
    }

    table {
        table-layout: fixed !important;
        width: 100% !important;
        min-width: auto !important;
    }
    
    /* Hide even more columns on tablets */
    table th:nth-child(1), table td:nth-child(1),
    table th:nth-child(2), table td:nth-child(2),
    table th:nth-child(8), table td:nth-child(8),   /* REGS */
    table th:nth-child(9), table td:nth-child(9),   /* FTDS */
    table th:nth-child(10), table td:nth-child(10),
    table th:nth-child(11), table td:nth-child(11),
    table th:nth-child(12), table td:nth-child(12),
    table th:nth-child(13), table td:nth-child(13) {
        display: none !important;
    }
    
    .keyboard-hint {
        left: 0;
    }
}

/* ============================================
   RESPONSIVE - MOBILE
   ============================================ */
@media (max-width: 768px) {
    .container {
        padding: 0.75rem;
    }

    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .logo h1 {
        font-size: 1.2rem;
    }

    .header-actions {
        width: 100%;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .header-actions button {
        font-size: 0.75rem;
        padding: 0.5rem 0.75rem;
    }

    .online-users {
        font-size: 0.7rem;
    }

    .stats-bar {
        gap: 0.5rem;
    }

    .stat-card {
        padding: 0.75rem 1rem;
        min-width: 70px;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    .stat-label {
        font-size: 0.6rem;
    }

    .filters {
        flex-direction: column;
        align-items: stretch;
        padding: 0.75rem;
        gap: 0.5rem;
    }

    .filter-group {
        width: 100%;
    }

    .filter-group select,
    .filter-group input {
        width: 100%;
    }

    .form-row, .form-row-3 {
        grid-template-columns: 1fr;
    }

    .view-meta {
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }
    
    .view-meta-item {
        padding: 0.65rem;
        overflow: hidden;
    }
    
    .view-meta-value {
        font-size: 0.85rem;
    }

    .modal {
        margin: 0.5rem;
        max-height: 95vh;
    }

    .view-modal {
        max-width: 100%;
    }

    .charts-row {
        grid-template-columns: 1fr;
    }

    .keyboard-hint {
        display: none;
    }

    .toast-container {
        bottom: 1rem;
        right: 1rem;
        left: 1rem;
    }

    .toast {
        width: 100%;
    }
}

/* ============================================
   MOBILE CARDS VIEW
   ============================================ */
.mobile-cards {
    display: none;
}

@media (max-width: 600px) {
    .table-container table {
        display: none;
    }

    .table-container {
        overflow-x: visible;
    }

    .mobile-cards {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
    }

    .mobile-card {
        background: var(--bg-tertiary);
        border: 1px solid var(--border-color);
        border-radius: 16px;
        padding: 1rem;
        position: relative;
        overflow: hidden;
        transition: all 0.2s ease;
    }
    
    .mobile-card::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: 3px;
        background: var(--gradient-1);
        opacity: 0.5;
    }
    
    .mobile-card:active {
        transform: scale(0.98);
    }

    .mobile-card-header {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        margin-bottom: 0.75rem;
    }

    .mobile-card-title {
        font-weight: 700;
        font-size: 1rem;
        color: var(--text-primary);
    }

    .mobile-card-id {
        font-family: 'JetBrains Mono', monospace;
        font-size: 0.7rem;
        font-weight: 700;
        color: #1e1e2e;
        background: #fbbf24;
        padding: 0.2rem 0.5rem;
        border-radius: 4px;
        border: 1px solid #f59e0b;
    }

    .mobile-card-badges {
        display: flex;
        flex-wrap: wrap;
        gap: 0.4rem;
        margin-bottom: 0.75rem;
    }

    .mobile-card-badges .geo-badge,
    .mobile-card-badges .model-badge,
    .mobile-card-badges .status-badge,
    .mobile-card-badges .source-badge,
    .mobile-card-badges .assigned-badge {
        font-size: 0.65rem;
        padding: 0.25rem 0.5rem;
    }

    .mobile-card-info {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
        font-size: 0.8rem;
        color: var(--text-secondary);
        margin-bottom: 0.75rem;
    }

    .mobile-card-info-item {
        display: flex;
        flex-direction: column;
    }

    .mobile-card-info-label {
        font-size: 0.65rem;
        color: var(--text-muted);
        text-transform: uppercase;
        font-weight: 600;
    }

    .mobile-card-actions {
        display: flex;
        gap: 0.5rem;
        padding-top: 0.75rem;
        border-top: 1px solid var(--border-color);
    }

    .mobile-card-actions button {
        flex: 1;
        font-size: 0.8rem;
    }

    .view-meta {
        grid-template-columns: 1fr;
        gap: 0.5rem;
        margin-bottom: 1rem;
    }
    
    .view-meta-item {
        padding: 0.6rem;
    }
    
    .view-meta-value {
        font-size: 0.85rem;
    }
    
    .view-body {
        padding: 1rem;
    }
    
    .view-header {
        padding: 1rem;
    }
    
    .view-footer {
        padding: 0.75rem 1rem;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .network-sources-display {
        gap: 0.4rem;
    }
    
    .network-source-view-item {
        padding: 0.4rem;
    }

    .charts-row {
        grid-template-columns: 1fr 1fr;
    }

    .chart-card {
        min-height: 120px;
        padding: 0.75rem;
    }

    .chart-title {
        font-size: 0.65rem;
    }

    .chart-bar-label {
        font-size: 0.6rem;
        min-width: 50px;
    }
}

@media (max-width: 400px) {
    .charts-row {
        grid-template-columns: 1fr;
    }

    .stat-card {
        min-width: 60px;
    }

    .stat-value {
        font-size: 1.25rem;
    }

    .bulk-actions-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}

/* ============================================
   AUTHENTICATION STYLES
   ============================================ */

/* Auth Container */
.auth-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
}

.auth-box {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
}

.auth-header h1 {
    font-size: 1.75rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    color: #C8A249;
    letter-spacing: 4px;
}

.auth-header p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* Auth Tabs */
.auth-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    background: var(--bg-tertiary);
    border-radius: 12px;
    padding: 0.25rem;
}

.auth-tab {
    flex: 1;
    padding: 0.75rem 1rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.auth-tab:hover {
    color: var(--text-primary);
}

.auth-tab.active {
    background: #C8A249;
    color: #0D0D0D;
    box-shadow: 0 4px 15px rgba(200, 162, 73, 0.3);
}

/* Auth Forms */
.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
}

.auth-form-group {
    margin-bottom: 1rem;
}

.auth-form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.auth-form-group input {
    width: 100%;
    padding: 0.875rem 1rem;
    font-size: 0.95rem;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    transition: all 0.2s;
}

.auth-form-group input:focus {
    outline: none;
    border-color: #C8A249;
    box-shadow: 0 0 0 4px rgba(200, 162, 73, 0.1);
}

.auth-form-group input::placeholder {
    color: var(--text-muted);
}

.auth-submit {
    width: 100%;
    padding: 1rem;
    margin-top: 0.5rem;
    font-size: 1rem;
    font-weight: 700;
    background: #C8A249;
    color: #0D0D0D;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 15px rgba(200, 162, 73, 0.3);
}

.auth-submit:hover {
    transform: translateY(-2px);
    background: #D4B86A;
    box-shadow: 0 6px 20px rgba(200, 162, 73, 0.4);
}

.auth-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Auth Message */
.auth-message {
    padding: 0.875rem 1rem;
    border-radius: 10px;
    font-size: 0.875rem;
    margin-bottom: 1rem;
    display: none;
}

.auth-message.error {
    display: block;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--accent-red);
}

.auth-message.success {
    display: block;
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: var(--accent-green);
}

.invite-banner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 1rem 1.25rem;
    border-radius: 10px;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.15) 0%, rgba(118, 75, 162, 0.15) 100%);
    border: 1px solid rgba(102, 126, 234, 0.35);
    text-align: center;
}

.invite-banner strong {
    color: #a78bfa;
    font-size: 0.95rem;
}

.invite-banner span {
    color: var(--text-secondary);
    font-size: 0.82rem;
}

/* Auth Links */
.auth-links {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.auth-link {
    color: var(--accent-blue);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.2s;
}

.auth-link:hover {
    color: var(--accent-purple);
    text-decoration: underline;
}

/* Forgot Password */
.forgot-password-link {
    display: block;
    text-align: right;
    margin-top: -0.5rem;
    margin-bottom: 1rem;
}

/* Password Strength */
.password-strength {
    height: 4px;
    background: var(--bg-tertiary);
    border-radius: 2px;
    margin-top: 0.5rem;
    overflow: hidden;
}

.password-strength-bar {
    height: 100%;
    border-radius: 2px;
    transition: all 0.3s;
    width: 0%;
}

.password-strength-bar.weak {
    width: 33%;
    background: var(--accent-red);
}

.password-strength-bar.medium {
    width: 66%;
    background: var(--accent-yellow);
}

.password-strength-bar.strong {
    width: 100%;
    background: var(--accent-green);
}

.password-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

/* User Info in Header */
.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    background: var(--bg-tertiary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--gradient-1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 700;
    color: white;
}

.user-details {
    display: flex;
    flex-direction: column;
}

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

.user-role {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Role Badges */
.role-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.role-superadmin {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.2), rgba(239, 68, 68, 0.2));
    color: #f472b6;
    border: 1px solid rgba(244, 114, 182, 0.3);
}

.role-admin {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-red);
}

.role-ceo {
    background: rgba(234, 179, 8, 0.15);
    color: #eab308;
}

.role-project-manager {
    background: rgba(20, 184, 166, 0.15);
    color: #14b8a6;
}

.role-manager {
    background: rgba(168, 85, 247, 0.15);
    color: var(--accent-purple);
}

.role-retention {
    background: rgba(249, 115, 22, 0.15);
    color: var(--accent-orange);
}

.role-viewer {
    background: rgba(96, 96, 112, 0.15);
    color: var(--text-muted);
}

.role-pending {
    background: rgba(249, 115, 22, 0.15);
    color: var(--accent-orange);
}

/* Pending Approval Screen */
.pending-approval-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg-primary);
    padding: 2rem;
    z-index: 10000; /* Above everything */
}

.pending-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 3rem;
    text-align: center;
    max-width: 450px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.pending-icon {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    animation: pendingPulse 2s ease-in-out infinite;
}

@keyframes pendingPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

.pending-card h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.pending-card p {
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    line-height: 1.6;
}

.pending-email {
    background: var(--bg-tertiary);
    padding: 0.75rem 1rem;
    border-radius: 10px;
    margin: 1.5rem 0 !important;
}

.pending-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1.5rem;
}

.pending-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 1.5rem !important;
}

/* Pending Users Section in Admin */
.pending-users-section {
    background: rgba(249, 115, 22, 0.05);
    border: 1px solid rgba(249, 115, 22, 0.2);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.pending-users-title {
    font-weight: 600;
    color: var(--accent-orange);
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
}

.user-item-pending {
    background: rgba(249, 115, 22, 0.08);
    border: 1px solid rgba(249, 115, 22, 0.15);
}

/* Users Management Modal */
.users-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 300px;
    overflow-y: auto;
}

.user-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    transition: all 0.2s;
}

.user-item:hover {
    border-color: var(--border-light);
}

.user-item-delete {
    width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-muted);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1rem;
}

.user-item-delete:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--accent-red);
    color: var(--accent-red);
}

/* Role Info Card */
.roles-info {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.roles-info-title {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.role-info-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.role-info-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.role-info-badge {
    flex-shrink: 0;
    width: 70px;
}

.role-info-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Confirm Delete Modal */
.confirm-delete-user {
    text-align: center;
    padding: 1rem 0;
}

.confirm-delete-user p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.confirm-delete-user strong {
    color: var(--text-primary);
}

.confirm-delete-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    margin-top: 1.5rem;
}

.user-item-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--gradient-1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

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

.user-item-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.user-item-email {
    font-size: 0.75rem;
    color: var(--text-muted);
    word-break: break-all;
}

.user-item-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.user-item-actions select {
    padding: 0.4rem 0.6rem;
    font-size: 0.75rem;
}

/* Divider */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.5rem 0;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

/* Mobile Auth */
@media (max-width: 480px) {
    .auth-box {
        padding: 1.5rem;
        margin: 0.5rem;
    }
    
    .auth-header h1 {
        font-size: 1.5rem;
    }
    
    .auth-logo {
        width: 60px;
        height: 60px;
        font-size: 1.75rem;
    }
    
    .user-info {
        padding: 0.4rem 0.75rem;
    }
    
    .user-details {
        display: none;
    }
}

/* ============================================
   NOTES & NOTIFICATIONS SYSTEM
   ============================================ */

/* Note Button */
.btn-note {
    background: rgba(249, 115, 22, 0.15);
    color: var(--accent-orange);
    border: 1px solid rgba(249, 115, 22, 0.3);
    position: relative;
}

.btn-note:hover {
    background: rgba(249, 115, 22, 0.25);
    border-color: var(--accent-orange);
}

.btn-note.has-notes::after {
    content: '';
    position: absolute;
    top: -3px;
    right: -3px;
    width: 10px;
    height: 10px;
    background: var(--accent-orange);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

/* Notes indicator on partner name */
.notes-indicator {
    display: inline-block;
    margin-left: 0.35rem;
    font-size: 0.75rem;
    animation: pulse 2s infinite;
    cursor: help;
}

/* Inbox Button in Header */
.btn-inbox {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.125rem;
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.15) 0%, rgba(239, 68, 68, 0.1) 100%);
    border: 1px solid rgba(249, 115, 22, 0.3);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--accent-orange);
    box-sizing: border-box;
}


.btn-inbox:hover {
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.25) 0%, rgba(239, 68, 68, 0.15) 100%);
    border-color: var(--accent-orange);
    transform: translateY(-1px);
}

.btn-inbox.has-unread {
    animation: inboxPulse 2s ease infinite;
}

@keyframes inboxPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(249, 115, 22, 0.4); }
    50% { box-shadow: 0 0 20px 8px rgba(249, 115, 22, 0.25); }
}

.inbox-count {
    background: linear-gradient(135deg, var(--accent-orange) 0%, var(--accent-red) 100%);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.2rem 0.5rem;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(249, 115, 22, 0.4);
}

/* (Blocker styles removed - using Inbox instead) */

/* Notes Panel in View Modal */
.notes-section {
    margin-top: 1.5rem;
}

.notes-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.notes-section-title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent-orange);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.notes-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.note-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.2s;
}

.note-card:hover {
    border-color: var(--border-light);
}

.note-card.note-done {
    opacity: 0.6;
    border-left: 4px solid var(--accent-green);
}

.note-card.note-active {
    border-left: 4px solid var(--accent-orange);
}

.note-main {
    padding: 1rem;
}

.note-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

.note-author {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.note-author-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--gradient-1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    color: white;
}

.note-author-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.note-time {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.note-message {
    font-size: 0.9rem;
    color: var(--text-primary);
    line-height: 1.6;
    margin-bottom: 0.75rem;
    white-space: pre-wrap;
}

.note-status {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
}

.note-status.status-active {
    background: rgba(249, 115, 22, 0.15);
    color: var(--accent-orange);
}

.note-status.status-done {
    background: rgba(34, 197, 94, 0.15);
    color: var(--accent-green);
}

.note-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
}

/* Note Replies */
.note-replies {
    background: var(--bg-tertiary);
    border-top: 1px solid var(--border-color);
    padding: 0.75rem 1rem;
}

.note-reply {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.note-reply:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.note-reply-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.25rem;
}

.note-reply-author {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent-purple);
}

.note-reply-time {
    font-size: 0.65rem;
    color: var(--text-muted);
}

.note-reply-message {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Reply Input */
.note-reply-input {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
}

.note-reply-input input {
    flex: 1;
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
}

/* Create Note Modal */
.create-note-form .form-group {
    margin-bottom: 1rem;
}

.create-note-form textarea {
    min-height: 120px;
    resize: vertical;
}

.recipient-options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.recipient-option {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.85rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.85rem;
}

.recipient-option:hover {
    border-color: var(--accent-blue);
}

.recipient-option:has(input:checked) {
    background: rgba(74, 158, 255, 0.15);
    border-color: var(--accent-blue);
}

.recipient-option input {
    accent-color: var(--accent-blue);
}

/* Notes Empty State */
.notes-empty {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
}

.notes-empty-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    opacity: 0.5;
}

/* Notes list scroll */
.notes-list {
    max-height: 400px;
    overflow-y: auto;
}

/* Note buttons */
.note-actions .btn-small {
    padding: 0.35rem 0.6rem;
    font-size: 0.75rem;
}

.btn-success {
    background: rgba(34, 197, 94, 0.15);
    color: var(--accent-green);
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.btn-success:hover {
    background: rgba(34, 197, 94, 0.25);
    border-color: var(--accent-green);
}

/* ============================================
   NOTE POPUP (on note button click)
   ============================================ */

.note-popup {
    position: fixed;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    z-index: 1000;
    width: 380px;
    max-width: 95vw;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
    animation: popupSlideIn 0.2s ease;
}

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

.note-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    border-radius: 16px 16px 0 0;
}

.note-popup-title {
    font-weight: 700;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.note-popup-badge {
    background: var(--accent-orange);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.2rem 0.5rem;
    border-radius: 10px;
}

.note-popup-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.15s;
}

.note-popup-close:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.note-popup-body {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem;
}

.note-popup-empty {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-muted);
}

.note-popup-empty-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    opacity: 0.5;
}

.note-popup-item {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0.85rem;
    margin-bottom: 0.5rem;
}

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

.note-popup-item.note-active {
    border-left: 3px solid var(--accent-orange);
}

.note-popup-item.note-done {
    border-left: 3px solid var(--accent-green);
    opacity: 0.7;
}

.note-popup-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.note-popup-author {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 600;
    font-size: 0.85rem;
}

.note-popup-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--gradient-1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    font-weight: 700;
    color: white;
}

.note-popup-time {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.note-popup-message {
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    white-space: pre-wrap;
    word-break: break-word;
}

.note-popup-replies { margin: 6px 0 8px 12px; padding-left: 10px; border-left: 2px solid var(--border-color); }
.note-popup-reply { display: flex; align-items: flex-start; gap: 6px; margin-bottom: 6px; }
.note-popup-reply-avatar { width: 20px; height: 20px; border-radius: 50%; background: var(--accent-purple); color: white; display: flex; align-items: center; justify-content: center; font-size: 9px; font-weight: 700; flex-shrink: 0; }
.note-popup-reply-content { font-size: 12px; line-height: 1.4; color: var(--text-secondary); }
.note-popup-reply-author { font-weight: 600; color: var(--text-primary); margin-right: 4px; }

.note-popup-replies-count {
    font-size: 0.75rem;
    color: var(--accent-purple);
    margin-bottom: 0.5rem;
}

.note-popup-actions {
    display: flex;
    gap: 0.4rem;
    margin-top: 0.5rem;
}

.note-popup-actions .btn-small {
    padding: 0.3rem 0.5rem;
    font-size: 0.7rem;
}

.note-popup-done-info {
    font-size: 0.75rem;
    color: var(--accent-green);
    margin-top: 0.5rem;
}

.note-popup-reply-form {
    display: flex;
    gap: 0.4rem;
    margin-top: 0.5rem;
}

.note-popup-reply-form input {
    flex: 1;
    padding: 0.4rem 0.6rem;
    font-size: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.note-popup-reply-form input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.note-popup-reply-form .btn-small {
    padding: 0.3rem 0.5rem;
    font-size: 0.7rem;
}

.note-popup-reply-input {
    display: flex;
    gap: 0.4rem;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-color);
}

.note-popup-reply-input input {
    flex: 1;
    padding: 0.4rem 0.6rem;
    font-size: 0.8rem;
    border-radius: 6px;
}

.note-popup-more {
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
    padding: 0.5rem;
}

.note-popup-footer {
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    border-radius: 0 0 16px 16px;
}

.note-popup-footer .btn-primary {
    width: 100%;
    padding: 0.6rem;
    font-size: 0.85rem;
}

/* (Countdown timer styles removed) */

/* Note Button Blinking Animation */
.btn-note.has-notes {
    animation: noteButtonBlink 1.5s ease-in-out infinite;
}

@keyframes noteButtonBlink {
    0%, 100% { 
        background: rgba(249, 115, 22, 0.15);
        box-shadow: 0 0 0 0 rgba(249, 115, 22, 0.4);
    }
    50% { 
        background: rgba(249, 115, 22, 0.35);
        box-shadow: 0 0 15px 5px rgba(249, 115, 22, 0.3);
    }
}

/* Mobile Note Popup */
@media (max-width: 600px) {
    .note-popup {
        position: fixed;
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%);
        width: 95vw;
        max-height: 85vh;
    }
}

/* ============================================
   INBOX MODAL
   ============================================ */

.inbox-modal {
    max-width: 600px;
    width: 95%;
}

.inbox-header-count {
    background: var(--accent-orange);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.25rem 0.6rem;
    border-radius: 10px;
    margin-left: 0.5rem;
}

.inbox-section-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.inbox-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.inbox-empty-icon {
    font-size: 3rem;
    margin-bottom: 0.75rem;
    opacity: 0.5;
}

.inbox-note {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 0.75rem;
}

.inbox-note-active {
    border-left: 4px solid var(--accent-orange);
}

.inbox-note-done {
    border-left: 4px solid var(--accent-green);
    opacity: 0.7;
}

.inbox-note-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.inbox-note-deal {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--accent-blue);
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    background: rgba(74, 158, 255, 0.1);
    border-radius: 6px;
    transition: all 0.15s;
}

.inbox-note-deal:hover {
    background: rgba(74, 158, 255, 0.2);
}

.inbox-note-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.inbox-note-body {
    display: flex;
    gap: 0.75rem;
}

.inbox-note-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--gradient-1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

.inbox-note-content {
    flex: 1;
}

.inbox-note-author {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.inbox-note-message {
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text-primary);
    white-space: pre-wrap;
}

.inbox-note-replies {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
}

.inbox-reply {
    font-size: 0.8rem;
    color: var(--text-secondary);
    padding: 0.35rem 0;
}

.inbox-reply strong {
    color: var(--accent-purple);
}

.inbox-reply-more {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-style: italic;
}

.inbox-note-actions {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.inbox-reply-form {
    display: flex;
    gap: 0.5rem;
    flex: 1;
    min-width: 200px;
}

.inbox-reply-form input {
    flex: 1;
    padding: 0.4rem 0.6rem;
    font-size: 0.85rem;
    border-radius: 8px;
}

.inbox-note-completed {
    margin-top: 0.75rem;
    padding-top: 0.5rem;
    font-size: 0.75rem;
    color: var(--accent-green);
}

/* Mobile Inbox */
@media (max-width: 600px) {
    .inbox-modal {
        max-width: 100%;
        margin: 0.5rem;
    }
    
    .inbox-reply-form {
        min-width: 100%;
    }
}

/* Mobile Notes */
@media (max-width: 600px) {
    .notes-blocker-content {
        max-width: 100%;
        margin: 0.5rem;
        max-height: 95vh;
    }
    
    .notes-blocker-header {
        padding: 1rem 1.25rem;
    }
    
    .notes-blocker-body {
        padding: 1rem 1.25rem;
    }
    
    .notes-blocker-footer {
        padding: 1rem 1.25rem;
    }
    
    .btn-understood {
        width: 100%;
        padding: 1rem;
    }
}

/* ============================================
   PERFORMANCE DASHBOARD
   ============================================ */

/* Performance Button */
.btn-performance {
    background: linear-gradient(135deg, var(--accent-purple) 0%, var(--accent-blue) 100%);
    color: white;
    border: none;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-performance:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(139, 92, 246, 0.35);
}

.btn-events-tasks {
    background: linear-gradient(135deg, #10b981 0%, #f59e0b 100%);
    color: white;
    border: none;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.btn-events-tasks:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 12px rgba(16, 185, 129, 0.4);
}

.task-badge {
    background: rgba(255,255,255,0.3);
    padding: 0.15rem 0.45rem;
    border-radius: 8px;
    font-size: 0.7rem;
    font-weight: 700;
}

/* Performance Modal */
.performance-modal {
    max-width: 900px;
    width: 95%;
}

.perf-import-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 0.75rem 1rem;
    background: var(--bg-tertiary);
    border-radius: 10px;
    margin-bottom: 1.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.perf-import-info span {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

/* Summary Cards */
.perf-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.perf-summary-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
    text-align: center;
}

.perf-summary-card.positive {
    border-color: rgba(34, 197, 94, 0.4);
    background: rgba(34, 197, 94, 0.1);
}

.perf-summary-card.negative {
    border-color: rgba(239, 68, 68, 0.4);
    background: rgba(239, 68, 68, 0.1);
}

.perf-summary-value {
    font-size: 1.5rem;
    font-weight: 800;
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.perf-summary-card.positive .perf-summary-value {
    color: var(--accent-green);
}

.perf-summary-card.negative .perf-summary-value {
    color: var(--accent-red);
}

.perf-summary-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

/* Tabs */
.perf-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.75rem;
}

.perf-tab {
    padding: 0.5rem 1rem;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

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

.perf-tab.active {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
    color: white;
}

.perf-tab-content {
    display: none;
}

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

.perf-section-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

/* Performance Table */
.perf-table-wrapper {
    overflow-x: auto;
    max-height: 400px;
    overflow-y: auto;
}

.perf-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.perf-table thead th {
    position: sticky;
    top: 0;
    background: var(--bg-secondary);
    padding: 0.75rem 0.5rem;
    text-align: left;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border-color);
}

.perf-table tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: background 0.15s;
}

.perf-table tbody tr:hover {
    background: var(--bg-tertiary);
}

.perf-table tbody tr.row-positive {
    background: rgba(34, 197, 94, 0.05);
}

.perf-table tbody tr.row-negative {
    background: rgba(239, 68, 68, 0.05);
}

.perf-table td {
    padding: 0.75rem 0.5rem;
    vertical-align: middle;
}

.perf-table .rank {
    font-weight: 700;
    color: var(--text-muted);
    font-size: 0.8rem;
    width: 40px;
}

.perf-partner-name {
    font-weight: 600;
    color: var(--text-primary);
}

.perf-partner-id {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
}

.perf-table .metric {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 500;
    text-align: right;
}

.perf-table .metric.positive {
    color: var(--accent-green);
}

.perf-table .metric.negative {
    color: var(--accent-red);
}

.perf-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

/* Mobile Performance */
@media (max-width: 768px) {
    .perf-summary-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .perf-summary-value {
        font-size: 1.25rem;
    }
    
    .perf-tabs {
        gap: 0.35rem;
    }
    
    .perf-tab {
        padding: 0.4rem 0.6rem;
        font-size: 0.7rem;
    }
    
    .performance-modal {
        max-height: 95vh;
    }
}

@media (max-width: 480px) {
    .perf-summary-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }
    
    .perf-summary-card {
        padding: 0.75rem;
    }
    
    .perf-summary-value {
        font-size: 1rem;
    }
}

/* ============================================
   MONDAY REMINDER
   ============================================ */

.performance-reminder {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--bg-secondary);
    border: 2px solid var(--accent-green);
    border-radius: 16px;
    padding: 1.25rem;
    max-width: 380px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.4), 0 0 20px rgba(34, 197, 94, 0.2);
    z-index: 1000;
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    transform: translateX(120%);
    opacity: 0;
    transition: all 0.3s ease;
}

.performance-reminder.visible {
    transform: translateX(0);
    opacity: 1;
}

.perf-reminder-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

.perf-reminder-content {
    flex: 1;
}

.perf-reminder-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.35rem;
}

.perf-reminder-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.perf-reminder-last {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.perf-reminder-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.perf-reminder-close {
    position: absolute;
    top: 8px;
    right: 10px;
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.15s;
}

.perf-reminder-close:hover {
    color: var(--text-primary);
}

/* Mobile Reminder */
@media (max-width: 480px) {
    .performance-reminder {
        bottom: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    .perf-reminder-actions {
        flex-direction: column;
    }
    
    .perf-reminder-actions .btn-small {
        width: 100%;
    }
}

/* ============================================
   REMEMBER ME & AUTH OPTIONS
   ============================================ */

.auth-options-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    gap: 1rem;
}

.remember-me {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text-secondary);
    user-select: none;
}

.remember-me input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent-blue);
    cursor: pointer;
}

.remember-me span {
    transition: color 0.15s;
}

.remember-me:hover span {
    color: var(--text-primary);
}

/* ============================================
   INBOX EMPTY STATE
   ============================================ */

.btn-inbox.inbox-no-messages {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    animation: none;
}

.btn-inbox.inbox-no-messages:hover {
    background: var(--bg-card);
    border-color: var(--border-light);
    color: var(--text-primary);
}

.btn-inbox.inbox-no-messages .inbox-count {
    background: var(--bg-secondary);
    color: var(--text-muted);
}

/* ============================================
   NOTE REPLIES IN VIEW MODE
   ============================================ */

.note-replies {
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
}

.note-replies-header {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent-cyan);
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.note-reply-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border-radius: 8px;
    margin-bottom: 0.5rem;
}

.note-reply-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
}

.note-reply-header-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

.note-reply-avatar {
    width: 28px;
    height: 28px;
    background: var(--gradient-1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

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

.note-reply-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.note-reply-author {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
}

.note-reply-time {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.note-reply-message {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* ============================================
   LOAD MORE BUTTONS
   ============================================ */

.notes-load-more {
    display: flex;
    justify-content: center;
    padding: 1rem 0;
    margin-top: 0.5rem;
}

.notes-load-more button {
    padding: 0.6rem 1.5rem;
}

.load-more-replies {
    background: none;
    border: none;
    color: var(--accent-blue);
    font-size: 0.8rem;
    cursor: pointer;
    padding: 0.5rem 0;
    margin-top: 0.25rem;
    transition: color 0.15s;
}

.load-more-replies:hover {
    color: var(--accent-cyan);
    text-decoration: underline;
}

.btn-link {
    background: none;
    border: none;
    cursor: pointer;
}

/* ============================================
   INBOX REPLY STYLES (Enhanced)
   ============================================ */

.inbox-note-replies {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px dashed var(--border-color);
}

.inbox-reply {
    font-size: 0.85rem;
    color: var(--text-secondary);
    padding: 0.5rem 0.75rem;
    background: var(--bg-primary);
    border-radius: 6px;
    margin-bottom: 0.35rem;
}

.inbox-reply strong {
    color: var(--accent-cyan);
    font-weight: 600;
}

.inbox-reply-more {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-style: italic;
    padding: 0.25rem 0.75rem;
}

/* ============================================
   AFFILKA SYNC STATUS
   ============================================ */

.sync-affilka {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.75rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    cursor: default;
}

.sync-affilka-icon {
    font-size: 0.85rem;
}

.sync-affilka.sync-ok {
    border-color: var(--accent-green);
    color: var(--accent-green);
}

.sync-affilka.sync-ok .sync-affilka-icon {
    animation: none;
}

.sync-affilka.sync-pending {
    border-color: var(--accent-yellow);
    color: var(--accent-yellow);
}

.sync-affilka.sync-error {
    border-color: var(--accent-red);
    color: var(--accent-red);
}

/* ============================================
   AFFILKA STATS COLUMNS
   ============================================ */

.stat-ftd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    padding: 0.25rem 0.5rem;
    background: rgba(34, 197, 94, 0.15);
    color: var(--accent-green);
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.85rem;
    font-family: 'JetBrains Mono', monospace;
}

.stat-ngr {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: rgba(74, 158, 255, 0.15);
    color: var(--accent-blue);
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.8rem;
    font-family: 'JetBrains Mono', monospace;
}

.stat-pending {
    color: var(--text-muted);
    font-style: italic;
}

.affilka-col {
    text-align: center;
}

/* ============================================
   MOBILE CARD STATS
   ============================================ */

.mobile-card-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border-radius: 8px;
    margin: 0.75rem 0;
}

.mobile-stat {
    text-align: center;
}

.mobile-stat-value {
    display: block;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
}

.mobile-stat-label {
    display: block;
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-top: 0.15rem;
}

.crm-id-badge {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
}

/* ============================================
   LIVE PERFORMANCE BADGE
   ============================================ */

.sync-live-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.6rem;
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-red);
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    animation: livePulse 2s ease infinite;
}

@keyframes livePulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.perf-month-label {
    background: var(--accent-purple);
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
}

.perf-summary-card.highlight {
    background: linear-gradient(135deg, rgba(74, 158, 255, 0.2) 0%, rgba(168, 85, 247, 0.2) 100%);
    border-color: var(--accent-blue);
}

.perf-summary-card.highlight .perf-summary-value {
    color: var(--accent-blue);
}

/* ============================================
   RESPONSIVE - HIDE ON MOBILE
   ============================================ */

@media (max-width: 900px) {
    .hide-mobile {
        display: none !important;
    }
    
    .affilka-col {
        font-size: 0.8rem;
    }
    
    .stat-ftd, .stat-ngr {
        padding: 0.2rem 0.4rem;
        font-size: 0.75rem;
    }
}

@media (max-width: 600px) {
    .mobile-card-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .sync-affilka {
        display: none;
    }
    
    .perf-summary-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    .perf-tabs {
        flex-wrap: wrap;
    }
    
    .perf-tab {
        flex: 1 1 45%;
        font-size: 0.7rem;
        padding: 0.4rem;
    }
}

/* ============================================
   NOTE MENU (Edit/Delete)
   ============================================ */

.note-header-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.inbox-note-header-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Note Edit/Delete Inline Buttons */
.note-actions-inline {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.btn-note-action {
    background: none;
    border: none;
    font-size: 0.85rem;
    cursor: pointer;
    padding: 0.25rem 0.4rem;
    border-radius: 4px;
    transition: all 0.15s;
    opacity: 0.6;
}

.btn-note-action:hover {
    background: var(--bg-tertiary);
    opacity: 1;
}

.btn-note-delete:hover {
    background: rgba(239, 68, 68, 0.15);
}

.note-menu {
    position: relative;
}

.note-menu-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: all 0.15s;
    line-height: 1;
}

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

.note-menu-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
    min-width: 120px;
    z-index: 100;
    display: none;
    overflow: hidden;
}

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

.note-menu-dropdown button {
    display: block;
    width: 100%;
    padding: 0.6rem 1rem;
    background: none;
    border: none;
    text-align: left;
    color: var(--text-primary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.15s;
}

.note-menu-dropdown button:hover {
    background: var(--bg-tertiary);
}

.note-menu-dropdown button.danger {
    color: var(--accent-red);
}

.note-menu-dropdown button.danger:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* ============================================
   REPLY FORM IN VIEW MODE
   ============================================ */

.note-reply-form-container {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px dashed var(--border-color);
}

.note-reply-input-wrapper {
    display: flex;
    gap: 0.5rem;
}

.note-reply-input-wrapper input {
    flex: 1;
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
}

.note-reply-input-wrapper input:focus {
    outline: none;
    border-color: var(--accent-blue);
}

.note-reply-input-wrapper button {
    white-space: nowrap;
}

/* ============================================
   @MENTION SYSTEM
   ============================================ */

.mention {
    color: var(--accent-cyan);
    font-weight: 600;
    background: rgba(6, 182, 212, 0.15);
    padding: 0.1rem 0.3rem;
    border-radius: 4px;
}

.mention-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
    max-height: 200px;
    overflow-y: auto;
    z-index: 100;
    display: none;
    margin-top: 4px;
}

.mention-suggestion {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0.75rem;
    cursor: pointer;
    transition: background 0.15s;
}

.mention-suggestion:hover {
    background: var(--bg-tertiary);
}

.mention-suggestion-name {
    font-weight: 600;
    color: var(--accent-cyan);
}

.mention-suggestion-type {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Mention badge in inbox */
.mention-badge {
    display: inline-block;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    margin-right: 0.4rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* Inbox note when you were mentioned */
.inbox-note-mentioned {
    border-left: 3px solid var(--accent-cyan);
    background: rgba(6, 182, 212, 0.05);
}

.inbox-note-mentioned .inbox-note-header {
    background: rgba(6, 182, 212, 0.1);
}

/* Inbox avatar with image */
.inbox-note-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.inbox-note-avatar.clickable,
.inbox-note-author.clickable {
    cursor: pointer;
}

.inbox-note-author.clickable:hover {
    color: var(--accent-cyan);
    text-decoration: underline;
}

/* Emoji Picker */
.emoji-picker {
    position: absolute;
    bottom: 100%;
    left: 0.5rem;
    width: 320px;
    max-height: 250px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 -10px 30px rgba(0,0,0,0.3);
    overflow: hidden;
    z-index: 100;
}

.emoji-picker-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 2px;
    padding: 0.5rem;
    max-height: 240px;
    overflow-y: auto;
}

.emoji-item {
    font-size: 1.3rem;
    padding: 0.35rem;
    cursor: pointer;
    border-radius: 6px;
    text-align: center;
    transition: all 0.15s ease;
}

.emoji-item:hover {
    background: var(--bg-tertiary);
    transform: scale(1.2);
}

/* Image Preview Overlay */
.image-preview-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    cursor: zoom-out;
}

.image-preview-container {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
}

.image-preview-container img {
    max-width: 100%;
    max-height: 90vh;
    border-radius: 8px;
    box-shadow: 0 10px 50px rgba(0,0,0,0.5);
}

.image-preview-close {
    position: absolute;
    top: -40px;
    right: 0;
    width: 36px;
    height: 36px;
    background: rgba(255,255,255,0.1);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.image-preview-close:hover {
    background: rgba(255,255,255,0.2);
    transform: scale(1.1);
}

/* Note actions update */
.note-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

/* ============================================
   SYNC BUTTON & WRAPPER
   ============================================ */

.sync-affilka-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-sync {
    background: linear-gradient(135deg, var(--accent-cyan) 0%, var(--accent-blue) 100%);
    color: white;
    border: none;
    padding: 0.4rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-sync:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(6, 182, 212, 0.4);
}

.btn-sync:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.sync-note {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.75rem;
    background: var(--bg-secondary);
    border-radius: 6px;
    font-size: 0.75rem;
    color: var(--text-muted);
    cursor: help;
}

/* ============================================
   EXPORT DROPDOWN
   ============================================ */

.export-dropdown-wrapper {
    position: relative;
}

.dropdown-arrow {
    font-size: 0.6rem;
    margin-left: 0.25rem;
    transition: transform 0.2s;
}

.export-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.4);
    min-width: 160px;
    z-index: 100;
    display: none;
    overflow: hidden;
}

.export-dropdown.active {
    display: block;
    animation: fadeIn 0.15s ease;
}

.export-dropdown button {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    background: none;
    border: none;
    text-align: left;
    color: var(--text-primary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.15s;
}

.export-dropdown button:hover {
    background: var(--bg-tertiary);
}

/* ============================================
   SOURCE BADGE WITH TEXT
   ============================================ */

.source-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.15rem;
    padding: 0.2rem 0.45rem;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 600;
    background: rgba(249, 115, 22, 0.15);
    color: var(--accent-orange);
    white-space: nowrap;
    vertical-align: middle;
}

.source-badge.network {
    background: rgba(6, 182, 212, 0.15);
    color: var(--accent-cyan);
}

/* ============================================
   MORE STATS COLUMNS
   ============================================ */

.stat-visits {
    display: inline-block;
    padding: 0.2rem 0.4rem;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-family: 'JetBrains Mono', monospace;
}

.stat-regs {
    display: inline-block;
    padding: 0.2rem 0.4rem;
    color: var(--accent-purple);
    font-size: 0.8rem;
    font-family: 'JetBrains Mono', monospace;
}

.stat-conversion {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
}

.stat-conversion.good {
    background: rgba(34, 197, 94, 0.2);
    color: var(--accent-green);
}

.stat-conversion.ok {
    background: rgba(234, 179, 8, 0.2);
    color: var(--accent-yellow);
}

.stat-conversion.low {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-red);
}

.stat-ngr.positive {
    color: var(--accent-green);
}

.stat-ngr.negative {
    color: var(--accent-red);
}

.hide-tablet {
    display: table-cell;
}

@media (max-width: 1100px) {
    .hide-tablet {
        display: none !important;
    }
}

/* ============================================
   ALL PARTNERS STATS BY PERIOD SECTION
   ============================================ */

.all-partners-stats-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}

.all-stats-header {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.all-stats-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.all-stats-title h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stats-badge {
    font-size: 1.25rem;
}

.all-stats-period-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.all-stats-period-selector .period-btn {
    padding: 0.4rem 0.75rem;
    font-size: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.all-stats-period-selector .period-btn:hover {
    border-color: var(--accent-cyan);
    color: var(--text-primary);
}

.all-stats-period-selector .period-btn.active {
    background: var(--accent-cyan);
    border-color: var(--accent-cyan);
    color: #000;
    font-weight: 600;
}

.all-stats-custom-dates {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.all-stats-custom-dates input[type="date"] {
    padding: 0.35rem 0.5rem;
    font-size: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    cursor: pointer;
}

.all-stats-custom-dates input[type="date"]:focus {
    outline: none;
    border-color: var(--accent-cyan);
}

.all-stats-loading,
.all-stats-error,
.all-stats-empty {
    padding: 2rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.all-stats-error {
    color: var(--accent-red);
}

.all-stats-period-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.all-stats-period-info .period-label {
    font-weight: 600;
    color: var(--text-primary);
}

.all-stats-period-info .partner-count {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.all-stats-totals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.75rem;
}

.all-stat-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0.75rem;
    text-align: center;
}

.all-stat-card.highlight {
    border-color: var(--accent-pink);
    background: rgba(236, 72, 153, 0.1);
}

.all-stat-card.highlight-green {
    border-color: var(--accent-green);
    background: rgba(16, 185, 129, 0.1);
}

.all-stat-card.highlight-blue {
    border-color: var(--accent-blue);
    background: rgba(59, 130, 246, 0.1);
}

.all-stat-card.highlight-gold {
    border-color: var(--accent-gold);
    background: rgba(245, 158, 11, 0.1);
}

.all-stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.all-stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-top: 0.25rem;
}

.all-stats-table-container {
    margin-top: 1.25rem;
}

.all-stats-table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 0.75rem;
}

.all-stats-table-header span:first-child {
    font-weight: 600;
    color: var(--text-primary);
}

.expand-all-btn {
    font-size: 0.75rem;
    color: var(--accent-cyan);
    cursor: pointer;
}

.all-stats-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.all-stats-table thead th {
    padding: 0.6rem 0.5rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.all-stats-table tbody tr {
    cursor: pointer;
    transition: background 0.15s ease;
}

.all-stats-table tbody tr:hover {
    background: var(--bg-tertiary);
}

.all-stats-table tbody tr.top-partner {
    background: rgba(16, 185, 129, 0.05);
}

.all-stats-table tbody tr.top-partner:hover {
    background: rgba(16, 185, 129, 0.1);
}

.all-stats-table tbody td {
    padding: 0.6rem 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
}

.partner-name-cell {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.partner-name-cell .rank {
    font-size: 0.65rem;
    color: var(--text-muted);
    min-width: 24px;
}

.partner-name-cell .name {
    color: var(--text-primary);
    font-weight: 500;
}

.highlight-cell {
    color: var(--accent-pink) !important;
    font-weight: 600;
}

.highlight-cell-green {
    color: var(--accent-green) !important;
    font-weight: 600;
}

.highlight-cell-blue {
    color: var(--accent-blue) !important;
}

.highlight-cell-gold {
    color: var(--accent-gold) !important;
    font-weight: 600;
}

@media (max-width: 768px) {
    .all-stats-period-selector {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 0.5rem;
    }
    
    .all-stats-totals-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .all-stats-table {
        font-size: 0.7rem;
    }
    
    .all-stats-table thead th,
    .all-stats-table tbody td {
        padding: 0.4rem 0.3rem;
    }
}

/* ============================================
   LIVE PERFORMANCE SECTION (HOMEPAGE)
   ============================================ */

.live-performance-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}

.live-perf-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.live-perf-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.live-perf-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.live-perf-period-buttons {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.live-perf-custom-dates {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.live-perf-custom-dates input[type="date"] {
    padding: 0.35rem 0.5rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.8rem;
}

.live-perf-custom-dates span {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.live-perf-controls select {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    color: var(--text-primary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.live-perf-controls select:hover {
    border-color: var(--accent-cyan);
}

.live-perf-controls select:focus {
    outline: none;
    border-color: var(--accent-cyan);
    box-shadow: 0 0 0 2px rgba(6, 182, 212, 0.2);
}

.live-perf-title h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.live-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.5rem;
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-red);
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    animation: livePulse 2s ease infinite;
}

.live-perf-period {
    font-size: 0.8rem;
    color: var(--text-muted);
    background: var(--bg-tertiary);
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
}

.live-perf-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.live-perf-stat {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1rem;
    text-align: center;
}

.live-perf-stat.highlight {
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.3);
}

.live-perf-stat.profit {
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.3);
}

.live-perf-stat.loss {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
}

.live-perf-stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
}

.live-perf-stat.highlight .live-perf-stat-value {
    color: var(--accent-green);
}

.live-perf-stat.profit .live-perf-stat-value {
    color: var(--accent-green);
}

.live-perf-stat.loss .live-perf-stat-value {
    color: var(--accent-red);
}

.live-perf-stat-label {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 0.25rem;
}

.live-perf-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.live-perf-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
}

.live-perf-card-header {
    padding: 0.75rem 1rem;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-primary);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
}

.live-perf-card-body {
    padding: 0.5rem;
    max-height: 280px;
    overflow-y: auto;
}

.live-perf-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s;
}

.live-perf-row:hover {
    background: var(--bg-secondary);
}

.live-perf-rank {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    min-width: 20px;
}

.live-perf-name {
    flex: 1;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.live-perf-value {
    font-size: 0.85rem;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    white-space: nowrap;
}

.live-perf-value.ftd {
    color: var(--accent-green);
    background: rgba(34, 197, 94, 0.15);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

.live-perf-value.ngr.positive {
    color: var(--accent-green);
}

.live-perf-value.ngr.negative {
    color: var(--accent-red);
}

.live-perf-no-data {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.live-perf-loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ============================================
   DAILY PERFORMANCE CHARTS
   ============================================ */

.daily-charts-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}

.daily-charts-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
}

.daily-charts-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.daily-charts-title h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.daily-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.5rem;
    background: rgba(74, 158, 255, 0.15);
    color: var(--accent-blue);
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.05em;
}

.daily-charts-controls select {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.4rem 0.75rem;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: border-color 0.2s;
}

.daily-charts-controls select:hover {
    border-color: var(--accent-blue);
}

.daily-charts-controls select:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 2px rgba(74, 158, 255, 0.2);
}

.daily-charts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 1rem;
}

.daily-charts-grid:last-child {
    margin-bottom: 0;
}

.daily-chart-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
    min-height: 220px;
    position: relative;
}

.daily-chart-card.full-width {
    grid-column: 1 / -1;
}

.daily-chart-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.daily-chart-card canvas {
    width: 100% !important;
    max-height: 180px;
}

.daily-chart-card.full-width canvas {
    max-height: 200px;
}

.chart-no-data {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 150px;
    color: var(--text-muted);
    font-size: 0.85rem;
    text-align: center;
    padding: 1rem;
}

/* Responsive adjustments for daily charts */
@media (max-width: 900px) {
    .daily-charts-grid {
        grid-template-columns: 1fr;
    }
    
    .daily-chart-card.full-width {
        grid-column: 1;
    }
}

@media (max-width: 600px) {
    .daily-charts-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    .daily-charts-controls select {
        width: 100%;
    }
}

/* ============================================
   CUSTOM PERFORMER TOOLTIP
   ============================================ */

#performer-tooltip {
    transition: opacity 0.15s ease;
}

.perf-tooltip {
    background: linear-gradient(145deg, rgba(18, 18, 26, 0.98) 0%, rgba(10, 10, 15, 0.98) 100%);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.08),
        0 0 30px rgba(74, 158, 255, 0.1);
    min-width: 220px;
    backdrop-filter: blur(20px);
}

.perf-tooltip-header {
    padding: 14px 18px;
    background: linear-gradient(90deg, rgba(74, 158, 255, 0.15) 0%, transparent 100%);
    border-left: 4px solid var(--accent-blue);
    display: flex;
    align-items: center;
    gap: 10px;
}

.perf-tooltip-rank {
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    color: white;
    font-size: 11px;
    font-weight: 800;
    padding: 4px 8px;
    border-radius: 6px;
    letter-spacing: 0.5px;
}

.perf-tooltip-name {
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.perf-tooltip-body {
    padding: 14px 18px 18px;
}

.perf-tooltip-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.perf-tooltip-row.main {
    margin-bottom: 8px;
}

.perf-tooltip-label {
    color: #888;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.perf-tooltip-value {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
}

.perf-tooltip-value.deposits {
    font-size: 20px;
    background: linear-gradient(90deg, #22c55e, #4ade80);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.perf-tooltip-bar {
    height: 6px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 14px;
}

.perf-tooltip-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s ease;
}

.perf-tooltip-stats {
    display: flex;
    gap: 20px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.perf-tooltip-stat {
    flex: 1;
    text-align: center;
}

.perf-tooltip-stat .stat-value {
    display: block;
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    font-family: 'JetBrains Mono', monospace;
    margin-bottom: 4px;
}

.perf-tooltip-stat .stat-label {
    display: block;
    font-size: 10px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

/* ============================================
   AFFILKA STATS IN VIEW MODE
   ============================================ */

.affilka-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
}

.affilka-stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0.75rem;
    text-align: center;
}

.affilka-stat-card.highlight-ftd {
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.3);
}

.affilka-stat-card.highlight-good {
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.3);
}

.affilka-stat-card.highlight-low {
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.2);
}

.affilka-stat-card.highlight-profit {
    background: rgba(34, 197, 94, 0.15);
    border-color: rgba(34, 197, 94, 0.4);
}

.affilka-stat-card.highlight-commission {
    background: rgba(234, 179, 8, 0.15);
    border-color: rgba(234, 179, 8, 0.4);
}

.affilka-stat-card.highlight-commission .affilka-stat-value {
    color: #eab308;
}

/* C2D - Click to Deposit (Most Important!) */
.affilka-stat-card.highlight-c2d {
    background: rgba(168, 85, 247, 0.15);
    border-color: rgba(168, 85, 247, 0.5);
    box-shadow: 0 0 15px rgba(168, 85, 247, 0.2);
}

.affilka-stat-card.highlight-c2d .affilka-stat-value {
    color: #a855f7;
    font-size: 1.4rem;
    font-weight: 700;
}

.affilka-stat-card.highlight-c2d .affilka-stat-label {
    font-weight: 600;
    color: #a855f7;
}

/* Partner Daily Charts in View Modal */
.partner-daily-charts {
    margin-top: 1.5rem;
    padding: 1.25rem;
    background: var(--bg-tertiary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.daily-charts-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.daily-charts-header h4 {
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0;
}

.btn-load-charts {
    background: linear-gradient(135deg, var(--accent-blue) 0%, var(--accent-purple) 100%);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-load-charts:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.btn-load-charts:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.daily-charts-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.daily-chart-box {
    background: var(--bg-secondary);
    padding: 1rem;
    border-radius: 10px;
    border: 1px solid var(--border-color);
}

.daily-chart-title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.daily-chart-box canvas {
    max-height: 120px;
}

.affilka-stat-card.highlight-deposit {
    background: rgba(74, 158, 255, 0.1);
    border-color: rgba(74, 158, 255, 0.3);
}

.affilka-stat-card.highlight-deposit .affilka-stat-value {
    color: var(--accent-blue);
}

.affilka-stat-card.highlight-loss {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.4);
}

.affilka-stat-value {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
}

.affilka-stat-card.highlight-ftd .affilka-stat-value,
.affilka-stat-card.highlight-good .affilka-stat-value,
.affilka-stat-card.highlight-profit .affilka-stat-value {
    color: var(--accent-green);
}

.affilka-stat-card.highlight-low .affilka-stat-value,
.affilka-stat-card.highlight-loss .affilka-stat-value {
    color: var(--accent-red);
}

.affilka-stat-label {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-top: 0.25rem;
}

.affilka-stats-footer {
    display: flex;
    justify-content: space-between;
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.affilka-stats-footer strong {
    color: var(--accent-cyan);
}

/* Time Period Selector */
.stats-period-selector {
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.stats-period-selector .period-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-right: 0.75rem;
}

.period-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.5rem;
}

.period-btn {
    padding: 0.35rem 0.65rem;
    font-size: 0.75rem;
    font-weight: 500;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
}

.period-btn:hover {
    background: var(--accent-blue);
    color: white;
    border-color: var(--accent-blue);
}

.period-btn.active {
    background: var(--accent-blue);
    color: white;
    border-color: var(--accent-blue);
}

.custom-date-picker {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    padding: 0.5rem;
    background: var(--bg-primary);
    border-radius: 6px;
    border: 1px dashed var(--border-color);
}

.custom-date-picker::before {
    content: '📅 Custom:';
    font-weight: 500;
    color: var(--text-muted);
}

.custom-date-picker input[type="date"] {
    padding: 0.4rem 0.6rem;
    font-size: 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    cursor: pointer;
}

.custom-date-picker input[type="date"]:hover {
    border-color: var(--accent-blue);
}

.custom-date-picker input[type="date"]:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.stats-period-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.stats-period-label strong {
    color: var(--accent-cyan);
}

.stats-period-label .date-range {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.stats-loading {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    justify-content: center;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.stats-loading .loading-spinner.small {
    width: 18px;
    height: 18px;
}

.no-stats-message {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Partner Account Balance Card */
.partner-balance-card {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(59, 130, 246, 0.1));
    border: 1px solid var(--accent-green);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
}

.partner-balance-card .balance-header {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent-green);
    margin-bottom: 0.5rem;
}

.partner-balance-card .balance-amounts {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.partner-balance-card .balance-item {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.partner-balance-card .balance-item.has-balance {
    color: var(--accent-green);
    font-weight: 600;
}

.partner-balance-card .balance-item strong {
    margin-right: 0.25rem;
}

/* Commission Breakdown Card */
.commission-breakdown-card {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(59, 130, 246, 0.1));
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
}

.commission-breakdown-card .commission-header {
    font-size: 0.8rem;
    font-weight: 600;
    color: #8b5cf6;
    margin-bottom: 0.5rem;
}

.commission-plans {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.commission-plan-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.85rem;
    padding: 0.5rem;
    background: var(--bg-primary);
    border-radius: 6px;
    flex-wrap: wrap;
}

.commission-plan-item .commission-title {
    color: var(--text-primary);
    font-weight: 500;
    flex: 1;
    min-width: 150px;
}

.commission-plan-item .commission-strategy {
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    background: rgba(139, 92, 246, 0.15);
    color: #8b5cf6;
}

.commission-plan-item .commission-strategy.rev_share {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-green);
}

.commission-plan-item .commission-strategy.cpa {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent-blue);
}

.commission-plan-item .commission-strategy.hybrid {
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent-orange);
}

.commission-plan-item .commission-date {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* Sportsbook Stats Card */
.affilka-stat-card.sportsbook {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(236, 72, 153, 0.1));
    border: 1px solid rgba(139, 92, 246, 0.3);
}

.affilka-stat-card.sportsbook .affilka-stat-label {
    color: #8b5cf6;
}

/* ============================================
   MOBILE RESPONSIVE - LIVE PERFORMANCE
   ============================================ */

@media (max-width: 900px) {
    .live-perf-summary {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .live-perf-grid {
        grid-template-columns: 1fr;
    }
    
    .affilka-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .sync-affilka-wrapper {
        order: -1;
    }
}

@media (max-width: 600px) {
    .live-performance-section {
        padding: 1rem;
    }
    
    .live-perf-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .live-perf-stat {
        padding: 0.75rem 0.5rem;
    }
    
    .live-perf-stat-value {
        font-size: 1.25rem;
    }
    
    .affilka-stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }
    
    .affilka-stat-card {
        padding: 0.5rem;
    }
    
    .affilka-stat-value {
        font-size: 1rem;
    }
    
    .affilka-stats-footer {
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .btn-sync {
        padding: 0.35rem 0.6rem;
        font-size: 0.7rem;
    }
    
    .export-dropdown-wrapper {
        display: none;
    }
}

/* ============================================
   ONLINE USERS POPUP
   ============================================ */

.online-users {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.75rem;
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.25);
    border-radius: 20px;
    transition: all 0.2s ease;
    position: relative;
    font-size: 0.8rem;
    color: var(--accent-green);
    font-weight: 500;
}

.online-users:hover {
    background: rgba(34, 197, 94, 0.2);
    transform: scale(1.02);
}

.online-users.offline {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.25);
    color: var(--accent-red);
}

.online-users.offline .online-pulse {
    background: var(--accent-red);
    animation: none;
}

.online-pulse {
    width: 8px;
    height: 8px;
    background: var(--accent-green);
    border-radius: 50%;
    animation: pulse-online 2s ease-in-out infinite;
}

@keyframes pulse-online {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.3); }
}

.online-users-popup {
    position: fixed;
    z-index: 1000;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    min-width: 260px;
    max-width: 320px;
    overflow: hidden;
    animation: slideDown 0.2s ease;
}

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

.online-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
}

.online-popup-title {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.online-popup-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.online-popup-close:hover {
    color: var(--text-primary);
}

.online-popup-body {
    padding: 0.5rem;
    max-height: 300px;
    overflow-y: auto;
}

.online-user-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    border-radius: 8px;
    transition: background 0.15s ease;
}

.online-user-item:hover {
    background: var(--bg-tertiary);
}

.online-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    color: white;
}

.online-user-info {
    flex: 1;
}

.online-user-name {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.online-user-role {
    font-size: 0.6rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    display: inline-block;
    width: fit-content;
}

.online-user-role.role-admin {
    color: #fff;
    background: linear-gradient(135deg, var(--accent-red), #dc2626);
}

.online-user-role.role-ceo {
    color: #000;
    background: linear-gradient(135deg, #fbbf24, #eab308);
}

.online-user-role.role-project-manager {
    color: #fff;
    background: linear-gradient(135deg, #2dd4bf, #14b8a6);
}

.online-user-role.role-manager {
    color: #fff;
    background: linear-gradient(135deg, var(--accent-blue), #2563eb);
}

.online-user-role.role-retention {
    color: #fff;
    background: linear-gradient(135deg, var(--accent-orange), #ea580c);
}

.online-user-role.role-designer {
    color: #fff;
    background: linear-gradient(135deg, var(--accent-purple), #9333ea);
}

.online-user-role.role-viewer,
.online-user-role.role-member {
    color: var(--text-secondary);
    background: var(--bg-tertiary);
}

.online-user-status {
    font-size: 0.7rem;
    color: var(--accent-green);
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.online-users-empty {
    padding: 1.5rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ============================================
   USER INFO CLICKABLE / PROFILE
   ============================================ */

.user-info {
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0.35rem 0.5rem;
    border-radius: 8px;
}

.user-info:hover {
    background: var(--bg-tertiary);
}


/* Profile Modal */
.profile-avatar-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.profile-avatar-large {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 700;
    color: white;
    overflow: hidden;
}

.profile-avatar-large img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.btn-upload-avatar {
    padding: 0.4rem 0.8rem;
    font-size: 0.75rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-upload-avatar:hover {
    background: var(--bg-card);
    color: var(--text-primary);
    border-color: var(--accent-blue);
    box-shadow: 0 4px 20px rgba(74, 158, 255, 0.3);
}



.profile-role-badge {
    display: inline-block;
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.profile-role-badge.role-admin {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-red);
}

.profile-role-badge.role-ceo {
    background: rgba(234, 179, 8, 0.15);
    color: #eab308;
}

.profile-role-badge.role-project-manager {
    background: rgba(20, 184, 166, 0.15);
    color: #14b8a6;
}

.profile-role-badge.role-manager {
    background: rgba(74, 158, 255, 0.15);
    color: var(--accent-blue);
}

.profile-role-badge.role-retention {
    background: rgba(249, 115, 22, 0.15);
    color: var(--accent-orange);
}

.profile-role-badge.role-designer {
    background: rgba(168, 85, 247, 0.15);
    color: var(--accent-purple);
}

.profile-role-badge.role-viewer {
    background: rgba(100, 116, 139, 0.15);
    color: var(--text-muted);
}

.profile-divider {
    height: 1px;
    background: var(--border-color);
    margin: 1.5rem 0;
}

.profile-section-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

/* ============================================
   DEPOSITS & COMMISSION STATS
   ============================================ */

.stat-deposits {
    color: var(--accent-green);
    font-weight: 700;
}

.stat-commission {
    color: var(--accent-orange);
    font-weight: 700;
}

.live-perf-stat.highlight-deposit {
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.3);
}

.live-perf-stat.highlight-deposit .live-perf-stat-value {
    color: var(--accent-green);
}

.live-perf-stat.highlight-commission {
    background: rgba(249, 115, 22, 0.1);
    border-color: rgba(249, 115, 22, 0.3);
}

.live-perf-stat.highlight-commission .live-perf-stat-value {
    color: var(--accent-orange);
}

.live-perf-value.deposits {
    color: var(--accent-green);
}

/* ============================================
   LIVE PERFORMANCE SUMMARY GRID FIX
   ============================================ */

.live-perf-summary {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 1200px) {
    .live-perf-summary {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 600px) {
    .live-perf-summary {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Performance Dashboard Deposit/Commission Highlights */
.perf-summary-card.highlight-deposit {
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.3);
}

.perf-summary-card.highlight-deposit .perf-summary-value {
    color: var(--accent-green);
}

.perf-summary-card.highlight-commission {
    background: rgba(249, 115, 22, 0.1);
    border-color: rgba(249, 115, 22, 0.3);
}

.perf-summary-card.highlight-commission .perf-summary-value {
    color: var(--accent-orange);
}

.perf-table .metric.highlight-deposit {
    color: var(--accent-green);
    font-weight: 700;
}

.perf-table .metric.highlight-commission {
    color: var(--accent-orange);
    font-weight: 700;
}

.perf-table .metric.went-live {
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* Mobile card stat highlights */
.mobile-stat.highlight-deposit .mobile-stat-value {
    color: var(--accent-green);
}

.mobile-stat.highlight-commission .mobile-stat-value {
    color: var(--accent-orange);
}

/* ============================================
   DESIGNER TASKS
   ============================================ */

.tasks-modal {
    max-width: 800px;
    height: 80vh;
}

.tasks-summary {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
}

.tasks-stat {
    flex: 1;
    text-align: center;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border-radius: 8px;
}

.tasks-stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-orange);
}

.tasks-stat.completed .tasks-stat-value {
    color: var(--accent-green);
}

.tasks-stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.tasks-toolbar {
    display: flex;
    gap: 0.75rem;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.tasks-body {
    max-height: calc(80vh - 200px);
    overflow-y: auto;
    padding: 1rem;
}

.tasks-empty {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
}

.tasks-section {
    margin-bottom: 1.5rem;
}

.tasks-section-title {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
    color: var(--text-secondary);
}

.tasks-section-completed {
    opacity: 0.6;
}

.task-card {
    background: var(--bg-tertiary);
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    border-left: 4px solid var(--border-color);
}

.task-card.pending {
    border-left-color: var(--accent-orange);
}

.task-card.in_progress {
    border-left-color: var(--accent-blue);
    background: rgba(59, 130, 246, 0.05);
}

.task-card.completed {
    border-left-color: var(--accent-green);
    opacity: 0.7;
}

.task-card.cancelled {
    border-left-color: var(--text-muted);
    opacity: 0.5;
}

.task-card.expired {
    border-left-color: var(--accent-orange);
    opacity: 0.6;
    background: rgba(249, 115, 22, 0.05);
}

.tasks-section-expired {
    opacity: 0.7;
}

.task-card.priority-high {
    background: linear-gradient(90deg, rgba(239, 68, 68, 0.1) 0%, transparent 100%);
}

.task-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.task-priority {
    font-size: 1rem;
}

.task-due {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.task-due.overdue {
    color: var(--accent-red);
    font-weight: 600;
}

.task-title {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.task-description {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.task-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.task-league {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.task-league-logo {
    width: 16px;
    height: 16px;
    object-fit: contain;
}

.task-card-footer {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
}

.task-completed-badge {
    font-size: 0.8rem;
    color: var(--accent-green);
}

.task-expired-badge {
    font-size: 0.8rem;
    color: var(--accent-orange);
}

.btn-small {
    padding: 0.35rem 0.75rem;
    font-size: 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.btn-small.btn-primary {
    background: var(--accent-blue);
    color: white;
}

.btn-small.btn-success {
    background: var(--accent-green);
    color: white;
}

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

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

.btn-small:hover {
    opacity: 0.8;
    transform: scale(1.02);
}

.btn-danger-outline {
    background: transparent;
    color: var(--accent-red);
    border: 1px solid var(--accent-red);
    padding: 0.5rem 0.85rem;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-danger-outline:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* Task badge in header */
.task-badge {
    background: var(--accent-orange);
    color: white;
    font-size: 0.65rem;
    padding: 0.15rem 0.4rem;
    border-radius: 10px;
    margin-left: 0.25rem;
}

/* Profile role badge in popup */
.profile-role-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
}

.profile-role-badge.role-admin {
    background: rgba(239, 68, 68, 0.2);
    color: var(--accent-red);
}

.profile-role-badge.role-ceo {
    background: rgba(234, 179, 8, 0.2);
    color: #eab308;
}

.profile-role-badge.role-project-manager {
    background: rgba(20, 184, 166, 0.2);
    color: #14b8a6;
}

.profile-role-badge.role-manager {
    background: rgba(59, 130, 246, 0.2);
    color: var(--accent-blue);
}

.profile-role-badge.role-retention {
    background: rgba(139, 92, 246, 0.2);
    color: var(--accent-purple);
}

.profile-role-badge.role-viewer {
    background: rgba(107, 114, 128, 0.2);
    color: var(--text-muted);
}

/* ============================================
   ARCHIVE TAB STYLES
   ============================================ */

.archive-summary {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-tertiary);
    border-radius: 12px;
    margin-bottom: 1rem;
}

.archive-stat {
    flex: 1;
    text-align: center;
    padding: 0.75rem;
    border-radius: 8px;
}

.archive-stat.completed {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.archive-stat.expired {
    background: rgba(249, 115, 22, 0.1);
    border: 1px solid rgba(249, 115, 22, 0.2);
}

.archive-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
}

.archive-stat.completed .archive-stat-value {
    color: var(--accent-green);
}

.archive-stat.expired .archive-stat-value {
    color: var(--accent-orange);
}

.archive-stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.archive-body {
    max-height: 400px;
    overflow-y: auto;
}

.archive-section {
    margin-bottom: 1.5rem;
}

.archive-section-title {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
    color: var(--text-secondary);
}

.archive-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--bg-tertiary);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
}

.archive-card.completed {
    border-left: 3px solid var(--accent-green);
}

.archive-card.expired {
    border-left: 3px solid var(--accent-orange);
    opacity: 0.7;
}

.archive-card-icon {
    font-size: 1.25rem;
}

.archive-card-content {
    flex: 1;
}

.archive-card-title {
    font-weight: 500;
    font-size: 0.9rem;
}

.archive-card-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.archive-card-date {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.archive-empty {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
}

/* Task limit warning */
.tasks-limit-warning {
    background: rgba(249, 115, 22, 0.1);
    border: 1px solid rgba(249, 115, 22, 0.3);
    color: var(--accent-orange);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.85rem;
    text-align: center;
}

/* Task status badges */
.task-status-badge {
    font-size: 0.65rem;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-weight: 600;
    text-transform: uppercase;
}

.task-status-badge.progress {
    background: rgba(59, 130, 246, 0.2);
    color: var(--accent-blue);
}

.task-urgent-badge {
    font-size: 0.65rem;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-weight: 600;
    background: rgba(239, 68, 68, 0.2);
    color: var(--accent-red);
    animation: pulse 2s infinite;
}

.task-card.urgent {
    border-left-color: var(--accent-red);
    background: rgba(239, 68, 68, 0.05);
}

.task-card.soon {
    border-left-color: var(--accent-yellow);
}

.task-assigned {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin: 0.5rem 0;
    padding: 0.5rem;
    background: var(--bg-secondary);
    border-radius: 6px;
}

.task-exists-badge {
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    background: rgba(16, 185, 129, 0.2);
    color: var(--accent-green);
}

/* Tasks stat variants */
.tasks-stat.pending .tasks-stat-value {
    color: var(--accent-orange);
}

.tasks-stat.progress .tasks-stat-value {
    color: var(--accent-blue);
}

/* Task preview in assign modal */
.task-preview {
    background: var(--bg-tertiary);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    border-left: 3px solid var(--accent-primary);
}

/* ============================================
   INVOICE MANAGEMENT SYSTEM
   ============================================ */

.invoices-page {
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.invoices-page-header {
    margin-bottom: 1.5rem;
}

.invoices-page-header h2 {
    color: var(--text-primary);
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
}

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

/* Invoice Action Bar - Prominent placement */
.invoices-action-bar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    position: relative;
    z-index: 5;
}

.invoices-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: var(--text-secondary);
}

/* Invoice Header & Stats */
.invoices-header {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.invoices-stats {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.invoice-stat-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    min-width: 140px;
}

.invoice-stat-icon {
    font-size: 1.5rem;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: var(--bg-tertiary);
}

.invoice-stat-icon.pending {
    background: rgba(59, 130, 246, 0.15);
}

.invoice-stat-icon.urgent {
    background: rgba(239, 68, 68, 0.15);
}

.invoice-stat-icon.amount {
    background: rgba(251, 191, 36, 0.15);
}

.invoice-stat-icon.paid {
    background: rgba(34, 197, 94, 0.15);
}

.invoice-stat-info {
    display: flex;
    flex-direction: column;
}

.invoice-stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.invoice-stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Upload Button */
.btn-upload-invoice {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
    border: none;
    border-radius: 12px;
    padding: 1rem 1.75rem;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.35);
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
    z-index: 10;
}

.btn-upload-invoice::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
    transition: left 0.5s ease;
}

.btn-upload-invoice:hover::before {
    left: 100%;
}

.btn-upload-invoice:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.45);
}

/* Invoice Filters */
.invoices-filters {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

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

.invoice-tab {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.6rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.invoice-tab:hover {
    border-color: var(--accent-primary);
    color: var(--text-primary);
}

.invoice-tab.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

.tab-count {
    background: rgba(255,255,255,0.2);
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    font-size: 0.8rem;
}

.invoice-tab.active .tab-count {
    background: rgba(255,255,255,0.3);
}

.invoice-search input {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.6rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    width: 250px;
    transition: all 0.2s ease;
}

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

/* Invoice List */
.invoices-list {
    display: grid;
    gap: 1rem;
}

.invoices-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    text-align: center;
}

.invoices-empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.invoices-empty h3 {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.invoices-empty p {
    color: var(--text-muted);
}

/* Invoice Card */
.invoice-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.invoice-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--accent-primary);
}

.invoice-card.urgency-urgent::before {
    background: #f59e0b;
}

.invoice-card.urgency-critical::before {
    background: #ef4444;
    animation: pulse-red 2s infinite;
}

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

.invoice-card.paid {
    opacity: 0.8;
}

.invoice-card.paid::before {
    background: var(--accent-green);
}

.invoice-card.overdue {
    border-color: rgba(239, 68, 68, 0.5);
}

.invoice-card:hover {
    transform: translateX(4px);
    border-color: var(--accent-primary);
}

.invoice-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.invoice-badges {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.urgency-badge, .payment-type-badge, .status-badge {
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
}

.urgency-badge.normal {
    background: rgba(107, 114, 128, 0.2);
    color: var(--text-secondary);
}

.urgency-badge.urgent {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
}

.urgency-badge.critical {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    animation: blink 1s infinite;
}

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

.payment-type-badge {
    background: rgba(139, 92, 246, 0.2);
    color: #a78bfa;
}

.status-badge.paid {
    background: rgba(34, 197, 94, 0.2);
    color: var(--accent-green);
}

.invoice-amount {
    text-align: right;
}

.invoice-amount .currency {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-right: 0.25rem;
}

.invoice-amount .value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.invoice-card.paid .invoice-amount .value {
    color: var(--accent-green);
}

.invoice-card-body {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.invoice-main-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.invoice-description {
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
}

.invoice-affiliate {
    font-size: 0.9rem;
}

.invoice-affiliate-link {
    color: var(--accent-primary);
    text-decoration: none;
}

.invoice-affiliate-link:hover {
    text-decoration: underline;
}

.no-affiliate {
    color: var(--text-muted);
}

.invoice-meta {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: center;
}

.due-badge {
    font-size: 0.85rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.due-badge.soon {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
}

.due-badge.overdue {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    font-weight: 600;
}

.invoice-date, .invoice-creator {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.invoice-payment-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: rgba(34, 197, 94, 0.1);
    border-radius: 8px;
    margin-top: 0.5rem;
}

.tx-hash {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tx-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.tx-value {
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 0.85rem;
    background: var(--bg-tertiary);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tx-value:hover {
    background: var(--accent-primary);
    color: white;
}

.paid-date {
    font-size: 0.8rem;
    color: var(--accent-green);
}

.invoice-card-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.btn-view-invoice, .btn-pay-invoice, .btn-edit-invoice, .btn-archive-invoice, .btn-restore-invoice, .btn-delete-invoice {
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-view-invoice:hover, .btn-edit-invoice:hover, .btn-archive-invoice:hover {
    border-color: var(--accent-primary);
}

.btn-archive-invoice {
    color: var(--text-muted);
}

.btn-restore-invoice {
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.3);
    color: var(--accent-green);
}

.btn-restore-invoice:hover {
    background: rgba(34, 197, 94, 0.2);
    border-color: var(--accent-green);
}

.btn-delete-invoice {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: #ef4444;
}

.btn-delete-invoice:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: #ef4444;
}

.btn-pay-invoice {
    background: linear-gradient(135deg, var(--accent-green), #16a34a);
    border: none;
    color: white;
}

.btn-pay-invoice:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.4);
}

/* Invoice Modal */
.invoice-modal {
    max-width: 600px;
}

.invoice-modal .modal-body {
    max-height: 70vh;
    overflow-y: auto;
}

.form-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

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

.form-section h3 {
    color: var(--text-primary);
    font-size: 1rem;
    margin-bottom: 1rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

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

.form-group label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-group input, .form-group select {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.75rem;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.form-group input:focus, .form-group select:focus {
    outline: none;
    border-color: var(--accent-primary);
}

/* Date input fixes */
.form-group input[type="date"] {
    position: relative;
    z-index: auto;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    width: 100%;
    border-radius: 8px;
    padding: 0.75rem;
    font-size: 0.95rem;
    color-scheme: dark;
    -webkit-appearance: none;
    appearance: none;
}
[data-theme="light"] .form-group input[type="date"] {
    color-scheme: light;
}

.form-group input[type="date"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    filter: invert(0.7);
    opacity: 0.8;
    padding: 2px;
}

[data-theme="light"] .form-group input[type="date"]::-webkit-calendar-picker-indicator {
    filter: none;
    opacity: 0.6;
}

/* Form validation styling — exclude date inputs (browser :invalid is unreliable for them) */
.form-group input:invalid:not(:placeholder-shown):not([type="date"]),
.form-group select:invalid {
    border-color: rgba(239, 68, 68, 0.5);
}

.invoice-modal .form-group {
    position: relative;
}

.invoice-modal .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.amount-input-group {
    display: flex !important;
    flex-direction: row !important;
    gap: 0.5rem;
    width: 100%;
    align-items: center;
}

.amount-input-group .currency-select,
.amount-input-group select {
    width: 90px !important;
    min-width: 90px !important;
    max-width: 90px !important;
    flex-shrink: 0 !important;
    flex-grow: 0 !important;
}

.amount-input-group input,
.amount-input-group input[type="number"],
#invoiceAmount {
    flex: 1 1 auto !important;
    min-width: 100px !important;
    width: auto !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.amount-input-group input:required:invalid {
    border-color: rgba(239, 68, 68, 0.4);
}

.amount-input-group input:required:valid {
    border-color: var(--border-color);
}

/* File Upload Area */
.file-upload-area {
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    transition: all 0.2s ease;
    overflow: hidden;
}

.file-upload-area.dragover {
    border-color: var(--accent-primary);
    background: rgba(20, 184, 166, 0.1);
}

.upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    cursor: pointer;
    text-align: center;
}

.upload-icon {
    font-size: 3rem;
    margin-bottom: 0.75rem;
}

.upload-text {
    color: var(--text-primary);
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.upload-hint {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.upload-preview {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background: var(--bg-tertiary);
}

.upload-preview .preview-icon {
    font-size: 1.5rem;
}

.preview-name {
    flex: 1;
    margin-left: 0.75rem;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.preview-remove {
    background: rgba(239, 68, 68, 0.2);
    border: none;
    color: #ef4444;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.2s ease;
}

.preview-remove:hover {
    background: #ef4444;
    color: white;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.btn-cancel {
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.btn-cancel:hover {
    border-color: var(--text-secondary);
    color: var(--text-primary);
}

.btn-submit {
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border: none;
    color: white;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.btn-submit:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(20, 184, 166, 0.4);
}

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

/* Pay Invoice Modal */
.pay-invoice-modal {
    max-width: 450px;
}

.pay-invoice-summary {
    text-align: center;
    padding: 1.5rem;
    background: var(--bg-tertiary);
    border-radius: 12px;
    margin-bottom: 1.5rem;
}

.pay-amount {
    margin-bottom: 0.75rem;
}

.pay-currency {
    font-size: 1.25rem;
    color: var(--text-secondary);
}

.pay-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--accent-green);
}

.pay-description {
    color: var(--text-primary);
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.pay-affiliate {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.tx-hash-group input {
    font-family: 'SF Mono', Monaco, monospace;
}

.pay-warning {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 8px;
    margin: 1.5rem 0;
}

.warning-icon {
    font-size: 1.25rem;
}

.warning-text {
    color: #f59e0b;
    font-size: 0.9rem;
}

.btn-pay-confirm {
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--accent-green), #16a34a);
    border: none;
    color: white;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.btn-pay-confirm:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.4);
}

.btn-pay-confirm:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Searchable Affiliate Dropdown */
.searchable-select {
    position: relative;
    width: 100%;
}

.searchable-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.searchable-select-trigger:hover {
    border-color: var(--accent-primary);
}

.selected-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dropdown-arrow {
    font-size: 0.7rem;
    color: var(--text-muted);
    transition: transform 0.2s ease;
}

.searchable-select-dropdown.open + .searchable-select-trigger .dropdown-arrow,
.searchable-select-dropdown.open ~ .searchable-select-trigger .dropdown-arrow {
    transform: rotate(180deg);
}

.searchable-select-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    display: none;
    overflow: hidden;
}

.searchable-select-dropdown.open {
    display: block;
    animation: dropdownSlide 0.15s ease-out;
}

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

.dropdown-search {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-tertiary);
}

.dropdown-search input {
    width: 100%;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.6rem 0.75rem;
    border-radius: 6px;
    font-size: 0.9rem;
}

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

.dropdown-options {
    max-height: 250px;
    overflow-y: auto;
}

.dropdown-option {
    display: flex;
    flex-direction: column;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background 0.15s ease;
    border-bottom: 1px solid var(--border-color);
}

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

.dropdown-option:hover {
    background: var(--bg-hover);
}

.dropdown-option.selected {
    background: rgba(20, 184, 166, 0.15);
    border-left: 3px solid var(--accent-primary);
}

.dropdown-option .option-name {
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.95rem;
}

.dropdown-option .option-id {
    color: var(--text-muted);
    font-size: 0.8rem;
    font-family: 'SF Mono', Monaco, monospace;
}

/* Custom Partner Toggle */
.affiliate-toggle-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
}

.toggle-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.toggle-switch-small {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
}

.toggle-switch-small input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider-small {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    transition: 0.2s;
    border-radius: 22px;
}

.toggle-slider-small:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background-color: var(--text-muted);
    transition: 0.2s;
    border-radius: 50%;
}

.toggle-switch-small input:checked + .toggle-slider-small {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border-color: transparent;
}

.toggle-switch-small input:checked + .toggle-slider-small:before {
    transform: translateX(18px);
    background-color: white;
}

/* User Chips for Tagging */
.user-chips-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border-radius: 10px;
    border: 1px solid var(--border-color);
    min-height: 50px;
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.75rem 0.4rem 0.4rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.user-chip:hover {
    border-color: var(--accent-primary);
    background: var(--bg-hover);
}

.user-chip-checkbox {
    display: none;
}

.user-chip-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    color: white;
    text-transform: uppercase;
}

.user-chip-name {
    font-size: 0.85rem;
    color: var(--text-primary);
    font-weight: 500;
}

.user-chip-check {
    display: none;
    color: var(--accent-green);
    font-weight: bold;
    font-size: 0.9rem;
}

.user-chip:has(.user-chip-checkbox:checked) {
    background: rgba(20, 184, 166, 0.15);
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(20, 184, 166, 0.2);
}

.user-chip:has(.user-chip-checkbox:checked) .user-chip-check {
    display: inline;
}

.user-chip:has(.user-chip-checkbox:checked) .user-chip-avatar {
    background: var(--accent-green);
}

/* Affiliate Invoice Section (in deal modal) */
.flat-fees-summary {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1rem;
}

.flat-fee-stat {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.flat-fee-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--accent-primary);
}

.flat-fee-stat.pending .flat-fee-value {
    color: #f59e0b;
}

.flat-fee-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.affiliate-invoices-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.affiliate-invoice-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border-radius: 8px;
    border-left: 3px solid var(--border-color);
}

.affiliate-invoice-item.paid {
    border-left-color: var(--accent-green);
}

.affiliate-invoice-item.pending {
    border-left-color: #f59e0b;
}

.aff-inv-info {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.aff-inv-desc {
    color: var(--text-primary);
    font-size: 0.9rem;
}

.aff-inv-type {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.aff-inv-amount {
    font-weight: 600;
}

.aff-inv-amount.paid {
    color: var(--accent-green);
}

.aff-inv-amount.pending {
    color: #f59e0b;
}

.view-all-invoices {
    color: var(--accent-primary);
    font-size: 0.85rem;
    text-decoration: none;
    text-align: center;
    padding: 0.5rem;
    display: block;
}

.view-all-invoices:hover {
    text-decoration: underline;
}

/* Responsive */
@media (max-width: 768px) {
    .invoices-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .invoices-stats {
        width: 100%;
        overflow-x: auto;
    }
    
    .invoices-filters {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .invoice-search input {
        width: 100%;
    }
    
    .invoice-card-header {
        flex-direction: column;
        gap: 1rem;
    }
    
    .invoice-amount {
        text-align: left;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   BADGE / ACHIEVEMENT SYSTEM
   ============================================ */

.badge-item {
    width: var(--badge-size, 40px);
    height: var(--badge-size, 40px);
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--badge-color, #6366f1)22;
    border: 2px solid var(--badge-color, #6366f1);
    transition: all 0.2s ease;
    cursor: pointer;
}

.badge-item:hover {
    transform: scale(1.15);
    box-shadow: 0 0 20px var(--badge-color, #6366f1)40;
}

.badge-emoji {
    font-size: var(--emoji-size, 18px);
}

.badge-legendary {
    animation: legendaryGlow 2s ease infinite;
}

@keyframes legendaryGlow {
    0%, 100% { box-shadow: 0 0 10px var(--badge-color)40; }
    50% { box-shadow: 0 0 25px var(--badge-color)80; }
}

.user-badges {
    display: flex;
    gap: 0.35rem;
    align-items: center;
    flex-wrap: wrap;
}

.badges-more {
    font-size: 0.75rem;
    color: var(--text-muted);
    background: var(--bg-tertiary);
    padding: 0.2rem 0.5rem;
    border-radius: 10px;
}

.no-badges {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-style: italic;
}

/* Award Badge Modal */
.award-badge-modal {
    max-width: 700px;
}

.award-badge-target {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--bg-tertiary);
    border-radius: 10px;
    margin-bottom: 1.5rem;
}

.target-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.target-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 1.1rem;
}

.badge-selector {
    max-height: 450px;
    overflow-y: auto;
}

.badge-rarity-section {
    margin-bottom: 1.5rem;
}

.rarity-title {
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin: 0 0 0.75rem 0;
}

.badge-grid {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.badge-select-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border: 2px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.badge-select-item:hover:not(.already-owned) {
    border-color: var(--accent-primary);
    background: var(--accent-primary)11;
}

.badge-select-item.selected {
    border-color: var(--accent-green);
    background: var(--accent-green)15;
}

.badge-select-item.already-owned {
    opacity: 0.5;
    cursor: not-allowed;
}

.badge-select-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    border: 2px solid;
    flex-shrink: 0;
}

/* Custom Badge Modal */
.badge-preview-section {
    display: flex;
    justify-content: center;
    margin: 1rem 0;
}

.badge-preview {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--badge-color, #6366f1)22;
    border: 3px solid var(--badge-color, #6366f1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    box-shadow: 0 0 20px var(--badge-color, #6366f1)40;
    transition: all 0.2s ease;
}

.existing-badges-section {
    margin: 1rem 0;
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border-radius: 8px;
}

.existing-badges-section .section-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.existing-badges-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.existing-badge-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.6rem;
    border-radius: 20px;
    font-size: 0.8rem;
    border: 1px solid;
}

.emoji-picker-grid {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 0.35rem;
    max-height: 150px;
    overflow-y: auto;
    padding: 0.5rem;
    background: var(--bg-tertiary);
    border-radius: 8px;
}

.emoji-option {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    border: 2px solid transparent;
}

.emoji-option:hover {
    background: var(--bg-secondary);
    transform: scale(1.15);
}

.emoji-option.selected {
    background: var(--accent-primary)22;
    border-color: var(--accent-primary);
}

.color-picker-grid {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 0.35rem;
    padding: 0.5rem;
    background: var(--bg-tertiary);
    border-radius: 8px;
}

.color-option {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.15s ease;
    border: 2px solid transparent;
}

.color-option:hover {
    transform: scale(1.2);
}

.color-option.selected {
    border-color: white;
    box-shadow: 0 0 0 2px var(--bg-primary), 0 0 10px currentColor;
}

.award-badge-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.btn-award-badge {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-award-badge:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
}

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

/* Badge Celebration Popup */
.badge-celebration-popup {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 10002;
    transform: translateX(400px);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.badge-celebration-popup.show {
    transform: translateX(0);
}

.badge-celebration-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    background: linear-gradient(135deg, #1c242f 0%, #141a23 100%);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    position: relative;
}

.celebration-badge {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--badge-color, #f59e0b)20;
    border: 3px solid var(--badge-color, #f59e0b);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: celebrationPulse 1s ease infinite;
}

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

.celebration-emoji {
    font-size: 2rem;
}

.celebration-text {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.celebration-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.celebration-message {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.celebration-close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
}

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

/* Badge Notification Popup (for others) */
.badge-notification-popup {
    position: fixed;
    top: 80px;
    right: 30px;
    z-index: 10002;
    transform: translateX(400px);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.badge-notification-popup.show {
    transform: translateX(0);
}

.badge-notif-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.25rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.badge-notif-emoji {
    font-size: 1.75rem;
}

.badge-notif-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.badge-notif-text strong {
    color: var(--text-primary);
}

.badge-notif-text small {
    color: var(--text-muted);
}

/* ============================================
   FINANCE TABS (Bills, Payments, Balances)
   ============================================ */

.finance-main-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
    flex-wrap: wrap;
}

.finance-main-tab {
    padding: 0.75rem 1.25rem;
    font-size: 0.9rem;
    font-weight: 500;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.finance-main-tab:hover {
    border-color: var(--accent-blue);
    color: var(--text-primary);
}

.finance-main-tab.active {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
    color: white;
}

.affilka-finance-section {
    padding: 1rem 0;
}

.finance-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

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

.btn-sync-finance {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    background: var(--accent-blue);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-sync-finance:hover {
    background: var(--accent-blue-hover, #2563eb);
    transform: translateY(-1px);
}

.auto-sync-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.6rem;
    font-size: 0.7rem;
    color: var(--accent-green);
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 4px;
    margin-right: 0.5rem;
}

.finance-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.finance-stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1rem;
    text-align: center;
}

.finance-stat-card.highlight {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(16, 185, 129, 0.05));
    border-color: var(--accent-green);
}

.finance-stat-card.warning {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(245, 158, 11, 0.05));
    border-color: var(--accent-orange);
}

.finance-stat-card .stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.finance-stat-card .stat-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-top: 0.25rem;
}

.finance-stat-card .stat-sublabel {
    display: block;
    font-size: 0.7rem;
    color: var(--accent-green, #10b981);
    margin-top: 0.15rem;
    font-weight: 500;
}

.finance-stat-card.clickable {
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.finance-stat-card.clickable:hover {
    border-color: var(--accent-green, #10b981);
    transform: translateY(-1px);
}

.finance-stat-card.clickable.active {
    border-color: var(--accent-green, #10b981);
    background: rgba(16, 185, 129, 0.1);
}

.finance-period-selector {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1rem 0;
    flex-wrap: wrap;
}

.finance-period-selector .period-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.finance-period-selector .period-buttons {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.finance-period-selector .period-btn {
    padding: 0.3rem 0.7rem;
    font-size: 0.75rem;
    border-radius: 4px;
    border: 1px solid var(--border-color, #374151);
    background: var(--bg-secondary, #1f2937);
    color: var(--text-secondary, #9ca3af);
    cursor: pointer;
    transition: all 0.15s ease;
}

.finance-period-selector .period-btn:hover {
    border-color: var(--accent-green, #10b981);
    color: var(--text-primary, #f9fafb);
}

.finance-period-selector .period-btn.active {
    background: var(--accent-green, #10b981);
    color: #fff;
    border-color: var(--accent-green, #10b981);
}

.finance-custom-range {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0.5rem 0 1rem 0;
    flex-wrap: wrap;
}

.finance-custom-range input[type="month"] {
    padding: 0.3rem 0.5rem;
    font-size: 0.75rem;
    border-radius: 4px;
    border: 1px solid var(--border-color, #374151);
    background: var(--bg-secondary, #1f2937);
    color: var(--text-primary, #f9fafb);
}

.finance-custom-range span {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.balance-corrections-section {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color, #374151);
}

.balance-corrections-section h4 {
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.correction-comment {
    font-style: italic;
    opacity: 0.7;
}

.sync-info {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.finance-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.finance-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    transition: all 0.15s ease;
}

.finance-item:hover {
    border-color: var(--accent-blue);
}

.finance-item-main {
    flex: 1;
}

.finance-item-partner {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.finance-item-details {
    display: flex;
    gap: 1rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.finance-item-right {
    text-align: right;
}

.finance-item-amount {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-primary);
}

.finance-item-status {
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

.finance-item-status.pending { color: var(--accent-orange); }
.finance-item-status.success, .finance-item-status.paid { color: var(--accent-green); }
.finance-item-status.stuck { color: var(--accent-red, #ef4444); }
.finance-item-status.canceled { color: var(--text-muted); }

.finance-item.paid {
    border-left: 3px solid var(--accent-green);
}

.finance-item.pending {
    border-left: 3px solid var(--accent-orange);
}

.finance-item.stuck {
    border-left: 3px solid var(--accent-red, #ef4444);
    background: rgba(239, 68, 68, 0.05);
}

.finance-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: var(--text-muted);
}

.finance-loading .error {
    color: var(--accent-red, #ef4444);
}

/* Partner Balances Summary Card */
.balance-summary-card {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(59, 130, 246, 0.15));
    border: 1px solid var(--accent-green);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.balance-summary-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.balance-summary-amounts {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}

.balance-summary-item {
    display: flex;
    flex-direction: column;
}

.balance-summary-item .balance-currency {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.balance-summary-item .balance-amount {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--accent-green);
}

.balance-amounts {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.balance-amount-item {
    font-weight: 600;
    color: var(--accent-green);
    font-size: 0.9rem;
}

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

/* ============================================
   COMMISSION INTELLIGENCE STYLES
   ============================================ */

.comm-badges {
    display: inline-flex;
    gap: 0.35rem;
    flex-wrap: wrap;
    margin-left: 0.5rem;
}

.comm-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.comm-badge-green {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.comm-badge-orange {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.comm-badge-info {
    background: rgba(59, 130, 246, 0.12);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.25);
}

.comm-badge-muted {
    background: rgba(156, 163, 175, 0.1);
    color: var(--text-muted);
    border: 1px solid rgba(156, 163, 175, 0.2);
}


.strategy-badge {
    display: inline-block;
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}

.strategy-badge.strategy-cpa { background: rgba(139, 92, 246, 0.15); color: #8b5cf6; }
.strategy-badge.strategy-rev_share { background: rgba(59, 130, 246, 0.15); color: #3b82f6; }
.strategy-badge.strategy-hybrid { background: rgba(236, 72, 153, 0.15); color: #ec4899; }


.risk-deals-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.risk-deal-chip {
    display: inline-block;
    padding: 0.3rem 0.6rem;
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 4px;
    font-size: 0.75rem;
    color: #fbbf24;
}

/* Deduction status in reports commission breakdown */
.deduction-status {
    text-align: right;
    font-size: 0.7rem;
}

.deduction-active {
    color: #10b981;
    font-weight: 600;
    padding: 0.15rem 0.4rem;
    background: rgba(16, 185, 129, 0.1);
    border-radius: 3px;
}

.deduction-informational {
    color: var(--text-muted);
    font-style: italic;
    padding: 0.15rem 0.4rem;
    background: rgba(156, 163, 175, 0.08);
    border-radius: 3px;
}

.deduction-banner {
    padding: 0.6rem 0.8rem;
    border-radius: 6px;
    font-size: 0.8rem;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.deduction-banner-active {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #10b981;
}

.deduction-banner-warning {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: #f59e0b;
}

.deduction-banner-unknown {
    background: rgba(156, 163, 175, 0.1);
    border: 1px solid rgba(156, 163, 175, 0.2);
    color: var(--text-muted);
}

.raw-modifiers-details {
    margin-top: 0.75rem;
}

.raw-modifiers-details summary {
    cursor: pointer;
    font-size: 0.75rem;
    color: var(--text-muted);
    padding: 0.3rem 0;
}

.raw-modifiers-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.5rem;
}

.raw-modifier-chip {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 3px;
    font-size: 0.7rem;
    color: #818cf8;
    font-family: monospace;
}

.raw-modifier-chip small {
    opacity: 0.6;
}

/* ============================================
   TEAM PAGE STYLES
   ============================================ */

.team-page {
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.team-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 2rem;
}

.team-header-text {
    flex: 1;
}

.team-page-header h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.team-page-header .page-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin: 0;
}

.team-grid {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.team-section h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.pending-section h3 {
    color: var(--accent-orange);
}

.team-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
}

.team-member-card {
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    transition: border-color 0.2s, box-shadow 0.2s;
    overflow: hidden;
    min-width: 0;
}

.team-member-card:hover {
    border-color: var(--accent-blue);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.team-member-card.pending {
    border-color: var(--accent-orange);
    background: rgba(245, 158, 11, 0.05);
}

/* Row 1: Avatar + Name + Role */
.tmc-identity {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1rem 0;
}

.team-member-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.95rem;
    color: white;
    flex-shrink: 0;
    overflow: hidden;
}

.team-member-avatar.has-photo {
    background: none;
}

.team-member-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tmc-text {
    min-width: 0;
    flex: 1;
}

.tmc-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
    line-height: 1.3;
    word-break: break-word;
}

.you-badge {
    font-size: 0.65rem;
    color: var(--accent-blue);
    font-weight: 500;
}

.tmc-text .role-badge {
    display: inline-block;
    margin-top: 4px;
    font-size: 0.6rem;
    padding: 0.15rem 0.45rem;
}

/* Row 2: Email */
.tmc-email {
    padding: 0.35rem 1rem 0;
    font-size: 0.75rem;
    color: var(--text-secondary);
    word-break: break-all;
}

/* Row 3: Badges */
.tmc-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    padding: 0.5rem 1rem 0;
    overflow: hidden;
    max-width: 100%;
}

.team-badge-chip {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 3px 7px;
    border-radius: 4px;
    font-size: 0.65rem;
    color: white;
    font-weight: 500;
    max-width: 100%;
    min-width: 0;
}

.badge-chip-icon {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.badge-chip-icon svg {
    width: 12px;
    height: 12px;
}

.badge-chip-name {
    white-space: nowrap;
}

.tmc-online-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22c55e;
    display: inline-block;
    margin-left: 6px;
    box-shadow: 0 0 4px rgba(34, 197, 94, 0.5);
}

.tmc-last-seen {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-left: 6px;
}

/* Row 4: Actions - always at bottom */
.tmc-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    padding: 0.75rem 1rem;
    margin-top: auto;
    border-top: 1px solid var(--border-color);
}

/* Badge Chip Display (for profile popup) */
.badge-chip-display {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    border-radius: 20px;
    color: white;
    font-weight: 500;
}

.badge-chip-label {
    white-space: nowrap;
}

.user-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    justify-content: center;
}

.no-badges {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-style: italic;
}

.badges-more {
    background: var(--bg-secondary);
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.team-member-actions {
    display: flex;
    gap: 0.35rem;
}

.team-btn {
    width: 30px;
    height: 30px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.team-btn svg,
.btn-icon-header svg {
    display: block;
    flex-shrink: 0;
}

.team-btn:hover {
    border-color: var(--accent-blue);
    transform: scale(1.05);
}

.team-btn-message:hover {
    background: rgba(59, 130, 246, 0.15);
    border-color: var(--accent-blue);
}

.team-btn-badge:hover {
    background: rgba(245, 158, 11, 0.15);
    border-color: var(--accent-orange);
}

.team-btn-manage:hover {
    background: rgba(139, 92, 246, 0.15);
    border-color: var(--accent-purple);
}

.team-btn-approve {
    background: rgba(16, 185, 129, 0.15);
    border-color: var(--accent-green);
}

.team-btn-reject {
    background: rgba(239, 68, 68, 0.15);
    border-color: var(--accent-red);
}

.team-loading {
    text-align: center;
    color: var(--text-secondary);
    padding: 3rem;
}

.team-error {
    text-align: center;
    color: var(--accent-red);
    padding: 3rem;
}

/* Team Options Popup */
.team-options-popup {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.team-options-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    min-width: 280px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.team-options-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
}

.team-options-header button {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
}

.team-options-list {
    padding: 0.75rem;
}

.team-options-list button {
    width: 100%;
    padding: 0.75rem 1rem;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 0.95rem;
    text-align: left;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.2s;
}

.team-options-list button:hover {
    background: var(--bg-tertiary);
}

.team-options-list hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 0.5rem 0;
}

.team-options-role {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
}

.team-options-role span {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.team-options-role select {
    flex: 1;
    padding: 0.5rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-primary);
}

.team-btn-danger {
    color: var(--accent-red) !important;
}

.team-btn-danger:hover {
    background: rgba(239, 68, 68, 0.15) !important;
}

/* Team Page Responsive */
@media (max-width: 1200px) {
    .team-cards {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    }
}

@media (max-width: 768px) {
    .team-cards {
        grid-template-columns: 1fr;
    }
    
    .team-page-header {
        flex-direction: column;
        gap: 0.75rem;
        align-items: flex-start;
    }
    
    .team-page-header h2 {
        font-size: 1.25rem;
    }
}

/* ============================================
   ONLINE USER OPTIONS POPUP
   ============================================ */

.online-user-options-popup {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    min-width: 180px;
    z-index: 10001;
    overflow: hidden;
}

.online-options-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.online-options-header button {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.25rem;
    cursor: pointer;
    line-height: 1;
    padding: 0;
}

.online-options-status {
    padding: 0.4rem 0.75rem 0.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.online-options-status strong {
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

.online-dot-sm {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent-green);
    flex-shrink: 0;
}

.online-options-list {
    padding: 0.5rem;
}

.online-options-list button {
    display: block;
    width: 100%;
    padding: 0.6rem 0.75rem;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 0.875rem;
    text-align: left;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.15s;
}

.online-options-list button:hover {
    background: var(--bg-tertiary);
}

/* ============================================
   AI ASSISTANT CHAT PANEL
   ============================================ */

/* Sidebar AI Link */
.nav-link-ai {
    position: relative;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(236, 72, 153, 0.1));
    border: 1px solid rgba(139, 92, 246, 0.2);
    margin: 0.5rem 0.75rem;
    border-radius: 10px !important;
}

.nav-link-ai:hover {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(236, 72, 153, 0.2));
    border-color: rgba(139, 92, 246, 0.4);
}

.ai-beta-badge {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: linear-gradient(135deg, #8b5cf6, #ec4899);
    color: white;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    letter-spacing: 0.5px;
}

/* Chat Panel */
.ai-chat-panel {
    position: fixed;
    right: -420px;
    top: 0;
    bottom: 0;
    width: 400px;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.3);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.ai-chat-panel.active {
    right: 0;
}

/* Header */
.ai-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.15), rgba(236, 72, 153, 0.1));
    border-bottom: 1px solid var(--border-color);
}

.ai-chat-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.ai-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: #141414;
    border-radius: 10px;
    border: 1px solid #2A2A2A;
}

.ai-avatar img {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.ai-title-text {
    display: flex;
    flex-direction: column;
}

.ai-name {
    font-weight: 700;
    font-size: 1rem;
    color: #C8A249;
}

.ai-status {
    font-size: 0.75rem;
    color: var(--accent-green);
}

.ai-status.thinking {
    color: var(--accent-yellow);
}

.ai-chat-actions {
    display: flex;
    gap: 0.5rem;
}

.ai-btn-clear, .ai-btn-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    transition: all 0.2s;
}

.ai-btn-clear:hover, .ai-btn-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* Messages Container */
.ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.ai-message {
    max-width: 90%;
    animation: aiMessageFadeIn 0.3s ease-out;
}

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

.ai-message-user {
    align-self: flex-end;
}

.ai-message-assistant {
    align-self: flex-start;
}

.ai-message-content {
    padding: 0.875rem 1rem;
    border-radius: 16px;
    font-size: 0.9rem;
    line-height: 1.5;
}

.ai-message-user .ai-message-content {
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    color: white;
    border-bottom-right-radius: 4px;
}

.ai-message-assistant .ai-message-content {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-bottom-left-radius: 4px;
}

.ai-message-content p {
    margin: 0 0 0.5rem 0;
}

.ai-message-content p:last-child {
    margin-bottom: 0;
}

.ai-message-content ul {
    margin: 0.5rem 0;
    padding-left: 1.25rem;
}

.ai-message-content li {
    margin: 0.25rem 0;
}

.ai-message-content code {
    background: rgba(0, 0, 0, 0.3);
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85em;
}

.ai-message-content strong {
    color: var(--accent-primary);
}

/* Typing Indicator */
.ai-typing {
    display: flex;
    gap: 4px;
    padding: 0.75rem 1rem;
}

.ai-typing span {
    width: 8px;
    height: 8px;
    background: var(--accent-purple);
    border-radius: 50%;
    animation: aiTyping 1.4s infinite ease-in-out both;
}

.ai-typing span:nth-child(1) { animation-delay: -0.32s; }
.ai-typing span:nth-child(2) { animation-delay: -0.16s; }

@keyframes aiTyping {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Input Container */
.ai-chat-input-container {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-primary);
}

.ai-quick-prompts {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.ai-quick-prompts button {
    padding: 0.4rem 0.75rem;
    font-size: 0.75rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.ai-quick-prompts button:hover {
    background: var(--bg-secondary);
    border-color: var(--accent-purple);
    color: var(--text-primary);
}

.ai-chat-form {
    display: flex;
    gap: 0.5rem;
}

#aiChatInput {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 24px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.9rem;
    outline: none;
    transition: all 0.2s;
}

#aiChatInput:focus {
    border-color: var(--accent-purple);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}

#aiChatInput::placeholder {
    color: var(--text-muted);
}

.ai-send-btn {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, #8b5cf6, #ec4899);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.ai-send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
}

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

.ai-send-icon {
    font-size: 1.1rem;
    transform: rotate(-45deg);
}

/* Error State */
.ai-message-error .ai-message-content {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--accent-red);
    color: var(--accent-red);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .ai-chat-panel {
        width: 100%;
        right: -100%;
    }
    
    .ai-quick-prompts {
        display: none;
    }
}

/* ============================================
   REPORTS SECTION
   ============================================ */

.reports-page {
    padding: 0;
}

.reports-content {
    min-height: 100%;
}

.reports-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
}

.reports-loading .loading-spinner {
    width: 40px;
    height: 40px;
    margin-bottom: 1rem;
}

/* Password Gate CSS removed - feature deprecated */

/* Reports Header */
.reports-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
    margin-bottom: 0;
}

.reports-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.reports-subtitle {
    margin: 0.25rem 0 0 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.reports-header-right {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.reports-month-select {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 0.9rem;
}

.reports-export-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    z-index: 100;
    display: none;
    min-width: 150px;
}

.reports-export-dropdown.show {
    display: block;
}

.reports-export-dropdown button {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    text-align: left;
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.2s;
}

.reports-export-dropdown button:hover {
    background: var(--bg-tertiary);
}

/* Reports Tabs */
.reports-tabs {
    display: flex;
    gap: 0;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 0 1.5rem;
    overflow-x: auto;
}

.reports-tab {
    padding: 1rem 1.5rem;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

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

.reports-tab.active {
    color: var(--accent-primary);
    border-bottom-color: var(--accent-primary);
}

/* Reports Content Area */
.reports-content-area {
    padding: 1.5rem;
    min-height: calc(100vh - 280px);
}

.reports-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    text-align: center;
}

.reports-error .error-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

/* Partners Tab (inside Affiliation) */
.partners-tab-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.partners-tab-notice {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid var(--accent-primary);
    border-radius: 8px;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    color: var(--accent-primary);
    display: none; /* Hidden by default */
}

.partners-summary-bar {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 1rem;
}

.partner-stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1rem;
    text-align: center;
}

.partner-stat-card .stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.partner-stat-card .stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.partner-stat-card.live .stat-value { color: var(--accent-green); }
.partner-stat-card.waiting .stat-value { color: var(--accent-yellow); }
.partner-stat-card.hold .stat-value { color: var(--accent-orange); }
.partner-stat-card.ftd .stat-value { color: var(--accent-blue); }
.partner-stat-card.commission .stat-value { color: var(--accent-primary); }

.partners-filter-bar {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.partners-filter-bar input,
.partners-filter-bar select {
    padding: 0.6rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 0.9rem;
}

.partners-filter-bar input {
    flex: 1;
    min-width: 200px;
}

.partners-table-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow-x: auto;
    overflow-y: visible;
}

.partners-table {
    width: 100%;
    border-collapse: collapse;
}

.partners-table th,
.partners-table td {
    padding: 0.875rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.partners-table th {
    background: var(--bg-tertiary);
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.partners-table tbody tr:hover {
    background: var(--bg-tertiary);
}

.partner-name-cell {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.partner-name-cell strong {
    color: var(--text-primary);
}

.partner-name-cell .partner-id {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.status-badge {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-badge.status-live { background: var(--accent-green); color: #fff; }
.status-badge.status-waiting { background: rgba(245, 158, 11, 0.15); color: var(--accent-yellow); }
.status-badge.status-hold { background: rgba(249, 115, 22, 0.15); color: var(--accent-orange); }
.status-badge.status-frozen { background: rgba(59, 130, 246, 0.15); color: var(--accent-blue); }
.status-badge.status-archived { background: rgba(107, 114, 128, 0.15); color: var(--text-muted); }

@media (max-width: 1200px) {
    .partners-summary-bar {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .partners-summary-bar {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Overview Tab */
.reports-overview {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.overview-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.overview-stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
    display: flex;
    gap: 1rem;
    align-items: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

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

.overview-stat-card.primary {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(6, 182, 212, 0.1));
    border-color: var(--accent-primary);
}

.overview-stat-card.small {
    padding: 1rem;
}

.overview-stat-card .stat-icon {
    font-size: 2rem;
    opacity: 0.8;
}

.overview-stat-card.small .stat-icon {
    font-size: 1.5rem;
}

.overview-stat-card .stat-content {
    flex: 1;
}

.overview-stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.overview-stat-card.small .stat-value {
    font-size: 1.25rem;
}

.overview-stat-card .stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.overview-stat-card .stat-change {
    font-size: 0.75rem;
    margin-top: 0.5rem;
    font-weight: 500;
}

.overview-stat-card .stat-change.positive {
    color: var(--accent-green);
}

.overview-stat-card .stat-change.negative {
    color: var(--accent-red);
}

.overview-stat-card .stat-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.overview-charts-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.overview-chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
}

.overview-chart-card h3 {
    margin: 0 0 1rem 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.top-partners-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.top-partner-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.top-partner-row:hover {
    background: var(--bg-secondary);
}

.top-partner-row .rank {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-1);
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 700;
    color: white;
}

.top-partner-row .name {
    flex: 1;
    font-weight: 500;
    color: var(--text-primary);
}

.top-partner-row .value {
    font-weight: 600;
    color: var(--accent-primary);
}

.no-data {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem;
}

/* Players Tab */
.reports-players {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.players-filters {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
    padding: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
}

.players-filters .filter-group select,
.players-filters .filter-group input {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.85rem;
    min-width: 150px;
}

.filter-stats {
    margin-left: auto;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.players-table-container {
    overflow-x: auto;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
}

.players-table {
    width: 100%;
    border-collapse: collapse;
}

.players-table th,
.players-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

/* Force minimum column widths */
.players-table th:nth-child(1),
.players-table td:nth-child(1) {
    min-width: 150px;
}

.players-table th:nth-child(2),
.players-table td:nth-child(2) {
    min-width: 150px;
}

.players-table th {
    background: var(--bg-tertiary);
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.players-table th.sortable {
    cursor: pointer;
    user-select: none;
    transition: color 0.2s ease;
}

.players-table th.sortable:hover {
    color: var(--accent-cyan);
}

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

.player-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    max-width: 180px;
}

.player-name {
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}

.player-email {
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}

/* Partner badge in players table */
.players-table .partner-badge {
    display: inline-block;
    max-width: 140px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0.25rem 0.5rem;
    background: var(--bg-tertiary);
    border-radius: 4px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Source badge in players table */
.players-table .source-badge {
    display: inline-block;
    max-width: 140px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0.2rem 0.4rem;
    background: rgba(6, 182, 212, 0.1);
    border: 1px solid rgba(6, 182, 212, 0.3);
    border-radius: 4px;
    font-size: 0.8rem;
    color: var(--accent-cyan);
}

.players-table .no-source {
    color: var(--text-muted);
}

/* Status badges for players table */
.players-table .status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
}

.players-table .status-badge.qualified {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-green);
}

.players-table .status-badge.active {
    background: rgba(234, 179, 8, 0.15);
    color: var(--accent-yellow);
}

.players-table .status-badge.pending {
    background: rgba(107, 114, 128, 0.15);
    color: var(--text-muted);
}

.players-table .status-badge.self-excluded {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-red);
}

.players-table .status-badge.duplicate {
    background: rgba(139, 92, 246, 0.15);
    color: var(--accent-purple);
}

.players-table .status-badge.disabled {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-red);
}

.players-table .status-badge.frozen {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent-blue);
}

.partner-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: var(--bg-tertiary);
    border-radius: 4px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.source-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 4px;
    font-size: 0.75rem;
    color: var(--accent-blue);
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.deposit-amount {
    font-weight: 600;
    color: var(--accent-green);
}

.no-deposit {
    color: var(--text-muted);
}

.player-status-badges {
    display: flex;
    gap: 0.25rem;
}

.status-badge {
    font-size: 0.9rem;
}

.no-players-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    text-align: center;
}

.no-players-message .icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.no-players-message h3 {
    margin: 0 0 0.5rem 0;
    color: var(--text-primary);
}

.no-players-message p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

/* Clickable Player Rows */
.player-row.clickable {
    cursor: pointer;
    transition: all 0.2s ease;
}

.player-row.clickable:hover {
    background: var(--bg-hover) !important;
}

.player-row.expanded {
    background: var(--bg-tertiary);
    border-left: 3px solid var(--accent-primary);
}

/* Player Details Expansion */
.player-details-row {
    background: var(--bg-secondary) !important;
}

.player-details-row:hover {
    background: var(--bg-secondary) !important;
}

.player-details-content {
    padding: 1.5rem;
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    border-radius: 8px;
    margin: 0.5rem;
}

.player-details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}

.player-details-grid .detail-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    min-width: 0; /* Prevent grid blowout */
}

.player-details-grid .detail-section h4 {
    margin: 0 0 0.75rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.85rem;
    color: var(--text-primary);
    white-space: nowrap;
}

.player-details-grid .detail-row {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.5rem 0;
    font-size: 0.8rem;
    border-bottom: 1px dashed var(--border-color);
}

.player-details-grid .detail-row span {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.player-details-grid .detail-row .value-wrapper {
    display: flex;
    flex-direction: row-reverse;
    justify-content: flex-end;
    align-items: flex-start;
    gap: 0.5rem;
    width: 100%;
}

.player-details-grid .detail-row:last-of-type {
    border-bottom: none;
}

.player-details-grid .detail-row strong {
    color: var(--text-primary);
    word-break: break-word;
    overflow-wrap: break-word;
    flex: 1;
    font-size: 0.85rem;
}

.player-details-grid .detail-row .url-text {
    font-size: 0.75rem;
    word-break: break-all;
    overflow-wrap: anywhere;
}

.player-details-grid .copy-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 2px 6px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.7rem;
    flex-shrink: 0;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    gap: 2px;
}

.player-details-grid .copy-btn:hover {
    background: var(--bg-hover);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.player-details-grid .copy-btn.copied {
    background: var(--accent-green);
    border-color: var(--accent-green);
    color: white;
}

.player-details-grid .btn-small {
    margin-top: 0.75rem;
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    background: var(--accent-primary);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.player-details-grid .btn-small:hover {
    background: var(--accent-primary-hover);
    transform: translateY(-1px);
}

/* Traffic Sources Tab */
.reports-sources {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.sources-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.source-summary-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1.25rem;
    text-align: center;
}

.source-summary-card .summary-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent-primary);
    display: block;
}

.source-summary-card .summary-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.sources-filter {
    padding: 0;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.sources-filter input,
.sources-filter select {
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 0.9rem;
}

.sources-filter input {
    width: 300px;
    max-width: 100%;
}

.sources-filter select {
    min-width: 150px;
}

/* Sort Controls */
.sources-sort-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
}

.sort-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.sources-sort-controls select {
    padding: 0.5rem 0.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.85rem;
    cursor: pointer;
}

.sort-dir-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sort-dir-btn:hover {
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
}

/* Unknown source card styling */
.source-card.unknown-source {
    opacity: 0.7;
    border-color: var(--border-color);
}

.source-card.unknown-source .source-domain {
    color: var(--text-muted);
}

.sources-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1rem;
}

.source-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

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

.source-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
    gap: 0.5rem;
}

.source-domain {
    font-weight: 600;
    color: var(--text-primary);
    word-break: break-all;
    flex: 1;
}

.source-type-badge {
    font-size: 0.65rem;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    text-transform: uppercase;
    font-weight: 600;
    flex-shrink: 0;
}

.badge-promo {
    background: rgba(236, 72, 153, 0.15);
    color: var(--accent-pink);
}

.badge-campaign {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent-blue);
}

.badge-domain {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-green);
}

.badge-partner {
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent-orange);
}

.source-partner-line {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.source-partner-line .partner-label {
    color: var(--text-muted);
}

.source-partner-line strong {
    color: var(--accent-primary);
}

.source-partner {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.sources-header {
    margin-bottom: 1rem;
}

.sources-header h3 {
    margin: 0 0 0.25rem 0;
    font-size: 1.25rem;
    color: var(--text-primary);
}

.sources-header .subtitle {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.source-dates {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.source-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.source-conv-rate {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.source-stat {
    text-align: center;
}

.source-stat .stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.source-stat .stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.source-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
}

.source-discovered {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.btn-small {
    padding: 0.35rem 0.75rem;
    font-size: 0.75rem;
    border-radius: 4px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.2s;
}

.btn-small:hover {
    background: var(--bg-secondary);
}

.no-sources-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    text-align: center;
}

.no-sources-message .icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

/* Commission Tab */
.reports-commission {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.commission-filters {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: stretch;
}

.commission-selector,
.commission-period-filter {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
}

.commission-selector {
    flex: 1;
}

.commission-period-filter {
    min-width: 200px;
}

.commission-selector label {
    font-weight: 500;
    color: var(--text-primary);
}

.commission-selector select {
    flex: 1;
    max-width: 400px;
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.9rem;
}

.commission-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    text-align: center;
    color: var(--text-secondary);
}

.commission-placeholder .icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.commission-breakdown {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
}

.commission-header {
    padding: 1.25rem;
    background: var(--gradient-1);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.commission-header h3 {
    margin: 0;
    font-size: 1.25rem;
}

.commission-plan {
    font-size: 0.85rem;
    opacity: 0.9;
}

.commission-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    padding: 1.25rem;
    border-bottom: 1px solid var(--border-color);
}

.commission-card {
    text-align: center;
    padding: 1rem;
    background: var(--bg-tertiary);
    border-radius: 8px;
}

.commission-card .label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.commission-card .label .ri-help {
    vertical-align: middle;
    margin-left: 4px;
    text-transform: none;
}

.commission-card .value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.commission-card.actual {
    background: rgba(16, 185, 129, 0.1);
}

.commission-card.actual .value {
    color: var(--accent-green);
}

.commission-card.expected {
    background: rgba(59, 130, 246, 0.1);
}

.commission-card.expected .value {
    color: var(--accent-blue);
}

.commission-card.positive .value {
    color: var(--accent-green);
}

.commission-card.negative .value {
    color: var(--accent-red);
}

.commission-details {
    padding: 1.25rem;
    display: grid;
    grid-template-columns: repeat(2, 1fr) 1fr;
    gap: 1.5rem;
}

.detail-section h4 {
    margin: 0 0 1rem 0;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.breakdown-table {
    width: 100%;
    border-collapse: collapse;
}

.breakdown-table td {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

/* Help tooltips in commission breakdown */
.commission-breakdown .ri-help {
    font-size: 9px;
    width: 13px;
    height: 13px;
    min-width: 13px;
}

.commission-breakdown .detail-section h4 .ri-help {
    vertical-align: middle;
    margin-left: 6px;
}

.breakdown-table td .ri-help {
    vertical-align: middle;
}

.player-summary-grid .label .ri-help {
    margin-left: 2px;
}

.breakdown-table td.amount {
    text-align: right;
    font-weight: 600;
    color: var(--text-primary);
}

.breakdown-table td.amount.negative {
    color: var(--accent-red);
}

.breakdown-table tr.total td {
    border-top: 2px solid var(--border-color);
    font-weight: 700;
}

/* Commission Breakdown v2 — Summary Table */
.commission-summary-table {
    margin-top: 0;
    table-layout: fixed;
}

.commission-summary-table th {
    font-size: 0.78rem;
    white-space: nowrap;
}

.commission-summary-table th:nth-child(1) { width: 18%; }
.commission-summary-table th:nth-child(2) { width: 11%; }
.commission-summary-table th:nth-child(3) { width: 12%; }
.commission-summary-table th:nth-child(4) { width: 12%; }
.commission-summary-table th:nth-child(5) { width: 12%; }
.commission-summary-table th:nth-child(6) { width: 12%; }
.commission-summary-table th:nth-child(7) { width: 10%; }
.commission-summary-table th:nth-child(8) { width: 10%; }

.commission-summary-table td:first-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 0;
}

.commission-summary-table th .ri-help {
    vertical-align: middle;
}

.commission-row {
    transition: background 0.15s;
}

.commission-row:hover {
    background: rgba(59, 130, 246, 0.05);
}

.commission-row-expanded {
    background: rgba(59, 130, 246, 0.08);
    border-left: 3px solid var(--accent-blue);
}

.commission-waste-positive {
    background: rgba(239, 68, 68, 0.03);
}

.commission-waste-positive:hover {
    background: rgba(239, 68, 68, 0.07);
}

.commission-waste-zero {
    background: rgba(16, 185, 129, 0.03);
}

.commission-waste-zero:hover {
    background: rgba(16, 185, 129, 0.07);
}

.commission-waste-negative {
    background: rgba(59, 130, 246, 0.03);
}

.commission-no-bill {
    opacity: 0.6;
}

.commission-no-bill:hover {
    opacity: 1;
}

.commission-no-data {
    background: rgba(245, 158, 11, 0.04);
}

.commission-no-data:hover {
    background: rgba(245, 158, 11, 0.08);
}

.badge-excluded-yes {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-green);
}

.badge-excluded-no {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-red);
}

.commission-detail-row td {
    padding: 0 !important;
    background: var(--bg-secondary);
}

.commission-detail-panel {
    padding: 1.25rem;
    border-top: 1px solid var(--border-color);
    border-bottom: 2px solid var(--accent-blue);
}

.commission-detail-panel .commission-details {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 900px) {
    .commission-detail-panel .commission-details {
        grid-template-columns: 1fr;
    }
}

.reports-commission-v2 .commission-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    padding: 1rem 0;
}

.reports-commission-v2 .commission-summary {
    margin-bottom: 1rem;
}

.player-summary-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.summary-item {
    text-align: center;
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border-radius: 6px;
    transition: all 0.2s ease;
}

.summary-item.clickable {
    cursor: pointer;
}

.summary-item.clickable:hover {
    background: var(--bg-hover);
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.summary-item .count {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.summary-item .label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.summary-item.problem {
    background: rgba(239, 68, 68, 0.1);
}

.summary-item.problem .count {
    color: var(--accent-red);
}

/* Comparison Tab */
.reports-comparison {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.comparison-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

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

.comparison-warning {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid var(--accent-orange);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    color: var(--accent-orange);
    font-size: 0.9rem;
}

.comparison-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    text-align: center;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
}

.comparison-placeholder .icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.comparison-table-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
}

.comparison-table {
    width: 100%;
    border-collapse: collapse;
}

.comparison-table th,
.comparison-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.comparison-table th {
    background: var(--bg-tertiary);
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.comparison-table td {
    color: var(--text-primary);
}

.change-indicator {
    display: inline-block;
    margin-left: 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
}

.change-indicator.positive {
    color: var(--accent-green);
}

.change-indicator.negative {
    color: var(--accent-red);
}

.comparison-charts {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
}

/* Problems Tab */
.reports-problems {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.problems-filter-bar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
}

.problems-filter-bar .filter-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.problems-filter-bar .filter-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.problems-filter-bar .filter-select {
    padding: 0.4rem 0.6rem;
    font-size: 0.8rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.problems-filter-bar .filter-stats {
    margin-left: auto;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.problems-summary {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1rem;
}

.problem-summary-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1.25rem;
    text-align: center;
}

.problem-summary-card .count {
    font-size: 2rem;
    font-weight: 700;
    display: block;
    color: var(--text-primary);
}

.problem-summary-card .label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.problem-summary-card.total {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(249, 115, 22, 0.1));
    border-color: var(--accent-red);
}

.problem-summary-card.total .count {
    color: var(--accent-red);
}

.problem-summary-card.self-excluded {
    background: rgba(239, 68, 68, 0.05);
}

.problem-summary-card.duplicates {
    background: rgba(249, 115, 22, 0.05);
}

.problem-summary-card.disabled {
    background: rgba(148, 163, 184, 0.05);
}

.problem-summary-card.frozen {
    background: rgba(6, 182, 212, 0.05);
}

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

.problem-tab {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.problem-tab:hover {
    background: var(--bg-tertiary);
}

.problem-tab.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

.problems-list {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
}

.problems-table {
    width: 100%;
    border-collapse: collapse;
}

.problems-table th,
.problems-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.problems-table th {
    background: var(--bg-tertiary);
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.no-problems {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    text-align: center;
    color: var(--text-secondary);
}

.no-problems .icon {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

/* Clickable problem player rows */
.problem-player-row.clickable {
    cursor: pointer;
    transition: background 0.2s;
}

.problem-player-row.clickable:hover {
    background: var(--bg-tertiary);
}

.problem-player-row .player-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.problem-player-row .player-name {
    font-weight: 600;
    color: var(--text-primary);
}

.problem-player-row .player-email {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

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

.problem-player-modal .modal-content {
    background: var(--bg-card);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    max-width: 700px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    padding: 1.5rem;
    position: relative;
    animation: slideUp 0.3s ease;
}

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

.problem-player-modal .modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    line-height: 1;
    padding: 0.25rem;
    border-radius: 4px;
    transition: all 0.2s;
}

.problem-player-modal .modal-close:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.problem-player-modal h3 {
    margin: 0 0 0.25rem 0;
    font-size: 1.3rem;
    color: var(--text-primary);
}

.problem-player-modal .player-email-subtitle {
    margin: 0 0 1.5rem 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.modal-details-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

@media (max-width: 600px) {
    .modal-details-grid {
        grid-template-columns: 1fr;
    }
}

.modal-section {
    background: var(--bg-tertiary);
    border-radius: 10px;
    padding: 1rem;
}

.modal-section h4 {
    margin: 0 0 0.75rem 0;
    font-size: 0.9rem;
    color: var(--accent-primary);
}

.modal-section .detail-row {
    display: flex;
    justify-content: space-between;
    padding: 0.35rem 0;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-section .detail-row:last-of-type {
    border-bottom: none;
}

.modal-section .detail-row span {
    color: var(--text-secondary);
}

.modal-section .detail-row strong {
    color: var(--text-primary);
}

.modal-section .problem-yes {
    color: var(--accent-red) !important;
}

.modal-section .btn-small {
    margin-top: 0.75rem;
    padding: 0.4rem 0.75rem;
    background: var(--accent-primary);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.2s;
}

.modal-section .btn-small:hover {
    background: var(--accent-secondary);
}

/* New Badge for sidebar */
.new-badge {
    background: var(--accent-orange) !important;
    color: white !important;
    font-size: 0.6rem !important;
    padding: 0.15rem 0.4rem !important;
    border-radius: 3px !important;
    animation: pulse-new 2s infinite;
}

@keyframes pulse-new {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Discovered Sources in View Modal */
.discovered-sources-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.load-more-sources-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.75rem;
    margin-bottom: 1rem;
}

.discovered-source-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

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

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

.source-domain-name {
    font-weight: 600;
    color: var(--accent-blue);
    font-size: 0.9rem;
    word-break: break-all;
}

.source-discovered-date {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.source-stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}

.source-stat-item {
    text-align: center;
}

.source-stat-item .stat-number {
    display: block;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.source-stat-item .stat-desc {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.sources-note {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-align: center;
    margin: 0;
    padding-top: 0.5rem;
}

.sources-note a {
    color: var(--accent-blue);
    text-decoration: none;
}

.sources-note a:hover {
    text-decoration: underline;
}

/* Responsive adjustments for Reports */
@media (max-width: 1200px) {
    .overview-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .commission-details {
        grid-template-columns: 1fr 1fr;
    }
    
    .problems-summary {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .reports-header {
        flex-direction: column;
        gap: 1rem;
    }
    
    .reports-header-right {
        width: 100%;
        flex-wrap: wrap;
    }
    
    .overview-stats-grid {
        grid-template-columns: 1fr;
    }
    
    .overview-charts-row {
        grid-template-columns: 1fr;
    }
    
    .sources-summary {
        grid-template-columns: 1fr;
    }
    
    .commission-summary {
        grid-template-columns: 1fr;
    }
    
    .commission-details {
        grid-template-columns: 1fr;
    }
    
    .problems-summary {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .reports-tabs {
        padding: 0 1rem;
    }
    
    .reports-tab {
        padding: 0.75rem 1rem;
        font-size: 0.8rem;
    }
}

/* ============================================
   HOMEPAGE - Operations Hub
   ============================================ */

.homepage-container {
    padding: 1.5rem;
    max-width: 1600px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.homepage-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem;
    gap: 1rem;
    color: var(--text-secondary);
}

.homepage-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem;
    gap: 1rem;
}

.homepage-error .error-icon {
    font-size: 3rem;
}

/* Welcome Header */
.homepage-welcome {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem 2.5rem;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15) 0%, rgba(6, 182, 212, 0.1) 50%, rgba(139, 92, 246, 0.1) 100%);
    border: 1px solid rgba(16, 185, 129, 0.25);
    border-radius: 20px;
    animation: fadeInUp 0.5s ease;
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(16, 185, 129, 0.1);
}

.homepage-welcome::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 200%;
    background: radial-gradient(circle, rgba(16, 185, 129, 0.1) 0%, transparent 70%);
    animation: float 8s ease-in-out infinite;
}

.homepage-welcome::after {
    content: '';
    position: absolute;
    bottom: -50%;
    left: -30%;
    width: 80%;
    height: 150%;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.08) 0%, transparent 70%);
    animation: float 10s ease-in-out infinite reverse;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    50% { transform: translate(20px, -20px) rotate(5deg); }
}

.welcome-text {
    position: relative;
    z-index: 1;
}

.welcome-text h1 {
    font-size: 1.75rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent-primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.25rem;
}

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

.welcome-actions {
    position: relative;
    z-index: 1;
}

.welcome-text h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    background: linear-gradient(135deg, var(--accent-green), var(--accent-cyan));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.welcome-subtitle {
    color: var(--text-secondary);
    margin: 0.5rem 0 0;
    font-size: 0.95rem;
}

.btn-homepage-action {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 10px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-homepage-action.primary {
    background: var(--gradient-1);
    color: white;
}

.btn-homepage-action.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.3);
}

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

/* Module Cards Grid */
.homepage-modules {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}

.module-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem;
    background: rgba(20, 26, 35, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(16, 185, 129, 0.12);
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.module-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    border-radius: 4px 0 0 4px;
    transition: width 0.3s ease;
}

.module-card::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: conic-gradient(
        from 180deg,
        transparent 0deg,
        rgba(16, 185, 129, 0.03) 60deg,
        rgba(6, 182, 212, 0.05) 120deg,
        transparent 180deg
    );
    animation: aurora-rotate 20s linear infinite;
    pointer-events: none;
    z-index: 0;
}

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

.module-card > * {
    position: relative;
    z-index: 1;
}

.module-card.affiliation::before { background: var(--accent-cyan); }
.module-card.retention::before { background: var(--accent-purple); }
.module-card.events::before { background: var(--accent-yellow); }
.module-card.invoices::before { background: var(--accent-orange); }
.module-card.team::before { background: var(--accent-blue); }
.module-card.ai::before { background: linear-gradient(180deg, var(--accent-pink), var(--accent-purple)); }

.module-card:hover {
    transform: translateY(-4px);
    border-color: rgba(16, 185, 129, 0.25);
    box-shadow: 0 8px 32px rgba(16, 185, 129, 0.1);
}

.module-card:hover::before {
    width: 6px;
}

.module-card.affiliation:hover {
    box-shadow: 0 12px 40px rgba(6, 182, 212, 0.2);
}

.module-card.retention:hover {
    box-shadow: 0 12px 40px rgba(139, 92, 246, 0.2);
}

.module-card.events:hover {
    box-shadow: 0 12px 40px rgba(245, 158, 11, 0.2);
}

.module-card.invoices:hover {
    box-shadow: 0 12px 40px rgba(249, 115, 22, 0.2);
}

.module-card.team:hover {
    box-shadow: 0 12px 40px rgba(59, 130, 246, 0.2);
}

[data-theme="light"] .module-card {
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(5, 150, 105, 0.1);
}

.module-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--text-secondary);
}

.module-icon svg {
    width: 28px;
    height: 28px;
}

.module-icon.glow {
    animation: pulse 2s infinite;
}

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

.module-content h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.5rem;
}

.module-stats {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}

.module-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-green);
}

.module-stat-value.warning {
    color: var(--accent-orange);
}

.module-stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.module-highlight {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.highlight-value {
    color: var(--accent-cyan);
    font-weight: 600;
}

.module-highlight.online {
    color: var(--accent-green);
}

.online-dot {
    width: 8px;
    height: 8px;
    background: var(--accent-green);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.module-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.module-badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 0.25rem;
}

.module-badge.dev {
    background: rgba(139, 92, 246, 0.15);
    color: var(--accent-purple);
    border: 1px solid rgba(139, 92, 246, 0.3);
}

.module-badge.beta {
    background: rgba(236, 72, 153, 0.15);
    color: var(--accent-pink);
    border: 1px solid rgba(236, 72, 153, 0.3);
}

.module-arrow {
    font-size: 1.5rem;
    color: var(--text-muted);
    transition: transform 0.2s ease, color 0.2s ease;
}

.module-card:hover .module-arrow {
    transform: translateX(5px);
    color: var(--text-primary);
}

/* Main Content Grid */
.homepage-main-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.homepage-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
}

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

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

/* Activity Feed */
.activity-list {
    max-height: 400px;
    overflow-y: auto;
}

.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s ease;
}

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

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

.activity-item.clickable {
    cursor: pointer;
}

.activity-item.clickable:hover {
    background: rgba(139, 92, 246, 0.1);
    border-left-color: var(--accent-purple);
}

.activity-arrow {
    color: var(--text-muted);
    font-size: 1rem;
    opacity: 0;
    transition: opacity 0.2s, transform 0.2s;
    align-self: center;
}

.activity-item.clickable:hover .activity-arrow {
    opacity: 1;
    transform: translateX(3px);
}

.activity-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

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

.activity-text {
    display: block;
    font-size: 0.9rem;
    color: var(--text-primary);
    line-height: 1.4;
}

.activity-meta {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.25rem;
    font-size: 0.75rem;
}

.activity-module {
    color: var(--accent-cyan);
}

.activity-time {
    color: var(--text-muted);
}

.activity-empty {
    padding: 3rem;
    text-align: center;
    color: var(--text-secondary);
}

.activity-empty .empty-icon {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 1rem;
}

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

/* AI Quick Chat */
.ai-quick-content {
    padding: 1.25rem;
}

.ai-quick-prompts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.ai-quick-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.8rem;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ai-quick-btn:hover {
    background: var(--bg-secondary);
    border-color: var(--accent-purple);
    color: var(--text-primary);
    transform: translateX(3px);
}

.ai-quick-input-wrapper {
    display: flex;
    gap: 0.5rem;
}

.ai-quick-input-wrapper input {
    flex: 1;
    padding: 0.75rem 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.ai-quick-input-wrapper input:focus {
    outline: none;
    border-color: var(--accent-purple);
}

.ai-quick-send {
    padding: 0.75rem 1rem;
    background: var(--gradient-2);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.ai-quick-send:hover {
    transform: scale(1.05);
}

/* Status Bar */
.homepage-status-bar {
    display: flex;
    justify-content: center;
    gap: 2rem;
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    font-size: 0.8rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.status-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
}

.status-label {
    opacity: 0.7;
}

.version-badge {
    background: linear-gradient(135deg, var(--accent-purple) 0%, var(--accent-pink) 100%);
    color: white;
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.7rem;
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3);
}

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

.status-dot.green {
    background: var(--accent-green);
    box-shadow: 0 0 10px var(--accent-green);
}

.status-label {
    color: var(--text-muted);
}

/* Nav dev badge */
.nav-link-dev {
    position: relative;
}

.nav-dev-badge {
    position: relative;
    margin-left: auto;
    margin-right: 1.75rem;
    background: rgba(139, 92, 246, 0.2);
    color: var(--accent-purple);
    font-size: 0.55rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

/* Country code badge */
.country-code {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: help;
}

/* Responsive homepage */
@media (max-width: 1024px) {
    .homepage-main-grid {
        grid-template-columns: 1fr;
    }
    
    .homepage-modules {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .homepage-welcome {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .homepage-modules {
        grid-template-columns: 1fr;
    }
    
    .homepage-status-bar {
        flex-direction: column;
        align-items: center;
        gap: 0.5rem;
    }
    
    .ai-quick-prompts-grid {
        grid-template-columns: 1fr;
    }
}


/* ============================================
   TRAFFIC SOURCES PAGE
   ============================================ */

.sources-page {
    padding: 1.5rem;
    max-width: 1400px;
    margin: 0 auto;
}

.sources-page-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem;
    gap: 1rem;
    color: var(--text-secondary);
}

.sources-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem;
    gap: 1rem;
    text-align: center;
}

.sources-error .error-icon {
    font-size: 3rem;
}

/* Sources Header */
.sources-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.sources-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.sources-subtitle {
    color: var(--text-secondary);
    margin: 0.25rem 0 0;
    font-size: 0.9rem;
}

.btn-sync {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-sync:hover {
    background: var(--accent-cyan);
    color: white;
    border-color: var(--accent-cyan);
}

/* Summary Cards */
.sources-summary-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.source-summary-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
}

.summary-icon {
    font-size: 2rem;
}

.summary-content {
    display: flex;
    flex-direction: column;
}

.summary-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-cyan);
}

.summary-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Controls */
.sources-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
}

.sources-filters {
    display: flex;
    gap: 1rem;
}

.sources-filters .filter-group select,
.sources-filters .filter-group input {
    padding: 0.6rem 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.9rem;
    min-width: 180px;
}

.sources-filters .filter-group input:focus,
.sources-filters .filter-group select:focus {
    outline: none;
    border-color: var(--accent-cyan);
}

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

.group-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-right: 0.5rem;
}

.group-btn {
    padding: 0.5rem 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.group-btn.active {
    background: var(--accent-cyan);
    color: white;
    border-color: var(--accent-cyan);
}

/* Sources Table */
.sources-table-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    overflow: hidden;
}

.sources-table {
    width: 100%;
    border-collapse: collapse;
}

.sources-table th {
    padding: 1rem;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.sources-table th.sortable {
    cursor: pointer;
    user-select: none;
}

.sources-table th.sortable:hover {
    color: var(--accent-cyan);
}

.sources-table td {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 0.9rem;
}

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

.sources-table tr.unknown-source {
    opacity: 0.7;
}

.source-domain-link {
    color: var(--accent-cyan);
    text-decoration: none;
    transition: color 0.2s ease;
}

.source-domain-link:hover {
    color: var(--accent-blue);
    text-decoration: underline;
}

.source-unknown {
    color: var(--text-muted);
    font-style: italic;
}

.source-partner-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: var(--bg-tertiary);
    border-radius: 4px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.source-count {
    font-weight: 600;
}

.source-ftd-count {
    color: var(--text-muted);
}

.source-ftd-count.has-ftd {
    color: var(--accent-green);
    font-weight: 600;
}

.conversion-rate {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.conversion-rate.ok {
    color: var(--accent-yellow);
}

.conversion-rate.good {
    color: var(--accent-green);
    font-weight: 600;
}

.source-volume {
    color: var(--text-muted);
}

.source-volume.has-volume {
    color: var(--accent-green);
    font-weight: 600;
}

.btn-view-players {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.4rem 0.6rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-view-players:hover {
    background: var(--accent-cyan);
    border-color: var(--accent-cyan);
}

.no-sources {
    text-align: center;
    padding: 3rem !important;
    color: var(--text-muted);
}

/* Footer */
.sources-footer {
    text-align: center;
    padding: 1rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Responsive */
@media (max-width: 1024px) {
    .sources-summary-cards {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .sources-summary-cards {
        grid-template-columns: 1fr;
    }
    
    .sources-controls {
        flex-direction: column;
        gap: 1rem;
    }
    
    .sources-filters {
        width: 100%;
        flex-direction: column;
    }
    
    .sources-filters .filter-group select,
    .sources-filters .filter-group input {
        width: 100%;
    }
    
    .sources-group-controls {
        width: 100%;
        justify-content: center;
    }
    
    .sources-table-container {
        overflow-x: auto;
    }
}

/* Sources Page Header */
.sources-page .sources-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.sources-header-left h2 {
    font-size: 1.75rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.25rem;
}

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

.sources-header-right .btn-sync {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.sources-header-right .btn-sync:hover {
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
}

/* Time Filters Bar */
.sources-time-filters {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.time-filter-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
}

.time-filter-buttons {
    display: flex;
    gap: 0.5rem;
}

/* Time Filter Buttons */
.time-filter-group {
    display: flex;
    gap: 0.5rem;
    margin-right: 1rem;
}

.time-btn {
    padding: 0.5rem 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.time-btn.active {
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
    color: white;
    border-color: transparent;
    font-weight: 600;
}

/* Custom Date Range Picker */
.custom-date-picker {
    display: none;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-left: auto;
}

.custom-date-picker.visible {
    display: flex;
}

.custom-date-picker input[type="date"] {
    padding: 0.5rem 0.6rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.85rem;
}

.custom-date-picker input[type="date"]:focus {
    outline: none;
    border-color: var(--accent-cyan);
    box-shadow: 0 0 0 2px rgba(6, 182, 212, 0.15);
}

.custom-date-picker span {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Reset Button */
.reset-btn {
    padding: 0.5rem 0.75rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-muted);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.reset-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--accent-red);
    color: var(--accent-red);
}

/* Source Dates */
.source-dates {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Sources Header Enhancement */
.sources-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
}

.sources-title-section h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sources-title-section p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.sources-quick-actions {
    display: flex;
    gap: 0.75rem;
}

.btn-refresh-sources,
.btn-export-sources {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-refresh-sources:hover,
.btn-export-sources:hover {
    background: var(--bg-card);
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
}

/* Sources Insights Panel */
.sources-insights {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.insight-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
    position: relative;
    overflow: hidden;
}

.insight-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
}

.insight-card.top-performer::before {
    background: linear-gradient(90deg, var(--accent-green), var(--accent-cyan));
}

.insight-card.needs-attention::before {
    background: linear-gradient(90deg, var(--accent-orange), var(--accent-yellow));
}

.insight-card.trending::before {
    background: linear-gradient(90deg, var(--accent-blue), var(--accent-purple));
}

.insight-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.insight-title {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.insight-icon {
    font-size: 1.25rem;
}

.insight-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.insight-label {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.insight-trend {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.8rem;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    margin-left: 0.5rem;
}

.insight-trend.up {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-green);
}

.insight-trend.down {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-red);
}

/* Sort Indicator */
.sort-indicator {
    margin-left: 0.5rem;
    font-size: 0.75rem;
}

/* Enhanced Table Row Styles */
.sources-table tr.top-source {
    background: rgba(16, 185, 129, 0.05);
}

.sources-table tr.top-source td:first-child {
    position: relative;
}

.sources-table tr.top-source td:first-child::before {
    content: '🏆';
    position: absolute;
    left: 0.25rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.9rem;
}

/* Multiple Partners Badge */
.multiple-partners-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.5rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Source Type Tags */
.source-type-tag {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.source-type-tag.organic {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-green);
}

.source-type-tag.paid {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent-blue);
}

.source-type-tag.referral {
    background: rgba(139, 92, 246, 0.15);
    color: var(--accent-purple);
}

.source-type-tag.direct {
    background: rgba(249, 115, 22, 0.15);
    color: var(--accent-orange);
}

.source-type-tag.unknown {
    background: rgba(107, 114, 128, 0.15);
    color: var(--text-muted);
}

/* Loading Spinner for Sources */
.sources-page-loading,
.sources-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem;
    color: var(--text-muted);
}

.sources-page-loading .loading-spinner,
.sources-loading .spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-cyan);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

.sources-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem;
    text-align: center;
}

.sources-error .error-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.sources-error h3 {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.sources-error p {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

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

/* Filter Applied Badge */
.filter-applied-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(6, 182, 212, 0.1);
    border: 1px solid var(--accent-cyan);
    border-radius: 20px;
    font-size: 0.85rem;
    color: var(--accent-cyan);
    margin-bottom: 1rem;
}

.filter-applied-badge .clear-filter {
    background: none;
    border: none;
    color: var(--accent-cyan);
    cursor: pointer;
    font-size: 1rem;
    padding: 0;
    line-height: 1;
}

.filter-applied-badge .clear-filter:hover {
    color: var(--accent-red);
}

/* ============================================
   PARTNER SIGNALS SYSTEM
   ============================================ */

.signals-container {
    padding: 1.5rem;
    max-width: 1400px;
    margin: 0 auto;
}

.signals-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem;
    color: var(--text-muted);
}

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

/* Signals Header */
.signals-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
}

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

.signals-subtitle {
    color: var(--text-secondary);
    margin: 0.25rem 0 0;
    font-size: 0.9rem;
}

/* Quick Stats Cards */
.signals-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.signal-stat-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.signal-stat-card:hover {
    border-color: var(--accent-purple);
    transform: translateY(-2px);
}

.signal-stat-card.active {
    border-color: var(--accent-purple);
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(236, 72, 153, 0.05));
}

.signal-stat-card .stat-icon {
    font-size: 1.5rem;
    pointer-events: none;
}

.signal-stat-card .stat-content,
.signal-stat-card .stat-value,
.signal-stat-card .stat-label,
.signal-stat-card .urgent-badge {
    pointer-events: none;
}

.signal-stat-card .stat-content {
    display: flex;
    flex-direction: column;
}

.signal-stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
}

.signal-stat-card .stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.signal-stat-card .urgent-badge {
    margin-left: auto;
    padding: 0.25rem 0.5rem;
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-red);
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
}

/* New Partners Section */
.new-partners-section {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
}

.new-partners-section .section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.new-partners-section .section-header h3 {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin: 0;
}

.partners-view-toggle {
    display: flex;
    gap: 0.5rem;
    background: var(--bg-tertiary);
    padding: 0.25rem;
    border-radius: 8px;
}

.view-toggle-btn {
    padding: 0.5rem 1rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.view-toggle-btn.active {
    background: var(--accent-purple);
    color: white;
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3);
}

.no-partners {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.badge-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 0.5rem;
    background: var(--accent-green);
    color: white;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.new-partners-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.new-partner-card {
    padding: 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    transition: all 0.2s ease;
}

.new-partner-card:hover {
    border-color: var(--accent-purple);
}

.new-partner-card.has-signal {
    border-color: var(--accent-purple);
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.05), rgba(236, 72, 153, 0.02));
}

.partner-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.partner-card-header .partner-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.signal-indicator {
    font-size: 1rem;
}

.partner-card-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.mini-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.mini-stat .label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.mini-stat .value {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.mini-stat .value.good {
    color: var(--accent-green);
}

.mini-stat .value.ok {
    color: var(--accent-yellow);
}

.mini-stat .value.low {
    color: var(--accent-red);
}

.partner-card-geos {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 0.75rem;
}

.geo-badge-mini {
    padding: 0.15rem 0.4rem;
    background: rgba(139, 92, 246, 0.1);
    color: var(--accent-purple);
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
}

.partner-card-actions {
    display: flex;
    justify-content: center;
}

/* Signals List Section */
.signals-list-section {
    padding: 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
}

.signals-list-section .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.signals-list-section .section-header h3 {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin: 0;
}

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

.filter-pill {
    padding: 0.4rem 0.75rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-pill:hover {
    border-color: var(--accent-purple);
    color: var(--text-primary);
}

.filter-pill.active {
    background: var(--accent-purple);
    border-color: var(--accent-purple);
    color: white;
}

/* Signals List */
.signals-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.no-signals {
    padding: 3rem;
    text-align: center;
    color: var(--text-secondary);
}

.no-signals .empty-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 1rem;
}

.no-signals h4 {
    color: var(--text-primary);
    margin: 0 0 0.5rem;
}

.no-signals p {
    margin: 0 0 1.5rem;
}

/* Signal Card */
.signal-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.signal-card:hover {
    border-color: var(--accent-purple);
    transform: translateX(5px);
}

.signal-card.completed {
    opacity: 0.7;
}

.signal-card.cancelled {
    opacity: 0.5;
}

.signal-card-left {
    flex-shrink: 0;
}

.signal-type-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    font-size: 1.5rem;
}

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

.signal-card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.signal-partner-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 1rem;
}

.signal-type-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.signal-card-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.signal-card-meta .priority-badge {
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
}

.signal-card-meta .status-badge {
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: capitalize;
}

.status-badge.pending {
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent-yellow);
}

.status-badge.in_progress,
.status-badge.in-progress {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent-blue);
}

.status-badge.completed {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-green);
}

.status-badge.cancelled {
    background: rgba(107, 114, 128, 0.15);
    color: var(--text-muted);
}

.signal-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.signal-preview {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-style: italic;
}

.signal-promo-badge {
    display: inline-flex;
    align-items: center;
    margin-top: 0.5rem;
    padding: 0.2rem 0.5rem;
    background: rgba(236, 72, 153, 0.15);
    color: var(--accent-pink);
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* Signal Creator Info */
.signal-creator {
    margin-top: 0.4rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.signal-creator .creator-label {
    opacity: 0.7;
}

.signal-creator .creator-name {
    font-weight: 500;
    color: var(--text-secondary);
}

/* Signals Filters Container */
.signals-filters {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

@media (min-width: 768px) {
    .signals-filters {
        flex-direction: row;
        align-items: center;
        gap: 1rem;
    }
}

/* Time Filter Pills */
.time-filter-pills {
    display: flex;
    gap: 0.35rem;
}

.time-pill {
    padding: 0.3rem 0.6rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 15px;
    font-size: 0.7rem;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-muted);
}

.time-pill:hover {
    border-color: var(--accent-blue);
    color: var(--text-primary);
}

.time-pill.active {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
    color: white;
}

/* Modal footer with split buttons */
.modal-footer .footer-left,
.modal-footer .footer-right {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.modal-footer:has(.footer-left) {
    justify-content: space-between;
}

.signal-card-right {
    flex-shrink: 0;
}

.signal-arrow {
    font-size: 1.25rem;
    color: var(--text-muted);
    transition: transform 0.2s ease;
}

.signal-card:hover .signal-arrow {
    transform: translateX(5px);
    color: var(--accent-purple);
}

/* Create Signal Modal */
.signal-modal {
    max-width: 700px;
    width: 95%;
}

.signal-modal .modal-body {
    max-height: 70vh;
    overflow-y: auto;
}

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

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

.form-label.required::after {
    content: ' *';
    color: var(--accent-red);
}

.form-select,
.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.form-select:focus,
.form-input:focus {
    outline: none;
    border-color: var(--accent-purple);
}

.form-textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.95rem;
    resize: vertical;
    min-height: 100px;
    font-family: inherit;
}

.form-textarea:focus {
    outline: none;
    border-color: var(--accent-purple);
}

.form-hint {
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Partner Stats Preview */
.partner-stats-preview {
    margin-top: 0.75rem;
    padding: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.partner-stats-preview .stats-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.partner-stats-preview .stat-item {
    text-align: center;
}

.partner-stats-preview .stat-label {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 0.25rem;
}

.partner-stats-preview .stat-value {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.partner-stats-preview .stat-value.good {
    color: var(--accent-green);
}

.partner-stats-preview .partner-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Signal Type Grid */
.signal-type-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
}

.signal-type-option {
    cursor: pointer;
}

.signal-type-option input {
    display: none;
}

.signal-type-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 0.5rem;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    transition: all 0.2s ease;
}

.signal-type-card:hover {
    border-color: var(--type-color);
}

.signal-type-option input:checked + .signal-type-card {
    border-color: var(--type-color);
    background: color-mix(in srgb, var(--type-color) 10%, transparent);
}

.signal-type-card .type-icon {
    font-size: 1.75rem;
}

.signal-type-card .type-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
}

/* Priority Options */
.priority-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

.priority-option {
    cursor: pointer;
}

.priority-option input {
    display: none;
}

.priority-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 1rem;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    transition: all 0.2s ease;
}

.priority-card:hover {
    border-color: var(--priority-color);
}

.priority-option input:checked + .priority-card {
    border-color: var(--priority-color);
    background: color-mix(in srgb, var(--priority-color) 10%, transparent);
}

.priority-card .priority-icon {
    font-size: 1.5rem;
}

.priority-card .priority-label {
    font-weight: 600;
    color: var(--text-primary);
}

.priority-card .priority-deadline {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* Promo Section */
.promo-section {
    padding: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--accent-pink);
    border-radius: 8px;
}

.promo-fields {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Notification Options */
.notification-options {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.user-chip .user-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--accent-purple);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 600;
}

.user-chip .user-name {
    font-size: 0.8rem;
    color: var(--text-primary);
}

.user-chip .user-role {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: capitalize;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent-purple);
}

/* Modal Container Base */
.modal-container {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn 0.2s ease;
}

@keyframes modalSlideIn {
    from { 
        opacity: 0; 
        transform: scale(0.95) translateY(-10px); 
    }
    to { 
        opacity: 1; 
        transform: scale(1) translateY(0); 
    }
}

/* Signal Modal */
.signal-modal {
    max-width: 700px;
    width: 95%;
}

/* Signal Detail Modal */
.signal-detail-modal {
    max-width: 800px;
    width: 95%;
}

.signal-detail-modal .modal-header,
.signal-modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.signal-detail-modal .modal-body,
.signal-modal .modal-body {
    padding: 1.5rem;
    max-height: calc(90vh - 140px);
    overflow-y: auto;
}

.signal-detail-modal .modal-footer,
.signal-modal .modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
    position: sticky;
    bottom: 0;
}

.signal-detail-modal .modal-close,
.signal-modal .modal-close {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    cursor: pointer;
    border-radius: 8px;
    font-size: 1.5rem;
    font-weight: 300;
    transition: all 0.2s;
    flex-shrink: 0;
}

.signal-detail-modal .modal-close:hover,
.signal-modal .modal-close:hover {
    background: var(--accent-red);
    border-color: var(--accent-red);
    color: white;
}

.signal-detail-title {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.type-icon-large {
    font-size: 2rem;
}

.signal-detail-title h2 {
    margin: 0;
    font-size: 1.25rem;
}

.signal-detail-title .type-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Signal Status Bar */
.signal-status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--bg-tertiary);
    border-radius: 8px;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.signal-status-bar .status-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.signal-status-bar .status-item .label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.status-select {
    padding: 0.4rem 0.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.85rem;
}

/* Signal Section */
.signal-section {
    margin-bottom: 1.5rem;
}

.signal-section h4 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.75rem;
}

/* Partner Stats Grid */
.partner-stats-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.stat-box {
    text-align: center;
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border-radius: 8px;
}

.stat-box .stat-value {
    display: block;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-box .stat-label {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-top: 0.25rem;
}

.partner-geos {
    display: flex;
    gap: 0.5rem;
}

.geo-badge {
    padding: 0.25rem 0.5rem;
    background: rgba(139, 92, 246, 0.1);
    color: var(--accent-purple);
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Guidance Box */
.guidance-box {
    padding: 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-left: 3px solid var(--accent-purple);
    border-radius: 8px;
}

.guidance-author {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.guidance-author .author-name {
    font-weight: 600;
    color: var(--text-primary);
}

.guidance-author .author-time {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.guidance-text {
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Promo Request Box */
.promo-request-box {
    padding: 1rem;
    background: rgba(236, 72, 153, 0.05);
    border: 1px solid var(--accent-pink);
    border-radius: 8px;
}

.promo-detail {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.promo-detail:last-child {
    margin-bottom: 0;
}

.promo-detail .label {
    font-weight: 600;
    color: var(--text-primary);
    min-width: 80px;
}

.promo-detail .value {
    color: var(--text-secondary);
}

/* Response Form */
.response-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.actions-checklist {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.actions-checklist h5 {
    font-size: 0.85rem;
    color: var(--text-primary);
    margin: 0 0 0.5rem;
}

.action-checkbox {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.action-checkbox input {
    width: 18px;
    height: 18px;
    accent-color: var(--accent-green);
}

/* Quick Actions */
.quick-actions {
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
}

.quick-actions .action-buttons {
    display: flex;
    gap: 0.75rem;
}

/* Buttons */
.btn-small {
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-small.btn-primary {
    background: var(--gradient-2);
    border: none;
    color: white;
}

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

.btn-small:hover {
    transform: translateY(-1px);
}

.btn-success {
    background: var(--accent-green);
    border: none;
    color: white;
    padding: 0.6rem 1.25rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
}

.btn-success:hover {
    background: #059669;
}

.btn-show-more {
    width: 100%;
    margin-top: 1rem;
    padding: 0.6rem;
    text-align: center;
}

/* Sidebar Signal Count Badge */
.nav-badge.signal-count {
    min-width: 20px;
    height: 20px;
    padding: 0 0.4rem;
    background: var(--accent-red);
    color: white;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 700;
    margin-left: auto;
}

/* Responsive */
@media (max-width: 1200px) {
    .signals-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .new-partners-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .signal-type-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .partner-stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .partner-stats-preview .stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .signals-header {
        flex-direction: column;
        gap: 1rem;
    }
    
    .signals-stats {
        grid-template-columns: 1fr;
    }
    
    .new-partners-grid {
        grid-template-columns: 1fr;
    }
    
    .signal-type-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .priority-options {
        grid-template-columns: 1fr;
    }
    
    .partner-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .signal-status-bar {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .signals-list-section .section-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .filter-pills {
        flex-wrap: wrap;
    }
}

/* ============================================
   LOADING SKELETON - Performance
   ============================================ */

.loading-skeleton {
    padding: 1.5rem;
}

.skeleton-header {
    height: 40px;
    background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-card) 50%, var(--bg-tertiary) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.skeleton-row {
    height: 60px;
    background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-card) 50%, var(--bg-tertiary) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
    border-radius: 8px;
    margin-bottom: 0.75rem;
}

.skeleton-row:nth-child(2) { animation-delay: 0.1s; }
.skeleton-row:nth-child(3) { animation-delay: 0.2s; }
.skeleton-row:nth-child(4) { animation-delay: 0.3s; }

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

/* Loading overlay for buttons/sections */
.loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(12, 16, 23, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: inherit;
    z-index: 10;
}

.loading-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Fast fade-in for loaded content */
.fade-in {
    animation: fadeIn 0.2s ease-out;
}

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


/* ============================================
   AI RETENTION MODULE STYLES
   ============================================ */
.btn-sync {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-sync:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.btn-sync:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.btn-sync.syncing .sync-icon {
    animation: spin 1s linear infinite;
}

.btn-sync.patterns {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.btn-sync.patterns:hover:not(:disabled) {
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
}

/* Analyze Button */
.btn-analyze {
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    border: none;
    border-radius: 6px;
    padding: 0.4rem 0.6rem;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-analyze:hover:not(:disabled) {
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.4);
}

.btn-analyze.disabled,
.btn-analyze:disabled {
    background: linear-gradient(135deg, #4a4a4a, #3a3a3a);
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Load More Section */
.load-more-section {
    display: flex;
    justify-content: center;
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.btn-load-more {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
    border: none;
    padding: 0.75rem 2rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-load-more:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

/* Card Actions (for AI button in cards) */
.card-actions {
    display: flex;
    align-items: center;
    margin-left: auto;
    padding-left: 1rem;
}

.churn-card .card-actions,
.vip-card .card-actions,
.bonus-card .card-actions,
.no-deposit-card .card-actions {
    flex-shrink: 0;
    margin-left: 0.5rem;
}

/* Retention cards layout */
.churn-card,
.vip-card,
.bonus-card,
.no-deposit-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: nowrap;
}

/* Player info should fill available space */
.churn-player-info,
.vip-player-info,
.bonus-player-info,
.no-deposit-player-info {
    flex: 1;
    min-width: 0;
}

/* Stats should not shrink and have fixed min-width */
.churn-stats,
.vip-stats {
    flex-shrink: 0;
    min-width: 160px;
    display: flex;
    gap: 1.5rem;
}

/* Activity Display */
.activity-recent { color: #10b981; }
.activity-warning { color: #f59e0b; }
.activity-danger { color: #ef4444; font-weight: 600; }
.no-data { color: var(--text-muted); font-style: italic; }

/* AI Insight Modal */
.ai-insight-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.ai-insight-modal.active {
    opacity: 1;
    pointer-events: all;
}

.ai-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.ai-modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--surface-primary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
    max-width: 550px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.ai-modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
}

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

.ai-modal-header {
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.ai-modal-header h3 {
    margin: 0 0 0.25rem 0;
    font-size: 1.25rem;
}

.ai-player-id {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.ai-modal-loading {
    text-align: center;
    padding: 2rem;
}

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

.ai-risk-level {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 1.25rem;
    background: var(--surface-secondary);
}

.ai-risk-level .risk-value {
    font-weight: 700;
    font-size: 1.1rem;
}

.ai-risk-level.low { border-left: 4px solid #10b981; }
.ai-risk-level.low .risk-value { color: #10b981; }

.ai-risk-level.medium { border-left: 4px solid #f59e0b; }
.ai-risk-level.medium .risk-value { color: #f59e0b; }

.ai-risk-level.high { border-left: 4px solid #f97316; }
.ai-risk-level.high .risk-value { color: #f97316; }

.ai-risk-level.critical { border-left: 4px solid #ef4444; }
.ai-risk-level.critical .risk-value { color: #ef4444; }

.ai-section {
    margin-bottom: 1.25rem;
}

.ai-section h4 {
    margin: 0 0 0.5rem 0;
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.ai-section p {
    margin: 0;
    line-height: 1.6;
}

.ai-recommendations {
    margin: 0;
    padding-left: 1.25rem;
}

.ai-recommendations li {
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

.ai-summary {
    background: var(--surface-secondary);
    padding: 1rem;
    border-radius: 8px;
}

.ai-summary .summary-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    font-size: 0.85rem;
}

.ai-summary .summary-grid span {
    color: var(--text-muted);
}

/* Sync Progress Status */
.sync-progress-status {
    margin-top: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
}

.sync-progress-status .sync-running {
    color: var(--accent-cyan);
}

.sync-progress-status .sync-pending {
    color: var(--accent-yellow);
}

.sync-progress-status .sync-complete {
    color: var(--accent-green);
}

.sync-progress-status .sync-error {
    color: var(--accent-red);
}
.stat-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem;
    background: var(--surface-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
}

.stat-card .stat-icon {
    font-size: 2rem;
    min-width: 3rem;
    text-align: center;
}

.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-card .stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.stat-card.success { border-left: 4px solid #10b981; }
.stat-card.warning { border-left: 4px solid #f59e0b; }
.stat-card.info { border-left: 4px solid #6366f1; }
.financial-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
}

.financial-card {
    padding: 1rem;
    background: var(--surface-primary);
    border-radius: 8px;
    text-align: center;
}

.financial-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.financial-value {
    font-size: 1.25rem;
    font-weight: 700;
}

.financial-value.warning { color: #f59e0b; }

.quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.action-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--surface-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    width: 100%;
}

.action-card:hover {
    border-color: var(--accent-primary);
}

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

.action-text {
    flex: 1;
    font-weight: 500;
    color: var(--text-primary);
}

.action-badge {
    background: var(--accent-primary);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
}
.notice-icon { font-size: 1.2rem; }
.notice-content { color: var(--text-secondary); line-height: 1.5; }

.players-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.players-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 1rem;
    background: var(--surface-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    align-items: center;
}

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

.filter-group.custom-date-range {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-group.custom-date-range input[type="date"] {
    padding: 0.5rem 0.75rem;
    background: var(--surface-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.85rem;
}

.filter-group label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.filter-group select,
.filter-group input {
    padding: 0.5rem 0.75rem;
    background: var(--surface-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
}

.search-group input { min-width: 200px; }
.filter-stats { margin-left: auto; font-size: 0.85rem; color: var(--text-muted); }

.players-table-container {
    overflow-x: auto;
    background: var(--surface-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.players-table { width: 100%; border-collapse: collapse; }

.players-table th {
    padding: 0.875rem 1rem;
    text-align: left;
    background: var(--surface-tertiary);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--border-color);
}

.players-table th.sortable { cursor: pointer; }
.players-table th.sortable:hover { color: var(--accent-primary); }

.players-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
}

.players-table tr:hover { background: var(--surface-tertiary); }
.players-table tr.disabled-row { opacity: 0.6; }

.player-email {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.status-badge {
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
}

.status-badge.disabled { background: rgba(239, 68, 68, 0.2); color: #ef4444; }
.status-badge.frozen { background: rgba(59, 130, 246, 0.2); color: #3b82f6; }

.players-table td.positive { color: #10b981; font-weight: 600; }
.empty-row { text-align: center; color: var(--text-muted); padding: 2rem !important; }
.table-note { padding: 0.75rem; text-align: center; font-size: 0.85rem; color: var(--text-muted); }

.risk-badge, .vip-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
}

.risk-badge.critical { background: rgba(239, 68, 68, 0.2); color: #ef4444; }
.risk-badge.warning { background: rgba(245, 158, 11, 0.2); color: #f59e0b; }
.risk-badge.low { background: rgba(16, 185, 129, 0.2); color: #10b981; }

.vip-badge.platinum { background: linear-gradient(135deg, rgba(139, 92, 246, 0.3), rgba(99, 102, 241, 0.3)); color: #a78bfa; }
.vip-badge.gold { background: rgba(245, 158, 11, 0.2); color: #f59e0b; }
.vip-badge.silver { background: rgba(156, 163, 175, 0.2); color: #9ca3af; }
.vip-badge.none { color: var(--text-muted); }

.section-header { margin-bottom: 1.5rem; }
.section-header h3 { margin: 0 0 0.25rem 0; font-size: 1.25rem; }
.section-header p { margin: 0; color: var(--text-muted); font-size: 0.9rem; }

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 3rem;
    text-align: center;
    background: var(--surface-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
}

.empty-state .empty-icon { font-size: 3rem; margin-bottom: 1rem; }
.empty-state h4 { margin: 0 0 0.5rem 0; }
.empty-state p { margin: 0; color: var(--text-muted); }

.churn-list, .vip-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.churn-card, .vip-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--surface-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
}

.churn-card.critical { border-left: 4px solid #ef4444; }
.churn-card.warning { border-left: 4px solid #f59e0b; }
.churn-card.moderate { border-left: 4px solid #6366f1; }

.vip-card.platinum { border-left: 4px solid #8b5cf6; }
.vip-card.gold { border-left: 4px solid #f59e0b; }
.vip-card.silver { border-left: 4px solid #9ca3af; }

.churn-risk-indicator, .vip-score-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 60px;
}

.risk-score, .vip-score { font-size: 1.5rem; font-weight: 700; }
.risk-label, .vip-label { font-size: 0.75rem; color: var(--text-muted); }

.churn-player-info, .vip-player-info { flex: 1; min-width: 0; }
.churn-player-info .player-email, .vip-player-info .player-email {
    font-weight: 600;
    margin-bottom: 0.25rem;
    word-break: break-all;
}

.player-meta {
    display: flex;
    gap: 0.75rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.churn-stats, .vip-stats { display: flex; gap: 1.5rem; }
.churn-stats .stat, .vip-stats .stat { text-align: center; }
.churn-stats .stat-label, .vip-stats .stat-label { display: block; font-size: 0.75rem; color: var(--text-muted); margin-bottom: 0.25rem; }
.churn-stats .stat-value, .vip-stats .stat-value { font-size: 1rem; font-weight: 600; }
.vip-stats .stat.highlight .stat-value { color: #10b981; }

.no-deposit-section { display: flex; flex-direction: column; gap: 1.5rem; }

.no-deposit-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
}

.summary-card {
    padding: 1.25rem;
    background: var(--surface-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    text-align: center;
}

.summary-card.hot { border-top: 4px solid #ef4444; }
.summary-card.warm { border-top: 4px solid #f59e0b; }
.summary-card.cold { border-top: 4px solid #6b7280; }

.summary-count { font-size: 2rem; font-weight: 700; }
.summary-label { font-weight: 600; margin: 0.25rem 0; }
.summary-note { font-size: 0.8rem; color: var(--text-muted); }

.subsection-title { margin: 1rem 0 0.75rem 0; font-size: 1rem; }
.no-items { color: var(--text-muted); font-style: italic; padding: 1rem; }

.no-deposit-list { display: flex; flex-direction: column; gap: 0.5rem; }

.no-deposit-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem 1rem;
    background: var(--surface-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.days-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 50px;
    padding: 0.5rem;
    background: var(--surface-tertiary);
    border-radius: 6px;
}

.days-indicator .days { font-size: 1.25rem; font-weight: 700; }
.days-indicator .label { font-size: 0.7rem; color: var(--text-muted); }

.no-deposit-card .player-info { flex: 1; }
.no-deposit-card .player-email { font-weight: 500; margin-bottom: 0.25rem; word-break: break-all; }
.no-deposit-card .player-meta { font-size: 0.8rem; color: var(--text-muted); }


/* Player Types Grid */
.player-types-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.type-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem;
    background: var(--surface-primary);
    border-radius: 10px;
    border-left: 4px solid var(--border-color);
}

.type-card.slots { border-left-color: #f59e0b; }
.type-card.sports { border-left-color: #10b981; }
.type-card.hybrid { border-left-color: #8b5cf6; }
.type-card.unknown { border-left-color: #6b7280; }

.type-card .type-icon {
    font-size: 2rem;
}

.type-card .type-info {
    flex: 1;
}

.type-card .type-count {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
}

.type-card .type-label {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.type-card .type-amount {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Type badges for table */
.type-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
}

.type-badge.slots {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
}

.type-badge.sports {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
}

.type-badge.hybrid {
    background: rgba(139, 92, 246, 0.2);
    color: #a78bfa;
}

.type-badge.poker {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.type-badge.unknown {
    background: rgba(107, 114, 128, 0.2);
    color: #6b7280;
}

/* Financial value colors */
.financial-value.positive { color: #10b981; }
.financial-value.negative { color: #ef4444; }

.players-table td.negative { color: #ef4444; }
/* ============================================
   SEGMENTS GRID - Player breakdown
   ============================================ */

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

.segment-card {
    padding: 1.25rem;
    background: var(--surface-primary);
    border-radius: 12px;
    border-left: 4px solid var(--border-color);
    text-align: center;
}

.segment-card.depositors { border-left-color: #10b981; }
.segment-card.bonus-players { 
    border-left-color: #ef4444; 
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.05), rgba(245, 158, 11, 0.05));
}
.segment-card.never-played { border-left-color: #6b7280; }
.segment-card.vip { border-left-color: #8b5cf6; }

.segment-header {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.segment-value {
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.segment-breakdown {
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.breakdown-item {
    display: inline-block;
    margin: 0 0.25rem;
    padding: 0.125rem 0.5rem;
    background: var(--surface-tertiary);
    border-radius: 4px;
}

.breakdown-item.hot {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    font-weight: 600;
}

/* Type breakdown inside cards */
.type-breakdown {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.75rem;
    margin-top: 0.5rem;
}

.type-breakdown .depositor { color: #10b981; }
.type-breakdown .bonus { color: #ef4444; }

/* ============================================
   HOT ELEMENTS - Attention grabbing
   ============================================ */
.action-card.hot {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(245, 158, 11, 0.1));
    border-color: rgba(239, 68, 68, 0.3);
}

.action-card.hot:hover {
    border-color: #ef4444;
}

.action-badge.hot {
    background: linear-gradient(135deg, #ef4444, #f59e0b);
    animation: pulse-badge 2s infinite;
}

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

.section-header.hot {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(245, 158, 11, 0.1));
    padding: 1rem;
    border-radius: 8px;
    border-left: 4px solid #ef4444;
}

/* ============================================
   BONUS PLAYERS SECTION
   ============================================ */

.bonus-players-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.bonus-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
}

.bonus-summary .summary-card.slots { border-top-color: #f59e0b; }
.bonus-summary .summary-card.sports { border-top-color: #10b981; }
.bonus-summary .summary-card.hybrid { border-top-color: #8b5cf6; }

.bonus-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.bonus-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem 1rem;
    background: var(--surface-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    border-left: 4px solid var(--border-color);
}

.bonus-card.slots { border-left-color: #f59e0b; }
.bonus-card.sports { border-left-color: #10b981; }
.bonus-card.hybrid { border-left-color: #8b5cf6; }

.activity-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 60px;
    padding: 0.5rem;
    background: var(--surface-tertiary);
    border-radius: 6px;
}

.activity-indicator .activity {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.activity-indicator .label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

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

.bonus-card .player-email {
    font-weight: 500;
    margin-bottom: 0.25rem;
    word-break: break-all;
}

.bonus-card .player-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.bonus-stats {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.25rem;
    font-size: 0.75rem;
}

.bonus-stats span {
    padding: 0.125rem 0.375rem;
    background: var(--surface-tertiary);
    border-radius: 4px;
}

/* ============================================
   AI RETENTION CRM - COMPLETE SYSTEM
   ============================================ */
.btn-action {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-action.generate {
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    color: white;
}

.btn-action.sync {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

.btn-action:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.btn-action:disabled,
.btn-action.loading {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}
.nav-tab {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: transparent;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.nav-tab:hover {
    background: var(--surface-tertiary);
    color: var(--text-primary);
}

.nav-tab.active {
    background: var(--accent-primary);
    color: white;
}

.nav-tab .tab-badge {
    background: rgba(255, 255, 255, 0.2);
    padding: 0.125rem 0.5rem;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
}

.nav-tab:not(.active) .tab-badge {
    background: var(--danger-bg);
    color: var(--danger-color);
}
/* Loading & Error States */
.loading-state,
.error-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: var(--text-muted);
}

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

.error-state .error-icon { font-size: 2rem; margin-bottom: 0.5rem; }

.btn-retry {
    margin-top: 1rem;
    padding: 0.5rem 1rem;
    background: var(--accent-primary);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

.empty-state {
    text-align: center;
    padding: 3rem;
}

.empty-state .empty-icon { font-size: 3rem; margin-bottom: 1rem; }
.empty-state h3 { margin: 0 0 0.5rem; }
.empty-state p { color: var(--text-muted); margin-bottom: 1rem; }

/* ============================================
   AI SIGNALS TAB
   ============================================ */

.signals-tab {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.signals-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
}

.summary-stat {
    background: var(--surface-secondary);
    padding: 1rem;
    border-radius: 10px;
    text-align: center;
    border-left: 4px solid var(--border-color);
}

.summary-stat.urgent { border-left-color: #ef4444; }
.summary-stat.pending { border-left-color: #f59e0b; }
.summary-stat.success { border-left-color: #10b981; }
.summary-stat.failed { border-left-color: #ef4444; }

.summary-stat .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
}

.summary-stat .stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

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

.signal-card {
    background: var(--surface-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
    position: relative;
    transition: all 0.2s;
}

.signal-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.signal-card.new { border-left: 4px solid var(--accent-primary); }
.signal-card.red { border-top: 3px solid #ef4444; }
.signal-card.orange { border-top: 3px solid #f97316; }
.signal-card.yellow { border-top: 3px solid #f59e0b; }
.signal-card.green { border-top: 3px solid #10b981; }
.signal-card.purple { border-top: 3px solid #8b5cf6; }
.signal-card.blue { border-top: 3px solid #3b82f6; }
.signal-card.pink { border-top: 3px solid #ec4899; }

.signal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.signal-priority {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
}

.signal-status {
    font-size: 0.7rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    text-transform: uppercase;
    font-weight: 600;
}

.signal-status.new { background: var(--accent-primary); color: white; }
.signal-status.viewed { background: var(--surface-tertiary); color: var(--text-secondary); }
.signal-status.in_progress { background: #f59e0b; color: white; }
.signal-status.actioned { background: #10b981; color: white; }
.signal-status.dismissed { background: var(--surface-tertiary); color: var(--text-muted); }

.signal-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 0.5rem;
}

.signal-description {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin: 0 0 1rem;
}

.signal-stats {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1rem;
}

.signal-stats .stat {
    text-align: center;
}

.signal-stats .stat-value {
    font-size: 1.25rem;
    font-weight: 700;
}

.signal-stats .stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.signal-recommendation {
    background: var(--surface-tertiary);
    padding: 0.75rem;
    border-radius: 8px;
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.signal-recommendation strong { color: var(--accent-primary); }
.signal-recommendation small { color: var(--text-muted); }

.signal-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.btn-signal {
    flex: 1;
    min-width: 80px;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--surface-primary);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-signal:hover { background: var(--surface-tertiary); }
.btn-signal.view:hover { border-color: #3b82f6; color: #3b82f6; }
.btn-signal.action:hover { border-color: #10b981; color: #10b981; }
.btn-signal.campaign:hover { border-color: #8b5cf6; color: #8b5cf6; }
.btn-signal.dismiss { flex: 0; min-width: 36px; color: var(--text-muted); }
.btn-signal.dismiss:hover { border-color: #ef4444; color: #ef4444; }

/* ============================================
   ACTIONS TAB
   ============================================ */

.actions-tab {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.actions-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
}

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

.actions-header h3 { margin: 0; }

.btn-check-outcomes {
    padding: 0.5rem 1rem;
    background: var(--surface-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-check-outcomes:hover {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

.actions-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.action-card {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    background: var(--surface-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    border-left: 4px solid var(--border-color);
}

.action-card.orange { border-left-color: #f59e0b; }
.action-card.green { border-left-color: #10b981; }
.action-card.red { border-left-color: #ef4444; }
.action-card.gray { border-left-color: var(--text-muted); }

.action-status-badge {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    white-space: nowrap;
}

.action-status-badge.pending_result { background: #fef3c7; color: #92400e; }
.action-status-badge.success { background: #d1fae5; color: #065f46; }
.action-status-badge.failed { background: #fee2e2; color: #991b1b; }
.action-status-badge.inconclusive { background: var(--surface-tertiary); color: var(--text-muted); }

.action-main { flex: 1; }

.action-player {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.action-player strong { font-size: 0.95rem; }
.action-type { font-size: 0.8rem; color: var(--text-muted); }

.action-details {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.action-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.action-outcome,
.action-pending {
    padding: 0.75rem;
    border-radius: 8px;
    margin-top: 0.75rem;
    font-size: 0.85rem;
}

.action-outcome.success { background: rgba(16, 185, 129, 0.1); }
.action-outcome.failed { background: rgba(239, 68, 68, 0.1); }
.action-pending { background: var(--surface-tertiary); color: var(--text-muted); }

.action-outcome p { margin: 0.25rem 0 0; color: var(--text-secondary); }

/* ============================================
   CAMPAIGNS TAB
   ============================================ */

.campaigns-tab {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

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

.campaigns-header h3 { margin: 0; }

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

.campaign-card {
    background: var(--surface-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
    transition: all 0.2s;
}

.campaign-card:hover {
    border-color: var(--accent-primary);
}

.campaign-card.gray { border-top: 3px solid var(--text-muted); }
.campaign-card.blue { border-top: 3px solid #3b82f6; }
.campaign-card.orange { border-top: 3px solid #f59e0b; }
.campaign-card.green { border-top: 3px solid #10b981; }
.campaign-card.purple { border-top: 3px solid #8b5cf6; }

.campaign-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.campaign-status {
    font-size: 0.7rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    text-transform: uppercase;
    font-weight: 600;
}

.campaign-status.draft { background: var(--surface-tertiary); color: var(--text-muted); }
.campaign-status.scheduled { background: #dbeafe; color: #1e40af; }
.campaign-status.sending { background: #fef3c7; color: #92400e; }
.campaign-status.sent { background: #d1fae5; color: #065f46; }
.campaign-status.test_sent { background: #ede9fe; color: #5b21b6; }

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

.campaign-name {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 0.5rem;
}

.campaign-description {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin: 0 0 1rem;
}

.campaign-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: var(--surface-tertiary);
    border-radius: 8px;
}

.campaign-stats .stat {
    text-align: center;
}

.campaign-stats .value {
    font-size: 1.1rem;
    font-weight: 700;
}

.campaign-stats .label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.campaign-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-campaign {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--surface-primary);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-campaign:hover { background: var(--surface-tertiary); }
.btn-campaign.send:hover { background: #10b981; color: white; border-color: #10b981; }
.btn-campaign.test:hover { background: #8b5cf6; color: white; border-color: #8b5cf6; }

/* ============================================
   ALL PLAYERS TAB
   ============================================ */

.players-tab {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.players-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 1rem;
    background: var(--surface-secondary);
    border-radius: 10px;
}

.players-toolbar .filters {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.players-toolbar select,
.players-toolbar input {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--surface-primary);
    color: var(--text-primary);
    font-size: 0.85rem;
}

.players-toolbar input { min-width: 200px; }

.bulk-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.selected-count {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.btn-bulk {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--surface-primary);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-bulk:hover:not(:disabled) {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

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

.players-table-wrapper {
    overflow-x: auto;
}

.players-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.players-table th,
.players-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.players-table th {
    background: var(--surface-secondary);
    font-weight: 600;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.players-table th:hover { color: var(--accent-primary); }

.players-table tr:hover { background: var(--surface-secondary); }
.players-table tr.selected { background: rgba(59, 130, 246, 0.1); }
.players-table tr.disabled { opacity: 0.6; }

.player-email-cell {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.player-email-cell .badge {
    font-size: 0.65rem;
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    text-transform: uppercase;
}

.badge.disabled { background: #fee2e2; color: #991b1b; }

.actions-cell {
    display: flex;
    gap: 0.25rem;
}

.btn-player-action {
    padding: 0.375rem 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--surface-primary);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-player-action:hover { background: var(--accent-primary); }
.btn-player-action.ai:hover { background: #8b5cf6; }

.empty-row {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem !important;
}

.load-more {
    text-align: center;
    padding: 1rem;
}

.load-more button {
    padding: 0.75rem 2rem;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

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

.table-footer {
    text-align: center;
    padding: 0.75rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ============================================
   ANALYTICS TAB
   ============================================ */

.analytics-tab {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.analytics-tab h3 { margin: 0 0 1rem; }

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

.analytics-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem;
    background: var(--surface-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
}

.analytics-card.success { border-left: 4px solid #10b981; }

.analytics-card .card-icon {
    font-size: 2rem;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-tertiary);
    border-radius: 10px;
}

.analytics-card .card-content {
    flex: 1;
}

.analytics-card .card-value {
    font-size: 1.5rem;
    font-weight: 700;
}

.analytics-card .card-value.positive { color: #10b981; }
.analytics-card .card-value.negative { color: #ef4444; }

.analytics-card .card-label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.analytics-card .card-change {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.analytics-section {
    background: var(--surface-secondary);
    padding: 1.25rem;
    border-radius: 12px;
}

.analytics-section h4 { margin: 0 0 1rem; }

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

.performance-card {
    padding: 1rem;
    background: var(--surface-tertiary);
    border-radius: 8px;
}

.performance-card .type-icon { font-size: 1.5rem; margin-bottom: 0.5rem; }
.performance-card .type-name { font-weight: 600; margin-bottom: 0.5rem; }

.performance-card .type-stats {
    display: flex;
    gap: 0.75rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.performance-card .success { color: #10b981; }
.performance-card .revenue { color: var(--accent-primary); }

.success-bar {
    height: 6px;
    background: var(--surface-primary);
    border-radius: 3px;
    overflow: hidden;
}

.success-bar .bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #10b981, #34d399);
    border-radius: 3px;
}

.segments-breakdown {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.segment-bar {
    padding: 0.75rem;
    background: var(--surface-tertiary);
    border-radius: 8px;
    border-left: 4px solid var(--border-color);
}

.segment-bar.purple { border-left-color: #8b5cf6; }
.segment-bar.red { border-left-color: #ef4444; }
.segment-bar.orange { border-left-color: #f97316; }
.segment-bar.pink { border-left-color: #ec4899; }
.segment-bar.green { border-left-color: #10b981; }
.segment-bar.blue { border-left-color: #3b82f6; }

.segment-bar .segment-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.25rem;
}

.segment-bar .segment-name { font-weight: 500; }
.segment-bar .segment-count { color: var(--text-muted); font-size: 0.85rem; }
.segment-bar .segment-value { color: #10b981; font-weight: 600; margin-bottom: 0.5rem; }

.bar-track {
    height: 6px;
    background: var(--surface-primary);
    border-radius: 3px;
    overflow: hidden;
}

.bar-track .bar-fill {
    height: 100%;
    background: var(--accent-primary);
    border-radius: 3px;
}

.no-data {
    text-align: center;
    color: var(--text-muted);
    padding: 1rem;
}

/* ============================================
   RETENTION MODALS
   ============================================ */
@keyframes modalSlideIn {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 0.375rem;
}

.form-group select,
.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--surface-secondary);
    color: var(--text-primary);
    font-size: 0.9rem;
}

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

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.player-summary {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--surface-secondary);
    border-radius: 8px;
    margin-bottom: 1rem;
}

.ai-generate-row {
    margin-bottom: 0.5rem;
}

.btn-ai-generate {
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-ai-generate:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
}

.btn-cancel {
    padding: 0.625rem 1.25rem;
    background: var(--surface-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-cancel:hover { background: var(--surface-tertiary); }

.btn-secondary {
    padding: 0.625rem 1.25rem;
    background: var(--surface-secondary);
    border: 1px solid var(--accent-primary);
    color: var(--accent-primary);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: var(--accent-primary);
    color: white;
}

.btn-submit {
    padding: 0.625rem 1.25rem;
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

/* Signal Players Modal */
.signal-players-list {
    max-height: 400px;
    overflow-y: auto;
}

.signal-player-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.signal-player-row:last-child { border-bottom: none; }

.signal-player-row .player-email { flex: 1; font-weight: 500; }
.signal-player-row .player-value { color: #10b981; }
.signal-player-row .player-inactive { color: var(--text-muted); font-size: 0.85rem; }

.btn-mini {
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--surface-primary);
    cursor: pointer;
    transition: all 0.2s;
}

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

/* AI Actions in Modal */
.ai-actions {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.btn-ai-action {
    width: 100%;
    padding: 0.75rem;
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-ai-action:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

/* ========================================
   RETENTION SIGNAL CARDS (AI Signals Tab)
   ======================================== */

.signals-section {
    padding: 0;
}

.signals-section .section-header {
    margin-bottom: 1.5rem;
}

.signals-section .section-header h3 {
    font-size: 1.25rem;
    color: var(--text-primary);
    margin: 0 0 0.25rem;
}

.signals-section .section-header p {
    color: var(--text-muted);
    margin: 0;
    font-size: 0.9rem;
}

.signals-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.summary-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
}

.summary-card.urgent {
    border-color: #f97316;
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.1), transparent);
}

.summary-card .summary-count {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.summary-card .summary-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.signals-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.ret-signal-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.ret-signal-priority {
    background: var(--bg-tertiary);
    color: var(--text-muted);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.ret-signal-title {
    flex: 1;
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.ret-signal-status {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
}

.ret-signal-status.new {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.ret-signal-status.viewed {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}

.ret-signal-status.actioned {
    background: rgba(139, 92, 246, 0.15);
    color: #8b5cf6;
}

.ret-signal-description {
    color: var(--text-secondary);
    margin: 0 0 1rem;
    font-size: 0.9rem;
    line-height: 1.5;
}

.ret-signal-stats {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.ret-signal-stats .stat {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.ret-signal-stats .stat strong {
    color: var(--text-primary);
}

.ret-signal-recommendation {
    background: var(--bg-tertiary);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

.ret-signal-recommendation strong {
    color: #10b981;
}

.ret-signal-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.btn-ret-signal {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-ret-signal:hover {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

.btn-ret-signal.primary {
    background: linear-gradient(135deg, #10b981, #059669);
    border-color: transparent;
    color: white;
}

.btn-ret-signal.primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-ret-signal.dismiss {
    padding: 0.5rem 0.75rem;
    color: var(--text-muted);
}

.btn-ret-signal.dismiss:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border-color: #ef4444;
}

.btn-ret-signal.danger {
    background: rgba(239, 68, 68, 0.1);
    border-color: #ef4444;
    color: #ef4444;
}

.btn-ret-signal.danger:hover {
    background: #ef4444;
    color: white;
}

/* Dismissed signals section */
.dismissed-signals-section details summary {
    cursor: pointer;
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border-radius: 8px;
    font-weight: 600;
    color: var(--text-secondary);
}

.dismissed-signals-section details summary:hover {
    background: var(--bg-hover);
}

.dismissed-header {
    display: flex;
    align-items: center;
}
/* Actions Tab */
.actions-section, .campaigns-section {
    padding: 0;
}

.actions-summary, .campaigns-toolbar {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.actions-summary .summary-card.pending { border-color: #f59e0b; }
.actions-summary .summary-card.success { border-color: #10b981; }
.actions-summary .summary-card.failed { border-color: #ef4444; }

.actions-toolbar {
    margin-bottom: 1.5rem;
}

.actions-list, .campaigns-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.action-card, .campaign-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1rem;
}

.action-card .action-status {
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
}

.action-card.pending .action-status { color: #f59e0b; }
.action-card.success .action-status { color: #10b981; }
.action-card.failed .action-status { color: #ef4444; }

/* ========================================
   RETENTION CRM - COMPLETE STYLES
   Dark/Light Theme Compatible
   ======================================== */
/* Form Elements */
.form-group {
    margin-bottom: 1.25rem;
}

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

.form-group label small {
    color: var(--text-muted);
    font-weight: 400;
}

.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: all 0.2s;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.form-textarea {
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
}

.form-divider {
    height: 1px;
    background: var(--border-color);
    margin: 1.5rem 0;
}

.form-section-title {
    font-size: 0.95rem;
    color: var(--text-primary);
    margin: 0 0 1rem;
}

/* Buttons */
.btn-primary {
    padding: 0.65rem 1.25rem;
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-secondary {
    padding: 0.65rem 1.25rem;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

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

.btn-cancel {
    padding: 0.65rem 1.25rem;
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

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

/* Action Modal Specific */
.action-signal-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-tertiary);
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.action-signal-info .signal-badge {
    font-weight: 500;
    color: var(--text-primary);
}

.action-signal-info .player-count {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Actions Tab - Enhanced */
.actions-summary-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.summary-card.clickable {
    cursor: pointer;
    transition: all 0.2s;
}

.summary-card.clickable:hover {
    transform: translateY(-2px);
    border-color: var(--accent-primary);
}

.summary-card.clickable.active {
    border-color: var(--accent-primary);
    background: linear-gradient(135deg, var(--bg-card), rgba(16, 185, 129, 0.1));
}

.summary-card.rate {
    background: linear-gradient(135deg, var(--bg-card), rgba(139, 92, 246, 0.1));
    border-color: #8b5cf6;
}

.actions-toolbar {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

/* Action Groups */
.action-group {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.action-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
}

.action-group-header .group-title {
    font-weight: 500;
    color: var(--text-primary);
}

.action-group-header .group-count {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.action-group-items {
    padding: 0.5rem;
}

.action-more {
    text-align: center;
    padding: 0.75rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Retention Action Card */
.ret-action-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: 8px;
    transition: all 0.2s;
}

.ret-action-card:hover {
    background: var(--bg-tertiary);
}

.ret-action-card.overdue {
    border-left: 3px solid #f59e0b;
}

.ret-action-icon {
    font-size: 1.25rem;
    width: 36px;
    text-align: center;
}

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

.ret-action-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.ret-action-email {
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ret-action-status {
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    text-transform: uppercase;
    font-weight: 600;
}

.ret-action-status.pending {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
}

.ret-action-status.success {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.ret-action-status.failed {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.ret-action-details {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ret-action-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.ret-action-meta .overdue-text {
    color: #f59e0b;
    font-weight: 500;
}

.ret-action-buttons {
    display: flex;
    gap: 0.25rem;
}

.btn-mini.success {
    background: rgba(16, 185, 129, 0.15);
    border-color: #10b981;
    color: #10b981;
}

.btn-mini.success:hover {
    background: #10b981;
    color: white;
}

.btn-mini.fail {
    background: rgba(239, 68, 68, 0.15);
    border-color: #ef4444;
    color: #ef4444;
}

.btn-mini.fail:hover {
    background: #ef4444;
    color: white;
}

.btn-mini.danger {
    color: #ef4444;
}

.btn-mini.danger:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: #ef4444;
}

/* Campaigns Tab - Enhanced */
.campaigns-summary-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

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

/* Retention Campaign Card */
.ret-campaign-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
    transition: all 0.2s;
}

.ret-campaign-card:hover {
    border-color: var(--accent-primary);
    transform: translateY(-2px);
}

.ret-campaign-card.draft {
    border-left: 4px solid #6b7280;
}

.ret-campaign-card.scheduled {
    border-left: 4px solid #3b82f6;
}

.ret-campaign-card.sent {
    border-left: 4px solid #10b981;
}

.ret-campaign-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.ret-campaign-status {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.ret-campaign-date {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.ret-campaign-name {
    margin: 0 0 0.5rem;
    font-size: 1rem;
    color: var(--text-primary);
}

.ret-campaign-subject {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0 0 0.75rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ret-campaign-stats {
    display: flex;
    gap: 1rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.ret-campaign-actions {
    display: flex;
    gap: 0.5rem;
}

/* Campaign Builder Modal */
.campaign-builder-body {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 1.5rem;
    height: 100%;
}

.campaign-builder-sidebar {
    border-right: 1px solid var(--border-color);
    padding-right: 1.5rem;
}

.campaign-builder-main {
    display: flex;
    flex-direction: column;
}

.subject-input {
    font-size: 1rem !important;
}

.subject-variables {
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.subject-variables small {
    color: var(--text-muted);
}

.var-btn {
    padding: 0.25rem 0.5rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    cursor: pointer;
    font-family: monospace;
}

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

.email-toolbar {
    display: flex;
    gap: 0.25rem;
    padding: 0.5rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    flex-wrap: wrap;
}

.toolbar-btn {
    padding: 0.4rem 0.6rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-primary);
    transition: all 0.2s;
}

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

.toolbar-btn.template {
    background: rgba(139, 92, 246, 0.1);
    border-color: #8b5cf6;
    color: #8b5cf6;
}

.toolbar-btn.template:hover {
    background: #8b5cf6;
    color: white;
}

.toolbar-divider {
    width: 1px;
    background: var(--border-color);
    margin: 0 0.25rem;
}

.email-body {
    border-radius: 0 0 8px 8px !important;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.85rem;
    min-height: 300px;
}

.campaign-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* Settings Modal */
.settings-info {
    background: var(--bg-tertiary);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.settings-info p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Analytics Tab */
.analytics-section {
    padding: 0;
}

.analytics-metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.metric-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
    text-align: center;
}

.metric-card .metric-icon {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.metric-card .metric-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.metric-card .metric-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.metric-card.primary { border-left: 4px solid #3b82f6; }
.metric-card.success { border-left: 4px solid #10b981; }
.metric-card.warning { border-left: 4px solid #f59e0b; }
.metric-card.info { border-left: 4px solid #8b5cf6; }

.analytics-charts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
}

.chart-card h4 {
    margin: 0 0 1rem;
    font-size: 1rem;
    color: var(--text-primary);
}

/* Action Type Chart */
.action-type-chart {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.type-bar-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.type-bar-row .type-label {
    width: 100px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.type-bar-container {
    flex: 1;
    height: 20px;
    background: var(--bg-tertiary);
    border-radius: 10px;
    overflow: hidden;
}

.type-bar {
    height: 100%;
    background: linear-gradient(90deg, #10b981, #059669);
    border-radius: 10px;
    transition: width 0.3s ease;
}

.type-bar-row .type-count {
    width: 30px;
    text-align: right;
    font-size: 0.85rem;
    color: var(--text-primary);
    font-weight: 500;
}

/* Weekly Chart */
.weekly-chart {
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    height: 150px;
    padding-top: 1rem;
}

.week-bar-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
}

.week-bar {
    width: 40px;
    min-height: 10px;
    background: linear-gradient(180deg, #3b82f6, #1d4ed8);
    border-radius: 4px 4px 0 0;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 0.25rem;
    transition: height 0.3s ease;
}

.week-bar .week-count {
    font-size: 0.75rem;
    color: white;
    font-weight: 600;
}

.week-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-align: center;
}

/* Outcome Breakdown */
.analytics-breakdown {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.breakdown-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
}

.breakdown-card h4 {
    margin: 0 0 1rem;
    font-size: 1rem;
    color: var(--text-primary);
}

.outcome-stats {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.outcome-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    position: relative;
    padding: 0.5rem;
    border-radius: 6px;
    overflow: hidden;
}

.outcome-row .outcome-bar {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    opacity: 0.15;
    transition: width 0.3s ease;
}

.outcome-row.success .outcome-bar { background: #10b981; }
.outcome-row.failed .outcome-bar { background: #ef4444; }
.outcome-row.pending .outcome-bar { background: #f59e0b; }

.outcome-row .outcome-icon {
    font-size: 1.1rem;
    z-index: 1;
}

.outcome-row .outcome-label {
    flex: 1;
    font-size: 0.9rem;
    color: var(--text-secondary);
    z-index: 1;
}

.outcome-row .outcome-value {
    font-weight: 600;
    color: var(--text-primary);
    z-index: 1;
}

/* Campaign Stats */
.campaign-stats {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.campaign-stats .stat-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.campaign-stats .stat-row:last-child {
    border-bottom: none;
}

.campaign-stats .stat-row span {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.campaign-stats .stat-row strong {
    color: var(--text-primary);
}

/* Player Overview */
.analytics-overview {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
}

.analytics-overview h4 {
    margin: 0 0 1rem;
    font-size: 1rem;
    color: var(--text-primary);
}

.overview-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.overview-stat {
    text-align: center;
    padding: 1rem;
    background: var(--bg-tertiary);
    border-radius: 8px;
}

.overview-stat .stat-number {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.overview-stat .stat-desc {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}
/* Empty State Enhancement */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-muted);
}

.empty-state .empty-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 1rem;
    opacity: 0.6;
}

.empty-state h4 {
    color: var(--text-primary);
    margin: 0 0 0.5rem;
}

.empty-state p {
    margin: 0;
}

.no-data {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Responsive Styles */
@media (max-width: 1024px) {
    .campaign-builder-body {
        grid-template-columns: 1fr;
    }
    
    .campaign-builder-sidebar {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        padding-right: 0;
        padding-bottom: 1.5rem;
    }
    
    .analytics-charts,
    .analytics-breakdown {
        grid-template-columns: 1fr;
    }
    
    .analytics-metrics-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .overview-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .signals-summary,
    .actions-summary-grid,
    .campaigns-summary-grid {
        grid-template-columns: 1fr;
    }
    
    .ret-signal-stats {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .ret-signal-actions {
        flex-direction: column;
    }
    
    .btn-ret-signal {
        width: 100%;
        text-align: center;
    }
    
    .ret-action-meta {
        flex-wrap: wrap;
    }
    
    .analytics-metrics-grid,
    .overview-grid {
        grid-template-columns: 1fr;
    }
    
    .campaigns-grid {
        grid-template-columns: 1fr;
    }
}
[data-theme="light"] .type-bar {
    background: linear-gradient(90deg, #059669, #047857);
}

[data-theme="light"] .week-bar {
    background: linear-gradient(180deg, #2563eb, #1d4ed8);
}
[data-theme="light"] .metric-card,
[data-theme="light"] .chart-card,
[data-theme="light"] .breakdown-card,
[data-theme="light"] .analytics-overview,
[data-theme="light"] .ret-campaign-card,
[data-theme="light"] .action-group {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* ========================================
   AI EMAIL BUILDER
   ======================================== */

.toolbar-btn.ai-build {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    border-color: #8b5cf6;
    color: white;
    font-weight: 500;
    padding: 0.5rem 1rem;
}

.toolbar-btn.ai-build:hover {
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
}

.ai-email-modal {
    max-width: 550px;
}

.ai-builder-intro {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(124, 58, 237, 0.05));
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.ai-builder-intro p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.ai-generating-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--bg-tertiary);
    border-radius: 8px;
    margin-top: 1rem;
}

.ai-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-top-color: #8b5cf6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.ai-generating-status span {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.ai-generate-btn {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed) !important;
}

.ai-generate-btn:hover {
    background: linear-gradient(135deg, #7c3aed, #6d28d9) !important;
    box-shadow: 0 4px 16px rgba(139, 92, 246, 0.4) !important;
}

.ai-generate-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none !important;
}

/* ========================================
   GLOBAL SELECT/DROPDOWN DARK THEME FIX
   ======================================== */
/* Force all selects to use theme colors */
select,
.form-select,
.filter-group select,
.partners-filter-bar select,
.events-filters select,
.sources-filter select,
.insights-filters select,
.players-filters select {
    background-color: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
}

/* Style dropdown options - works on Firefox */
select option,
.form-select option {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    padding: 10px 12px;
}

select option:hover,
select option:checked,
.form-select option:hover,
.form-select option:checked {
    background: linear-gradient(var(--accent-primary), var(--accent-primary));
    background-color: var(--accent-primary) !important;
    color: white !important;
}

/* Chrome/Edge - use custom dropdown styling */
@supports (-webkit-appearance: none) {
    select,
    .form-select {
        -webkit-appearance: none;
        appearance: none;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23888' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 12px center;
        padding-right: 36px;
    }
}

/* Dark theme specific overrides */
[data-theme="dark"] select,
[data-theme="dark"] .form-select,
[data-theme="dark"] select option,
[data-theme="dark"] .form-select option {
    background-color: #1e293b !important;
    color: #e2e8f0 !important;
}

[data-theme="dark"] select:focus,
[data-theme="dark"] .form-select:focus {
    border-color: var(--accent-primary) !important;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15) !important;
}

/* For browsers that support it - style the dropdown list */
select::-ms-expand {
    display: none;
}

/* Tags dropdown specific fix */
.tags-dropdown,
.filter-dropdown,
.status-dropdown {
    background-color: var(--bg-secondary) !important;
    border-color: var(--border-color) !important;
}

.tags-dropdown option,
.filter-dropdown option,
.status-dropdown option {
    background-color: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
}

/* Light theme - ensure proper contrast */
[data-theme="light"] select,
[data-theme="light"] .form-select {
    background-color: #ffffff !important;
    color: #1e293b !important;
    border-color: #e2e8f0 !important;
}

[data-theme="light"] select option,
[data-theme="light"] .form-select option {
    background-color: #ffffff !important;
    color: #1e293b !important;
}

[data-theme="light"] select option:hover,
[data-theme="light"] select option:checked {
    background-color: #10b981 !important;
    color: white !important;
}

/* ========================================
   EMAIL PREVIEW MODAL
   ======================================== */

.email-preview-modal {
    max-width: 800px;
    height: 80vh;
}

.preview-modal-body {
    padding: 0 !important;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.email-preview-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #f4f4f4;
}

.preview-envelope {
    background: var(--bg-tertiary);
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.preview-meta {
    font-size: 0.9rem;
}

.preview-from, .preview-subject-line {
    margin-bottom: 0.25rem;
    color: var(--text-secondary);
}

.preview-subject-line strong, .preview-from strong {
    color: var(--text-primary);
}

.preview-iframe {
    flex: 1;
    border: none;
    background: white;
    margin: 1rem auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
}

.preview-iframe.desktop {
    width: 600px;
    max-width: 100%;
}

.preview-iframe.mobile {
    width: 375px;
    border-radius: 20px;
}

.preview-device-toggle {
    display: flex;
    gap: 0.5rem;
    margin-right: auto;
    margin-left: 1rem;
}

.device-btn {
    padding: 0.4rem 0.8rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.device-btn.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

.device-btn:hover:not(.active) {
    border-color: var(--accent-primary);
}

/* ========================================
   CAMPAIGN TEMPLATES LIBRARY
   ======================================== */

.toolbar-btn.save-template {
    background: rgba(16, 185, 129, 0.1);
    border-color: #10b981;
    color: #10b981;
}

.toolbar-btn.save-template:hover {
    background: #10b981;
    color: white;
}

.toolbar-btn.load-template {
    background: rgba(59, 130, 246, 0.1);
    border-color: #3b82f6;
    color: #3b82f6;
}

.toolbar-btn.load-template:hover {
    background: #3b82f6;
    color: white;
}

.small-modal {
    max-width: 450px;
}

.template-library-modal {
    max-width: 700px;
}

.templates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.template-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.template-card:hover {
    border-color: var(--accent-primary);
    transform: translateY(-2px);
}

.template-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.template-category {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.template-card-name {
    margin: 0 0 0.5rem;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.template-card-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0 0 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.template-card-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ========================================
   PLAYER NOTES
   ======================================== */

.btn-note {
    padding: 0.25rem 0.5rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

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

.btn-note.has-notes {
    background: rgba(245, 158, 11, 0.15);
    border-color: #f59e0b;
}

.player-actions {
    display: flex;
    gap: 0.25rem;
}

.player-notes-modal {
    max-width: 550px;
}

.add-note-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.note-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.note-type-select {
    width: 160px;
}

.notes-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 400px;
    overflow-y: auto;
}

.no-notes {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
}

.note-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    border-left: 3px solid var(--border-color);
}

.note-card.contacted { border-left-color: #3b82f6; }
.note-card.bonus_given { border-left-color: #10b981; }
.note-card.vip_note { border-left-color: #8b5cf6; }
.note-card.complaint { border-left-color: #ef4444; }
.note-card.positive { border-left-color: #22c55e; }

.note-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.note-type-badge {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: capitalize;
}

.note-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    flex: 1;
}

.note-content {
    font-size: 0.9rem;
    color: var(--text-primary);
    line-height: 1.5;
    white-space: pre-wrap;
}

/* ========================================
   OVERDUE ACTION REMINDERS
   ======================================== */

.overdue-reminder {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 10002;
    animation: slideIn 0.3s ease;
}

.overdue-reminder.hiding {
    animation: slideOut 0.3s ease forwards;
}

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

@keyframes slideOut {
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

.reminder-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: linear-gradient(135deg, #1e293b, #0f172a);
    border: 1px solid #f59e0b;
    border-radius: 12px;
    padding: 1rem 1.25rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

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

.reminder-text {
    color: var(--text-primary);
    font-size: 0.9rem;
}

.reminder-text strong {
    color: #f59e0b;
}

.reminder-btn {
    padding: 0.5rem 1rem;
    background: #f59e0b;
    color: #0f172a;
    border: none;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.reminder-btn:hover {
    background: #fbbf24;
    transform: translateY(-1px);
}

.reminder-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0 0.25rem;
}

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

/* Light theme adjustments */
[data-theme="light"] .reminder-content {
    background: linear-gradient(135deg, #ffffff, #f8fafc);
    border-color: #f59e0b;
}

[data-theme="light"] .template-card,
[data-theme="light"] .note-card {
    background: #f8fafc;
}

[data-theme="light"] .preview-iframe {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

/* ========================================
   WORKSPACE - KANBAN BOARDS
   ======================================== */

.workspace-page {
    padding: 2rem;
}

.workspace-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.workspace-tab {
    padding: 0.75rem 1.5rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.2s;
}

.workspace-tab:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.workspace-tab.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

.workspace-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.workspace-header h2 {
    margin: 0;
    font-size: 1.75rem;
    color: var(--text-primary);
}

/* Boards Grid */
.boards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.board-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.board-card:hover {
    border-color: var(--accent-primary);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.board-card-color {
    height: 6px;
}

.board-card-content {
    padding: 1.25rem;
}

.board-card-content h3 {
    margin: 0 0 0.5rem;
    font-size: 1.1rem;
    color: var(--text-primary);
}

.board-card-content p {
    margin: 0 0 1rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.board-card-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.board-menu-btn {
    position: absolute;
    top: 1rem;
    right: 0.75rem;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}

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

.board-menu {
    position: absolute;
    top: 2.5rem;
    right: 0.75rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.5rem;
    display: none;
    z-index: 100;
    min-width: 120px;
}

.board-menu.visible {
    display: block;
}

.board-menu button {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.5rem 0.75rem;
    background: transparent;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    border-radius: 4px;
    font-size: 0.85rem;
}

.board-menu button:hover {
    background: var(--bg-secondary);
}

.board-menu button.danger:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

/* Kanban Board View */
.kanban-page {
    height: calc(100vh - 80px);
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    overflow: hidden;
}

.kanban-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-shrink: 0;
}

.kanban-header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.btn-back {
    padding: 0.5rem 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

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

.kanban-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.board-color-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.kanban-title h2 {
    margin: 0;
    font-size: 1.5rem;
}

.kanban-header-right {
    display: flex;
    gap: 0.75rem;
}

.btn-icon {
    padding: 0.5rem 0.75rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
}

.btn-icon:hover {
    background: var(--bg-secondary);
    border-color: var(--border-light);
}

/* Kanban Container */
.kanban-container {
    display: flex;
    gap: 1.25rem;
    flex: 1;
    overflow-x: auto;
    padding-bottom: 1rem;
}

.kanban-column {
    min-width: 300px;
    max-width: 300px;
    background: var(--bg-secondary);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    max-height: 100%;
}

.kanban-column-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    position: relative;
}

.column-name {
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
}

.column-count {
    background: var(--bg-tertiary);
    padding: 0.2rem 0.5rem;
    border-radius: 10px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.column-menu-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    opacity: 0;
    transition: opacity 0.2s;
}

.kanban-column-header:hover .column-menu-btn {
    opacity: 1;
}

.column-menu-btn:hover {
    background: var(--bg-tertiary);
}

.column-menu {
    position: absolute;
    top: 100%;
    right: 0.5rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.5rem;
    display: none;
    z-index: 100;
    min-width: 120px;
}

.column-menu.visible {
    display: block;
}

.column-menu button {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.5rem 0.75rem;
    background: transparent;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    border-radius: 4px;
    font-size: 0.85rem;
}

.column-menu button:hover {
    background: var(--bg-secondary);
}

.column-menu button.danger:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

/* Kanban Column Body */
.kanban-column-body {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-height: 100px;
}

.kanban-column-body.drag-over {
    background: rgba(16, 185, 129, 0.1);
    border: 2px dashed var(--accent-primary);
    border-radius: 8px;
}

/* Task Cards */
.kanban-task {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    cursor: grab;
    transition: all 0.15s ease;
}

.kanban-task:hover {
    border-color: var(--border-light);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.kanban-task.dragging {
    opacity: 0.5;
    transform: rotate(3deg);
    cursor: grabbing;
}

.task-priority-bar {
    height: 3px;
}

.task-content {
    padding: 0.75rem;
}

.task-title {
    margin: 0 0 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.4;
}

.task-description {
    margin: 0 0 0.75rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.task-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.task-assignee {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--accent-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 600;
}

.task-due {
    font-size: 0.75rem;
    color: var(--text-muted);
    background: var(--bg-tertiary);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

.task-due.overdue {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.task-labels {
    display: flex;
    gap: 0.25rem;
}

.task-label {
    font-size: 0.65rem;
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    color: white;
}

/* Add Task Button */
.add-task-btn {
    margin: 0.5rem 0.75rem 0.75rem;
    padding: 0.75rem;
    background: transparent;
    border: 1px dashed var(--border-color);
    border-radius: 8px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.add-task-btn:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    background: rgba(16, 185, 129, 0.05);
}

/* Chat Item Menu */
.chat-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-item-menu-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px 8px;
    font-size: 14px;
    opacity: 0;
    transition: opacity 0.2s;
    margin-left: auto;
}

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

.chat-item-menu {
    position: absolute;
    right: 0;
    top: 100%;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    z-index: 100;
    min-width: 120px;
    display: none;
}

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

.chat-item-menu button {
    display: block;
    width: 100%;
    padding: 8px 12px;
    text-align: left;
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 13px;
}

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

/* Reaction Picker */
.reaction-picker {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    padding: 12px;
}

.reaction-picker-content {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    max-width: 240px;
}

.reaction-emoji {
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: all 0.15s;
}

.reaction-emoji:hover {
    background: var(--hover-bg);
    transform: scale(1.2);
}

/* Task Assignee Name */
.task-assignee-name {
    font-size: 11px;
    color: var(--text-secondary);
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.task-assignee-avatar {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    object-fit: cover;
}

/* Workspace Modal */
.workspace-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
}

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

.workspace-modal .modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.workspace-modal .modal-content {
    position: relative;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: modalSlideIn 0.2s ease;
}

.workspace-modal .modal-content.small-modal {
    max-width: 400px;
}

.workspace-modal .modal-content.task-detail-modal {
    max-width: 700px;
}

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

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

.workspace-modal .modal-header h3 {
    margin: 0;
    font-size: 1.1rem;
}

.workspace-modal .modal-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

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

.workspace-modal .modal-body {
    padding: 1.5rem;
    overflow-y: auto;
}

.workspace-modal .modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
}

.workspace-modal .modal-footer .footer-right {
    display: flex;
    gap: 0.75rem;
}

/* Task Detail Layout */
.task-detail-modal .modal-body {
    display: grid;
    grid-template-columns: 1fr 200px;
    gap: 1.5rem;
}

.task-detail-main {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.task-detail-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.task-meta-info {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.8rem;
    color: var(--text-muted);
}

.task-meta-info p {
    margin: 0.25rem 0;
}

/* Color Picker */
.color-picker {
    display: flex;
    gap: 0.5rem;
}

.color-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
}

.color-btn:hover {
    transform: scale(1.1);
}

.color-btn.active {
    border-color: white;
    box-shadow: 0 0 0 2px var(--accent-primary);
}

/* Form Row */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* Danger Button */
.btn-danger {
    padding: 0.5rem 1rem;
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid #ef4444;
    border-radius: 8px;
    color: #ef4444;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.btn-danger:hover {
    background: #ef4444;
    color: white;
}

/* Light theme */
[data-theme="light"] .kanban-column {
    background: #f1f5f9;
}

[data-theme="light"] .kanban-task {
    background: white;
}

[data-theme="light"] .board-card {
    background: white;
}

[data-theme="light"] .workspace-modal .modal-content {
    background: white;
}

.btn-icon-sm {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.btn-icon-xs {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.8rem;
}

.btn-icon-xs:hover {
    color: var(--accent-primary);
}

/* Member Selector */
.member-selector {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 200px;
    overflow-y: auto;
}

.member-checkbox {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
}

.member-checkbox:hover {
    background: var(--bg-tertiary);
}

.member-checkbox input {
    width: 18px;
    height: 18px;
}

.member-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--accent-purple);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 600;
}

/* ========================================
   WORKFLOW BUILDER
   ======================================== */

.workflows-page {
    padding: 2rem;
}

.workflows-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
}

.workflows-header h3 {
    margin: 0 0 0.5rem;
}

.workflows-header p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.workflows-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.workflow-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
    transition: all 0.2s;
}

.workflow-card.active {
    border-color: var(--accent-primary);
}

.workflow-card:hover {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.workflow-card-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.workflow-card-header h4 {
    margin: 0;
    flex: 1;
}

.workflow-status {
    font-size: 0.8rem;
}

.workflow-description {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0 0 1rem;
}

.workflow-stats {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.workflow-actions {
    display: flex;
    gap: 0.5rem;
}

.workflow-actions button {
    padding: 0.4rem 0.75rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.workflow-actions button:hover {
    background: var(--bg-secondary);
    border-color: var(--border-light);
}

.workflow-actions button.danger:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: #ef4444;
    color: #ef4444;
}

/* Workflow Builder Modal */
.workflow-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: var(--bg-primary);
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
}

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

.workflow-builder {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.workflow-builder-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.workflow-name-input {
    background: transparent;
    border: none;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    padding: 0.5rem;
    border-radius: 6px;
}

.workflow-name-input:focus {
    outline: none;
    background: var(--bg-tertiary);
}

.header-right {
    display: flex;
    gap: 0.75rem;
}

.workflow-builder-body {
    flex: 1;
    display: grid;
    grid-template-columns: 200px 1fr 260px;
    overflow: hidden;
}

/* Toolbox */
.workflow-toolbox {
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    padding: 1rem;
    overflow-y: auto;
}

.workflow-toolbox h4 {
    margin: 0 0 1rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.toolbox-nodes {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.toolbox-node {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: grab;
    transition: all 0.2s;
}

.toolbox-node:hover {
    background: var(--bg-card);
    transform: translateX(4px);
}

.toolbox-node .node-icon {
    font-size: 1.1rem;
}

.toolbox-node .node-name {
    font-size: 0.85rem;
    font-weight: 500;
}

.toolbox-info {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.toolbox-info p {
    margin: 0 0 0.5rem;
}

/* Canvas */
.workflow-canvas {
    position: relative;
    background: var(--bg-primary);
    background-image: 
        radial-gradient(circle, var(--border-color) 1px, transparent 1px);
    background-size: 20px 20px;
    overflow: auto;
}

.connections-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.connection-line {
    pointer-events: stroke;
}

.connection-line:hover {
    stroke: #ef4444 !important;
    cursor: pointer;
}

.nodes-layer {
    position: relative;
    min-height: 100%;
    min-width: 100%;
}

.canvas-empty {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: var(--text-muted);
}

.canvas-empty span {
    font-size: 3rem;
    display: block;
    margin-bottom: 1rem;
}

/* Workflow Nodes */
.workflow-node {
    position: absolute;
    width: 150px;
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    cursor: move;
    user-select: none;
    transition: box-shadow 0.2s;
}

.workflow-node:hover {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.workflow-node.selected {
    box-shadow: 0 0 0 3px var(--accent-primary);
}

.node-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: 8px 8px 0 0;
    color: white;
}

.node-header .node-icon {
    font-size: 0.9rem;
}

.node-header .node-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.node-body {
    padding: 0.75rem;
}

.node-config {
    margin: 0;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.node-input,
.node-output {
    position: absolute;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-light);
    cursor: crosshair;
    transition: all 0.2s;
}

.node-input {
    left: -7px;
    top: 50%;
    transform: translateY(-50%);
}

.node-output {
    right: -7px;
    top: 50%;
    transform: translateY(-50%);
}

.node-input:hover,
.node-output:hover {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    transform: translateY(-50%) scale(1.2);
}

/* Properties Panel */
.workflow-properties {
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    padding: 1rem;
    overflow-y: auto;
}

.workflow-properties h4 {
    margin: 0 0 1rem;
    font-size: 0.9rem;
}

.property-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.properties-empty {
    color: var(--text-muted);
    font-size: 0.85rem;
    text-align: center;
    padding: 2rem 1rem;
}

.btn-sm {
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
}

/* Light Theme */
[data-theme="light"] .workflow-canvas {
    background-color: #f8fafc;
}

[data-theme="light"] .workflow-node {
    background: white;
}

[data-theme="light"] .toolbox-node {
    background: white;
}

/* ============================================
   SITE MONITORING MODULE
   Password-protected SEO/PPC tracking
   ============================================ */

/* Password Gate */
.monitoring-password-gate {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 70vh;
    padding: 2rem;
}

.password-gate-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 3rem;
    max-width: 400px;
    width: 100%;
    text-align: center;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
}

.password-gate-card.shake {
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-10px); }
    40%, 80% { transform: translateX(10px); }
}

.password-gate-icon {
    font-size: 4rem;
    margin-bottom: 1.5rem;
}

.password-gate-card h2 {
    margin: 0 0 0.5rem;
    font-size: 1.5rem;
    color: var(--text-primary);
}

.password-gate-card > p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.password-gate-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.password-input {
    padding: 0.875rem 1rem;
    font-size: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-input);
    color: var(--text-primary);
    text-align: center;
}

.password-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.password-gate-hint {
    font-size: 0.85rem;
    margin-top: 0.5rem;
}

.password-gate-note {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 1.5rem;
}

/* Monitoring Page Layout */
.monitoring-page {
    padding: 1.5rem;
    max-width: 1600px;
    margin: 0 auto;
}

.monitoring-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.monitoring-header-left h2 {
    margin: 0;
    font-size: 1.75rem;
    color: var(--text-primary);
}

.monitoring-subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin: 0.25rem 0 0;
}

.monitoring-header-right {
    display: flex;
    gap: 0.75rem;
}

/* Monitoring Tabs */
.monitoring-tabs {
    display: flex;
    gap: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
    padding-bottom: 0;
    overflow-x: auto;
}

.monitoring-tab {
    padding: 0.75rem 1.25rem;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.monitoring-tab:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.monitoring-tab.active {
    color: var(--accent-primary);
    border-bottom-color: var(--accent-primary);
}

.tab-badge {
    background: var(--color-error);
    color: white;
    font-size: 0.7rem;
    padding: 0.15rem 0.4rem;
    border-radius: 10px;
    font-weight: 600;
}

/* Summary Bar */
.monitoring-summary {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.summary-stat {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1rem 1.5rem;
    display: flex;
    flex-direction: column;
    min-width: 140px;
}

.summary-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.summary-value.has-alerts {
    color: var(--color-error);
}

.summary-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Content Area */
.monitoring-content-area {
    min-height: 400px;
}

/* ============================================
   Sites Tab — Polished Card Grid
   ============================================ */

/* Toolbar */
.sites-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

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

.sites-count {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.01em;
}

.sites-toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sites-filter-select {
    appearance: none;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 7px 32px 7px 12px;
    font-size: 0.82rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

.sites-filter-select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.15);
}

.sites-tool-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 14px;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
}

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

.sites-tool-btn.active {
    background: var(--accent-primary);
    color: #fff;
    border-color: var(--accent-primary);
}

.sites-tool-btn.danger {
    color: var(--accent-red, #ef4444);
    border-color: rgba(239, 68, 68, 0.25);
}

.sites-tool-btn.danger:hover {
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.5);
}

.sites-bulk-bar {
    display: flex;
    gap: 12px;
    padding: 6px 0 10px;
}

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

/* ── Site Card (sc) ── */
.sc {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 18px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}

.sc::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 14px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.04), transparent 60%);
}

.sc:hover {
    border-color: var(--accent-primary);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(16, 185, 129, 0.08);
    transform: translateY(-2px);
}

.sc:hover::before {
    opacity: 1;
}

.sc-found {
    border-left: 3px solid var(--color-success, #10b981);
}

.sc-notfound {
    border-left: 3px solid var(--border-color);
}

.sc-selected {
    border-color: var(--accent-primary) !important;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
    background: rgba(16, 185, 129, 0.03);
}

/* Checkbox */
.sc-check {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 2;
}

.sc-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent-primary);
    cursor: pointer;
}

/* Top row */
.sc-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.sc-domain-row {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.sc-favicon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: var(--bg-tertiary);
    color: var(--text-muted);
    flex-shrink: 0;
}

.sc-domain {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sc-url {
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sc-url a {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-decoration: none;
    opacity: 0.7;
    transition: opacity 0.15s;
}
.sc-url a:hover {
    opacity: 1;
    color: var(--accent-primary);
    text-decoration: underline;
}
.site-detail-url {
    display: block;
    font-size: 0.8rem;
    color: var(--accent-primary);
    text-decoration: none;
    margin: 2px 0 4px;
    word-break: break-all;
}
.site-detail-url:hover {
    text-decoration: underline;
}

.sc-crawls {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    background: var(--bg-tertiary);
    padding: 3px 8px;
    border-radius: 6px;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Metric badges */
.sc-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.sc-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
    letter-spacing: 0.01em;
}

.sc-badge-success {
    background: rgba(16, 185, 129, 0.12);
    color: #10b981;
}

.sc-badge-muted {
    background: rgba(107, 114, 128, 0.12);
    color: #6b7280;
}

.sc-badge-warn {
    background: rgba(245, 158, 11, 0.12);
    color: #f59e0b;
}

.sc-badge-danger {
    background: rgba(220, 38, 38, 0.12);
    color: #dc2626;
}

/* Bottom row */
.sc-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
    margin-top: auto;
}

.sc-time {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.sc-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.15s;
}

.sc:hover .sc-actions {
    opacity: 1;
}

.sc-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 10px;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.sc-pdf {
    color: #10b981;
    background: rgba(16, 185, 129, 0.1);
    text-decoration: none;
}

.sc-pdf:hover {
    background: rgba(16, 185, 129, 0.2);
}

.sc-delete {
    color: var(--text-muted);
    background: transparent;
}

.sc-delete:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.08);
}

/* Light theme adjustments */
[data-theme="light"] .sc {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .sc:hover {
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(16, 185, 129, 0.1);
}

.btn-small {
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

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

.btn-small:not(.btn-secondary):not(.btn-icon):not(.btn-ghost) {
    background: var(--accent-primary);
    border: none;
    color: white;
}

.btn-small.btn-icon {
    padding: 0.4rem;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.btn-small.btn-icon:hover {
    background: var(--bg-hover);
}

/* Alerts Tab */
.alerts-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.alerts-filters {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
}

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

.filter-group label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.filter-group select {
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-input);
    color: var(--text-primary);
}

.alerts-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.alert-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    transition: all 0.2s ease;
}

.alert-item.unread {
    background: rgba(99, 102, 241, 0.05);
    border-left: 3px solid var(--accent-primary);
}

.alert-item.severity-critical {
    border-left-color: var(--color-error);
}

.alert-item.severity-error {
    border-left-color: var(--color-error);
}

.alert-item.severity-warning {
    border-left-color: var(--color-warning);
}

.alert-item.severity-success {
    border-left-color: var(--color-success);
}

.alert-item.severity-info {
    border-left-color: var(--color-info);
}

.alert-item.read {
    opacity: 0.7;
}

.alert-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

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

.alert-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
}

.alert-domain {
    font-weight: 600;
    color: var(--text-primary);
}

.alert-time {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.alert-message {
    font-size: 0.9rem;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.alert-details {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.alert-actions {
    display: flex;
    gap: 0.25rem;
    flex-shrink: 0;
}

.btn-ghost {
    background: transparent;
    border: none;
    padding: 0.4rem;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
}

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

.btn-ghost.btn-danger:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--color-error);
}

.alerts-empty {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.alerts-empty h3 {
    margin: 0 0 0.5rem;
    color: var(--text-primary);
}

/* History Tab */
.history-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.history-filters {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    padding: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
}

.history-chart-card,
.history-table-card,
.history-screenshots-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
}

.history-chart-card h3,
.history-table-card h3,
.history-screenshots-card h3 {
    margin: 0 0 1rem;
    font-size: 1rem;
    color: var(--text-primary);
}

/* Position Chart */
.position-chart-container {
    position: relative;
}

.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

/* Chart colors */
:root {
    --chart-color-1: #6366f1;
    --chart-color-2: #10b981;
    --chart-color-3: #f59e0b;
    --chart-color-4: #ef4444;
    --chart-color-5: #8b5cf6;
}

/* Daily chart bars - specifically for charts with .chart-day children */
.chart-bars.daily-chart {
    display: flex;
    gap: 0.5rem;
    height: 200px;
    align-items: flex-end;
    padding-left: 30px;
    overflow-x: auto;
}

.chart-day {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.chart-bars-group {
    display: flex;
    gap: 2px;
    height: 180px;
    align-items: flex-end;
}

.chart-bar {
    width: 8px;
    border-radius: 2px 2px 0 0;
    transition: height 0.3s ease;
    min-height: 2px;
}

.chart-date {
    font-size: 0.7rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.chart-y-axis {
    position: absolute;
    left: 0;
    top: 40px;
    height: 180px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.chart-empty {
    padding: 2rem;
    text-align: center;
    color: var(--text-muted);
}

/* History Table */
.history-table {
    width: 100%;
    border-collapse: collapse;
}

.history-table th,
.history-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.history-table th {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
}

.history-table td {
    font-size: 0.9rem;
    color: var(--text-primary);
}

.change-up {
    color: var(--color-success);
    font-weight: 600;
}

.change-down {
    color: var(--color-error);
    font-weight: 600;
}

.change-none {
    color: var(--text-muted);
}

.empty-row {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem !important;
}

/* Screenshots Grid */
.screenshots-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.screenshot-placeholder {
    aspect-ratio: 16/9;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    color: var(--text-muted);
    text-align: center;
    padding: 1rem;
}

.placeholder-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

/* Settings Tab */
.settings-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 1.5rem;
}

.settings-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
}

.settings-card h3 {
    margin: 0 0 1.25rem;
    font-size: 1rem;
    color: var(--text-primary);
}

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

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
}

.form-group input,
.form-group select {
    padding: 0.65rem 0.875rem;
    font-size: 0.9rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-input);
    color: var(--text-primary);
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.form-group input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.form-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.input-with-button {
    display: flex;
    gap: 0.5rem;
}

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

.settings-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* Status Indicators */
.settings-status {
    grid-column: 1 / -1;
}

.status-indicators {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
}

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

.status-dot.online {
    background: var(--color-success);
    box-shadow: 0 0 6px var(--color-success);
}

.status-dot.offline {
    background: var(--text-muted);
}

.status-item span:nth-child(2) {
    flex: 1;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.status-label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.backend-note {
    font-size: 0.85rem;
    color: var(--text-secondary);
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border-radius: 8px;
    margin: 0;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: none; /* Hidden by default - .active class shows it */
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 1rem;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    border-radius: 12px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-content.modal-large {
    max-width: 700px;
}

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

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

.modal-close {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

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

.modal-body {
    padding: 1.5rem;
}

.form-actions,
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

/* Site Details Modal */
.site-details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.detail-section h4 {
    margin: 0 0 1rem;
    font-size: 0.9rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 600;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
}

.detail-row span:first-child {
    color: var(--text-muted);
}

.detail-row a {
    color: var(--accent-primary);
    text-decoration: none;
    word-break: break-all;
}

.detail-row a:hover {
    text-decoration: underline;
}

.status-badge {
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
}

.status-badge.status-ok {
    background: rgba(16, 185, 129, 0.1);
    color: var(--color-success);
}

.status-badge.status-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--color-warning);
}

.status-badge.status-critical,
.status-badge.status-error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--color-error);
}

.site-error-banner {
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(239, 68, 68, 0.1);
    border-radius: 8px;
    color: var(--color-error);
    font-size: 0.9rem;
}

/* Empty State */
.monitoring-empty {
    text-align: center;
    padding: 4rem 2rem;
}

.monitoring-empty .empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.monitoring-empty h3 {
    margin: 0 0 0.5rem;
    color: var(--text-primary);
}

.monitoring-empty p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

/* Nav Badge for Beta */
.nav-badge.nav-beta {
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    color: white;
    font-size: 0.6rem;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-weight: 600;
}

/* Responsive */
@media (max-width: 768px) {
    .monitoring-page {
        padding: 1rem;
    }
    
    .monitoring-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .monitoring-header-right {
        justify-content: flex-end;
    }
    
    .monitoring-summary {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
    }
    
    .sites-grid {
        grid-template-columns: 1fr;
    }
    
    .settings-container {
        grid-template-columns: 1fr;
    }
    
    .site-details-grid {
        grid-template-columns: 1fr;
    }
    
    .history-filters {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-group {
        justify-content: space-between;
    }
}

/* Light Theme Adjustments */
[data-theme="light"] .monitoring-password-gate .password-gate-card {
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}

/* (Legacy .site-card light hover removed — replaced by [data-theme="light"] .sc:hover) */

[data-theme="light"] .alert-item.unread {
    background: rgba(99, 102, 241, 0.03);
}

/* ============================================
   SEO MONITORING v2.0 - Keyword-Based Styles
   ============================================ */

/* API Quota Badge */
.api-quota-badge {
    padding: 0.4rem 0.75rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.api-quota-badge.quota-low {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--color-error);
    color: var(--color-error);
}

/* Summary stat variants */
.summary-value.has-opportunities {
    color: var(--accent-primary);
}

/* Tab badge variants */
.tab-badge.opportunity {
    background: var(--accent-primary);
}

/* Keywords Container */
.keywords-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.keywords-filters {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    flex-wrap: wrap;
}

.filter-stats {
    margin-left: auto;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Keyword GEO Section */
.keyword-geo-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
}

.geo-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
}

.geo-flag {
    font-size: 1.5rem;
}

.geo-name {
    font-weight: 600;
    color: var(--text-primary);
}

.geo-count {
    margin-left: auto;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Keywords Table */
.keywords-table-container {
    overflow-x: auto;
}

.keywords-table {
    width: 100%;
    border-collapse: collapse;
}

.keywords-table th,
.keywords-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.keywords-table th {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    background: var(--bg-tertiary);
}

.keywords-table td {
    font-size: 0.9rem;
    color: var(--text-primary);
}

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

.keywords-table tr.keyword-disabled {
    opacity: 0.5;
}

.keyword-cell strong {
    color: var(--text-primary);
}

/* Priority Badges */
.priority-badge {
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.priority-badge.priority-high {
    background: rgba(239, 68, 68, 0.1);
    color: var(--color-error);
}

.priority-badge.priority-medium {
    background: rgba(245, 158, 11, 0.1);
    color: var(--color-warning);
}

.priority-badge.priority-low {
    background: rgba(107, 114, 128, 0.1);
    color: var(--text-muted);
}

/* Brand Status */
.brand-found {
    color: var(--color-success);
    font-size: 0.85rem;
}

.brand-not-found {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Keyword Actions */
.keyword-actions {
    display: flex;
    gap: 0.25rem;
}

/* Discovery Container */
.discovery-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.discovery-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
}

.discovery-section.discovery-section-warning {
    border-color: var(--color-warning);
    background: rgba(245, 158, 11, 0.02);
}

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

.discovery-section-header h3 {
    margin: 0;
    font-size: 1rem;
    color: var(--text-primary);
}

.section-count {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.discovery-empty-note {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin: 0;
    padding: 1rem 0;
}

/* Discovery Cards */
.discovery-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1rem;
}

.discovery-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    overflow: hidden;
    transition: all 0.2s ease;
}

.discovery-card:hover {
    border-color: var(--accent-primary);
}

.discovery-card-opportunity {
    border-left: 3px solid var(--accent-primary);
}

.discovery-card-new {
    border-left: 3px solid var(--color-success);
}

.discovery-card-cloaking {
    border-left: 3px solid var(--color-warning);
}

.discovery-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
}

.discovery-domain {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.status-badge {
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-badge.opportunity {
    background: rgba(99, 102, 241, 0.1);
    color: var(--accent-primary);
}

.status-badge.new {
    background: rgba(16, 185, 129, 0.1);
    color: var(--color-success);
}

.status-badge.cloaking {
    background: rgba(245, 158, 11, 0.1);
    color: var(--color-warning);
}

.discovery-card-body {
    padding: 1rem;
}

.discovery-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.discovery-rankings {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.ranking-item {
    background: var(--bg-tertiary);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.no-rankings {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.discovery-brand-status {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.85rem;
}

.brand-yes {
    color: var(--color-success);
}

.brand-no {
    color: var(--color-error);
}

.link-yes {
    color: var(--color-success);
}

.link-no {
    color: var(--text-muted);
}

.discovery-card-footer {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--bg-tertiary);
    border-top: 1px solid var(--border-color);
}

/* Discovery Feed */
.discovery-feed {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.feed-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.feed-icon {
    font-size: 1.25rem;
}

.feed-message {
    flex: 1;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.feed-message strong {
    color: var(--accent-primary);
}

.feed-time {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Sites Container */
.sites-container {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.sites-filters {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    flex-wrap: wrap;
}

/* Enhanced Site Card */
.site-card.site-cloaking {
    border: 1px dashed var(--color-warning);
}

.site-brand-status {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    font-size: 0.85rem;
}

.brand-listed {
    color: var(--color-success);
}

.brand-not-listed {
    color: var(--color-error);
}

.has-link {
    color: var(--color-success);
}

.no-link {
    color: var(--text-muted);
}

.site-warning {
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: rgba(245, 158, 11, 0.1);
    border-radius: 6px;
    color: var(--color-warning);
    font-size: 0.8rem;
}

/* Alert enhancements */
.alert-keyword {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-style: italic;
}

.severity-success {
    border-left-color: var(--color-success);
}

/* Settings API Usage */
.api-usage-display {
    padding: 1rem 0;
}

.usage-bar {
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.75rem;
}

.usage-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-success), var(--accent-primary));
    border-radius: 4px;
    transition: width 0.3s ease;
}

.usage-text {
    font-size: 0.9rem;
    color: var(--text-primary);
}

.usage-remaining {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Site Details Modal Enhancements */
.rankings-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.ranking-item-detail {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    background: var(--bg-tertiary);
    border-radius: 6px;
}

.ranking-keyword {
    color: var(--text-primary);
}

.ranking-position {
    font-weight: 600;
    color: var(--accent-primary);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .discovery-cards {
        grid-template-columns: 1fr;
    }
    
    .keywords-filters,
    .sites-filters {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-stats {
        margin-left: 0;
        text-align: center;
    }
    
    .keyword-actions {
        flex-wrap: wrap;
    }
    
    .discovery-section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}

/* ===================================
   AUDIT LOGS PAGE
   =================================== */

.audit-page {
    padding: 2rem;
}

.audit-page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
}

.audit-title h2 {
    font-size: 1.65rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 0.3rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

.audit-actions {
    display: flex;
    gap: 0.5rem;
}

.audit-pill-tabs {
    display: flex;
    gap: 0.6rem;
    margin-bottom: 1.25rem;
    overflow-x: auto;
    padding-bottom: 0.25rem;
    scrollbar-width: thin;
}

.audit-pill-tabs::-webkit-scrollbar {
    height: 4px;
}

.audit-pill-tabs::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
}

.audit-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s ease;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
    user-select: none;
}

.audit-pill:hover {
    border-color: var(--border-color);
    color: var(--text-primary);
}

.audit-pill.active {
    border-color: transparent;
}

.audit-pill .pill-count {
    font-size: 0.8rem;
    font-weight: 600;
    opacity: 0.7;
}

.audit-pill.active.cat-all { background: rgba(148, 163, 184, 0.2); color: #94a3b8; }
.audit-pill.active.cat-partner { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.audit-pill.active.cat-invoice { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.audit-pill.active.cat-user { background: rgba(168, 85, 247, 0.15); color: #c084fc; }
.audit-pill.active.cat-export { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.audit-pill.active.cat-system { background: rgba(100, 116, 139, 0.15); color: #94a3b8; }
.audit-pill.active.cat-settings { background: rgba(236, 72, 153, 0.15); color: #f472b6; }
.audit-pill.active.cat-workspace { background: rgba(34, 211, 238, 0.15); color: #22d3ee; }
.audit-pill.active.cat-retention { background: rgba(251, 146, 60, 0.15); color: #fb923c; }
.audit-pill.active.cat-note { background: rgba(129, 140, 248, 0.15); color: #818cf8; }

.audit-search-row {
    display: flex;
    gap: 0.85rem;
    margin-bottom: 1.25rem;
    align-items: center;
}

.audit-search-input-wrap {
    flex: 1;
    position: relative;
}

.audit-search-input-wrap .audit-search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
    display: flex;
}

.audit-search-input-wrap input {
    width: 100%;
    padding: 0.65rem 0.75rem 0.65rem 2.25rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.925rem;
}

.audit-search-row input[type="date"] {
    padding: 0.6rem 0.85rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.875rem;
    min-width: 140px;
}

.audit-search-row select {
    padding: 0.6rem 0.85rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.875rem;
    min-width: 70px;
}

.audit-event-list {
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border-subtle);
    overflow: hidden;
}

.audit-event-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 0.875rem 1.25rem;
    border-bottom: 1px solid var(--border-subtle);
    cursor: pointer;
    transition: background 0.15s ease;
}

.audit-event-row:last-child {
    border-bottom: none;
}

.audit-event-row:hover {
    background: var(--bg-tertiary);
}

.audit-event-row.expanded {
    background: var(--bg-tertiary);
    border-bottom: none;
}

.audit-event-left {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    flex: 1;
    min-width: 0;
}

.audit-event-icon {
    width: 34px;
    height: 34px;
    min-width: 34px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 2px;
}

.audit-event-icon.cat-partner { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.audit-event-icon.cat-invoice { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.audit-event-icon.cat-user { background: rgba(168, 85, 247, 0.15); color: #c084fc; }
.audit-event-icon.cat-export { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.audit-event-icon.cat-system { background: rgba(100, 116, 139, 0.15); color: #94a3b8; }
.audit-event-icon.cat-settings { background: rgba(236, 72, 153, 0.15); color: #f472b6; }
.audit-event-icon.cat-workspace { background: rgba(34, 211, 238, 0.15); color: #22d3ee; }
.audit-event-icon.cat-retention { background: rgba(251, 146, 60, 0.15); color: #fb923c; }
.audit-event-icon.cat-note { background: rgba(129, 140, 248, 0.15); color: #818cf8; }

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

.audit-event-line1 {
    font-size: 0.925rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.audit-event-line1 .subject {
    color: var(--text-muted);
    font-weight: 400;
    font-size: 0.85rem;
    margin-left: 0.35rem;
}

.audit-event-line2 {
    font-size: 0.825rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.audit-event-right {
    text-align: right;
    white-space: nowrap;
    margin-left: 1.25rem;
    flex-shrink: 0;
}

.audit-event-user {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.audit-event-time {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

.audit-status-chip {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
}

.audit-status-chip.status-hunting { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }
.audit-status-chip.status-contacted { background: rgba(59, 130, 246, 0.15); color: #3b82f6; }
.audit-status-chip.status-live { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.audit-status-chip.status-connected { background: rgba(20, 184, 166, 0.15); color: #14b8a6; }
.audit-status-chip.status-dead { background: rgba(107, 114, 128, 0.15); color: #6b7280; }

.audit-role-badge {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
    background: rgba(168, 85, 247, 0.15);
    color: #c084fc;
}

.audit-detail-panel {
    padding: 1rem 1.25rem 1rem 4rem;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-subtle);
    font-size: 0.9rem;
    display: none;
}

.audit-detail-panel.visible {
    display: block;
}

.audit-detail-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.45rem 1.25rem;
    margin-bottom: 0.5rem;
}

.audit-detail-label {
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 500;
}

.audit-detail-value {
    color: var(--text-primary);
    font-size: 0.75rem;
    word-break: break-word;
}

.audit-detail-value a {
    color: var(--accent);
    text-decoration: none;
}

.audit-detail-value a:hover {
    text-decoration: underline;
}

.audit-raw-toggle {
    font-size: 0.7rem;
    color: var(--text-muted);
    cursor: pointer;
    margin-top: 0.5rem;
    display: inline-block;
}

.audit-raw-toggle:hover {
    color: var(--text-primary);
}

.audit-raw-json {
    display: none;
    margin-top: 0.35rem;
    padding: 0.5rem;
    background: var(--bg-primary);
    border-radius: 6px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    color: var(--text-muted);
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 200px;
    overflow-y: auto;
}

.audit-raw-json.visible {
    display: block;
}

.audit-event-row.grouped {
    border-left: 3px solid var(--accent);
}

.audit-group-badge {
    display: inline-block;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    padding: 0.05rem 0.4rem;
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-left: 0.35rem;
}

.audit-skeleton-row {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-subtle);
}

.audit-skeleton-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: var(--bg-tertiary);
    animation: auditPulse 1.5s ease-in-out infinite;
}

.audit-skeleton-lines {
    flex: 1;
}

.audit-skeleton-line {
    height: 10px;
    border-radius: 4px;
    background: var(--bg-tertiary);
    animation: auditPulse 1.5s ease-in-out infinite;
}

.audit-skeleton-line:first-child {
    width: 60%;
    margin-bottom: 0.5rem;
}

.audit-skeleton-line:last-child {
    width: 40%;
}

@keyframes auditPulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 0.8; }
}

.audit-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    text-align: center;
}

.audit-empty-state .empty-icon {
    color: var(--text-muted);
    opacity: 0.4;
    margin-bottom: 0.75rem;
}

.audit-empty-state .empty-text {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.audit-empty-state .empty-subtext {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.audit-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    margin-top: 0.75rem;
}

.audit-pagination .pagination-info {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.audit-pagination .pagination-controls {
    display: flex;
    gap: 0.5rem;
}

.audit-pagination .btn[disabled] {
    opacity: 0.4;
    pointer-events: none;
}

@media (max-width: 768px) {
    .audit-page {
        padding: 1rem;
    }

    .audit-page-header {
        flex-direction: column;
        gap: 0.75rem;
    }

    .audit-search-row {
        flex-wrap: wrap;
    }

    .audit-search-input-wrap {
        width: 100%;
    }

    .audit-event-line1 {
        white-space: normal;
    }

    .audit-event-right {
        display: none;
    }

    .audit-event-row {
        padding: 0.6rem 0.75rem;
    }
}

/* ============================================
   MONITORING - Device Badges & Form Row
   ============================================ */

.device-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.device-badge.device-desktop {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
}

.device-badge.device-mobile {
    background: rgba(168, 85, 247, 0.15);
    color: #c084fc;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 500px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

.settings-api .form-hint a {
    color: var(--accent-primary);
    text-decoration: none;
}

.settings-api .form-hint a:hover {
    text-decoration: underline;
}

.backend-note.success {
    color: var(--color-success);
    background: rgba(16, 185, 129, 0.1);
    padding: 0.75rem;
    border-radius: 6px;
    margin-top: 1rem;
}

.cleanup-actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.cleanup-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.cleanup-row strong {
    font-size: 0.9rem;
    color: var(--text-primary);
}

.cleanup-row .form-hint {
    margin-top: 0.25rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.keywords-table .keyword-actions {
    display: flex;
    gap: 0.25rem;
}

.keywords-table .keyword-actions .btn-small {
    padding: 0.25rem 0.4rem;
    min-width: auto;
}

/* Position change indicators */
.pos-up {
    color: var(--color-success);
    font-weight: 600;
    font-size: 0.75rem;
    margin-left: 0.25rem;
}

.pos-down {
    color: var(--color-error);
    font-weight: 600;
    font-size: 0.75rem;
    margin-left: 0.25rem;
}

/* API Status Grid */
.api-status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.api-status-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border-radius: 8px;
}

.api-status-item .api-icon {
    font-size: 1.25rem;
}

.api-status-item .api-name {
    flex: 1;
    color: var(--text-secondary);
}

.api-status-item .api-status {
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

.api-status-item .api-status.online {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.api-note {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

/* Screenshot Modal */
.modal-screenshot {
    max-width: 900px;
    width: 95%;
}

.screenshot-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-subtle);
}

.screenshot-keyword {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text-primary);
}

.screenshot-details {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.screenshot-time {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-left: auto;
}

.screenshot-brand-status {
    margin-bottom: 1rem;
}

.brand-found-large {
    display: block;
    padding: 0.75rem 1rem;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 8px;
    color: #10b981;
    font-weight: 500;
}

.brand-not-found-large {
    display: block;
    padding: 0.75rem 1rem;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
    color: #ef4444;
    font-weight: 500;
}

.screenshot-container {
    background: var(--bg-tertiary);
    border-radius: 8px;
    overflow: hidden;
    max-height: 500px;
    overflow-y: auto;
}

.screenshot-container img {
    width: 100%;
    display: block;
}

.screenshot-error {
    padding: 2rem;
    text-align: center;
    color: var(--text-muted);
}

/* SERP Results Modal */
.serp-results-header {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-secondary);
}

.serp-brand-check {
    margin-bottom: 1rem;
}

.brand-found-box {
    padding: 0.75rem 1rem;
    background: rgba(16, 185, 129, 0.1);
    border-left: 4px solid #10b981;
    border-radius: 4px;
    color: var(--text-primary);
}

.brand-not-found-box {
    padding: 0.75rem 1rem;
    background: rgba(239, 68, 68, 0.1);
    border-left: 4px solid #ef4444;
    border-radius: 4px;
    color: var(--text-primary);
}

.serp-results-list {
    max-height: 400px;
    overflow-y: auto;
}

.serp-result-item {
    display: flex;
    gap: 1rem;
    padding: 0.75rem;
    border-radius: 6px;
    margin-bottom: 0.5rem;
    background: var(--bg-tertiary);
    transition: background 0.2s;
}

.serp-result-item:hover {
    background: var(--bg-hover);
}

.serp-result-item.brand-highlight {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.serp-position {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--accent-primary);
    min-width: 2.5rem;
}

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

.serp-title {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.serp-domain {
    font-size: 0.85rem;
    color: var(--accent-primary);
    margin-bottom: 0.25rem;
}

.serp-snippet {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.serp-link {
    align-self: center;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 1.2rem;
}

.serp-link:hover {
    color: var(--accent-primary);
}

.no-results {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
}

.modal-footer {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    padding-top: 1rem;
    border-top: 1px solid var(--border-subtle);
    margin-top: 1rem;
}

/* ============================================
   AURORA GLASS - Standalone utility class
   ============================================ */
.card-aurora {
    background: rgba(20, 26, 35, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(16, 185, 129, 0.12);
    border-radius: 16px;
    position: relative;
    overflow: hidden;
}

/* ============================================
   DATA GLOW SYSTEM
   ============================================ */
.metric-positive,
.trend-up {
    color: var(--accent-green);
    text-shadow: 0 0 20px rgba(16, 185, 129, 0.3);
}

.metric-negative,
.trend-down {
    color: var(--accent-red);
    text-shadow: 0 0 20px rgba(239, 68, 68, 0.3);
}

.metric-neutral {
    color: var(--accent-yellow);
    text-shadow: 0 0 20px rgba(245, 158, 11, 0.2);
}

.metric-hero {
    font-size: 2rem;
    font-weight: 800;
    animation: metric-glow 3s ease-in-out infinite;
}

@keyframes metric-glow {
    0%, 100% { text-shadow: 0 0 20px rgba(16, 185, 129, 0.25); }
    50% { text-shadow: 0 0 35px rgba(16, 185, 129, 0.5); }
}

[data-theme="light"] .metric-positive,
[data-theme="light"] .trend-up {
    text-shadow: none;
}

[data-theme="light"] .metric-negative,
[data-theme="light"] .trend-down {
    text-shadow: none;
}

[data-theme="light"] .metric-hero {
    animation: none;
}

/* ============================================
   ACCESSIBILITY: REDUCED MOTION
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ============================================
   FOCUS VISIBLE STYLES
   ============================================ */
:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
    border-radius: 4px;
}

.nav-link:focus-visible,
.btn-primary:focus-visible,
.btn-secondary:focus-visible,
button:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.15);
}

:focus:not(:focus-visible) {
    outline: none;
}

/* ============================================
   SKELETON LOADING SYSTEM (Enhanced)
   ============================================ */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--bg-tertiary) 25%,
        var(--bg-card) 50%,
        var(--bg-tertiary) 75%
    );
    background-size: 200% 100%;
    animation: skeleton-wave 1.5s ease-in-out infinite;
    border-radius: 6px;
}

.skeleton-text {
    height: 1rem;
    margin-bottom: 0.5rem;
}

.skeleton-circle {
    border-radius: 50%;
}

.skeleton-card {
    padding: 1.25rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
}

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

.skeleton-card-title {
    flex: 1;
}

.skeleton-stats-card {
    padding: 1.25rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
}

.skeleton-homepage {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.skeleton-modules {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.skeleton-activity-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.75rem 0;
}

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

/* ============================================
   CLICKABLE ELEMENT CURSOR
   ============================================ */
.stat-card,
.module-card,
.card-aurora,
.partner-row,
.event-card,
.clickable,
[onclick],
[data-action] {
    cursor: pointer;
}

/* ============================================
   KEYBOARD NAVIGATION: ROW SELECTION
   ============================================ */
.row-selected {
    background: rgba(16, 185, 129, 0.08) !important;
    outline: 1px solid rgba(16, 185, 129, 0.3);
    outline-offset: -1px;
}

[data-theme="light"] .row-selected {
    background: rgba(5, 150, 105, 0.06) !important;
    outline: 1px solid rgba(5, 150, 105, 0.25);
}

/* ============================================
   CONTEXT MENU
   ============================================ */
/* Styles injected by context-menu.js */

/* ============================================
   SMART EMPTY STATES
   ============================================ */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    text-align: center;
    min-height: 300px;
}

.empty-state-icon {
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border-radius: 16px;
    margin-bottom: 1.5rem;
    color: var(--text-muted);
}

.empty-state-icon svg {
    opacity: 0.5;
}

.empty-state-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.empty-state-description {
    color: var(--text-secondary);
    max-width: 360px;
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.empty-state-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.empty-state-btn-secondary {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 200ms ease;
}

.empty-state-btn-secondary:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.empty-state-tip {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--text-muted);
    background: var(--bg-tertiary);
    padding: 0.5rem 1rem;
    border-radius: 8px;
}

.empty-state-tip kbd {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 1px 5px;
    font-family: inherit;
    font-size: 0.75rem;
}

/* ============================================
   SUCCESS CELEBRATIONS
   ============================================ */
.success-ripple {
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    animation: ripple-out 0.6s ease-out forwards;
}

@keyframes ripple-out {
    0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
    100% { box-shadow: 0 0 0 20px rgba(16, 185, 129, 0); }
}

.confetti-container {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 99999;
    overflow: hidden;
}

.confetti-piece {
    position: absolute;
    top: -10px;
    width: 10px;
    height: 10px;
    border-radius: 2px;
    animation: confetti-fall linear forwards;
}

@keyframes confetti-fall {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

.status-transition {
    transition: all 0.3s ease;
}

/* =====================================================
   TENANT ADMIN PAGE
   ===================================================== */
.tenant-admin-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}

.tenant-admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.tenant-admin-header h2 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 24px;
    font-weight: 700;
    margin: 0;
}

.tenant-admin-header h2 .subtitle {
    font-size: 13px;
    font-weight: 400;
    color: var(--text-secondary, #8a8f98);
    margin-left: 4px;
}

.tenant-context-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    background: rgba(102, 126, 234, 0.1);
    border: 1px solid rgba(102, 126, 234, 0.25);
    border-radius: 10px;
    margin-bottom: 24px;
    font-size: 14px;
}

.tenant-context-bar strong {
    color: #667eea;
}

.tenant-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 28px;
}

.tenant-stat-card {
    background: var(--card-bg, rgba(255,255,255,0.04));
    border: 1px solid var(--border-color, rgba(255,255,255,0.08));
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    transition: border-color 0.2s;
}

.tenant-stat-card:hover {
    border-color: rgba(102, 126, 234, 0.3);
}

.tenant-stat-card .stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 10px;
}

.tenant-stat-card .stat-icon.purple { background: rgba(102, 126, 234, 0.15); color: #667eea; }
.tenant-stat-card .stat-icon.green { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.tenant-stat-card .stat-icon.amber { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }
.tenant-stat-card .stat-icon.blue { background: rgba(59, 130, 246, 0.15); color: #3b82f6; }

.tenant-stat-card .stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary, #fff);
    line-height: 1;
    margin-bottom: 4px;
}

.tenant-stat-card .stat-label {
    font-size: 12px;
    color: var(--text-secondary, #8a8f98);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tenant-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 16px;
}

.tenant-card-v2 {
    background: var(--card-bg, rgba(255,255,255,0.04));
    border: 1px solid var(--border-color, rgba(255,255,255,0.08));
    border-radius: 14px;
    padding: 24px;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}

.tenant-card-v2:hover {
    border-color: rgba(102, 126, 234, 0.3);
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.tenant-card-v2.active-viewing {
    border-color: rgba(102, 126, 234, 0.5);
}

.tenant-card-v2.active-viewing::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #667eea, #764ba2);
}

.tenant-card-v2.suspended-card {
    opacity: 0.6;
}

.tenant-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 16px;
}

.tenant-card-identity {
    display: flex;
    align-items: center;
    gap: 12px;
}

.tenant-card-avatar {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    color: white;
    flex-shrink: 0;
}

.tenant-card-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary, #fff);
    margin-bottom: 2px;
}

.tenant-card-id {
    font-size: 12px;
    color: var(--text-secondary, #8a8f98);
    font-family: monospace;
}

.tenant-status-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.tenant-status-badge.active { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.tenant-status-badge.suspended { background: rgba(239, 68, 68, 0.15); color: #ef4444; }

.tenant-card-meta {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
    font-size: 13px;
    color: var(--text-secondary, #8a8f98);
}

.tenant-card-meta span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.tenant-card-actions-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding-top: 14px;
    border-top: 1px solid var(--border-color, rgba(255,255,255,0.06));
}

.tenant-card-actions-row .btn-small {
    padding: 7px 10px;
    border-radius: 8px;
    font-size: 11.5px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    transition: all 0.15s;
}

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

.tenant-empty-state svg {
    opacity: 0.3;
    margin-bottom: 16px;
}

.tenant-empty-state p {
    font-size: 15px;
}

@media (max-width: 768px) {
    .tenant-stats-grid { grid-template-columns: repeat(2, 1fr); }
    .tenant-cards-grid { grid-template-columns: 1fr; }
}


/* ============================================
   MONITORING v3.0 STYLES
   ============================================ */

/* Dashboard Grid — scoped to monitoring to avoid conflicts */
.monitoring-page .dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 300px;
    grid-template-rows: auto 1fr;
    gap: 20px;
}

.monitoring-page .dashboard-stats {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.monitoring-page .stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.monitoring-page .stat-card.stat-critical {
    border-color: #dc2626;
    background: rgba(220, 38, 38, 0.1);
}

.monitoring-page .stat-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border-radius: 12px;
    color: var(--accent-primary);
}

.monitoring-page .stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
}

.monitoring-page .stat-label {
    font-size: 13px;
    color: var(--text-muted);
}

.dashboard-main {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.dashboard-sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.dashboard-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
}

.monitoring-page .card-header h3 {
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-content {
    padding: 16px 20px;
}

/* Alert Items */
.alert-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

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

.alert-item.alert-critical .alert-icon { color: #dc2626; }
.alert-item.alert-warning .alert-icon { color: #f59e0b; }
.alert-item.alert-info .alert-icon { color: #3b82f6; }

.alert-message {
    font-size: 14px;
    color: var(--text-primary);
}

.alert-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Share of Voice Chart */
.sov-chart {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sov-bar {
    display: grid;
    grid-template-columns: 120px 1fr 50px;
    align-items: center;
    gap: 12px;
}

.sov-bar.sov-brand .sov-label {
    font-weight: 600;
    color: var(--accent-primary);
}

.sov-bar.sov-brand .sov-bar-fill {
    background: var(--accent-primary);
}

.sov-label {
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sov-bar-container {
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
}

.sov-bar-fill {
    height: 100%;
    background: var(--text-muted);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.sov-percent {
    font-size: 12px;
    font-weight: 600;
    text-align: right;
}

/* Brand Status */
.brand-status {
    text-align: center;
}

.brand-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.brand-domain {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}

.brand-metrics {
    display: flex;
    justify-content: center;
    gap: 32px;
    margin-top: 16px;
}

.metric {
    text-align: center;
}

.metric-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.metric-label {
    font-size: 12px;
    color: var(--text-muted);
}

/* Keywords */
.keywords-header {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.monitoring-page .keywords-filters {
    display: flex;
    gap: 8px;
    margin-left: auto;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 0;
}

.monitoring-page .keywords-filters .filter-select {
    padding: 6px 10px;
    font-size: 13px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-card);
    color: var(--text-primary);
    min-width: 120px;
}

.monitoring-page .filter-count {
    font-size: 12px;
    color: var(--text-muted);
    margin-left: 4px;
    background: none;
    font-weight: normal;
    padding: 0;
    border-radius: 0;
}

/* Date Range Picker */
.monitoring-page .date-range-picker {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 16px;
}

.monitoring-page .date-range-label {
    font-size: 13px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.monitoring-page .date-range-option {
    padding: 4px 12px;
    font-size: 12px;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
}

.monitoring-page .date-range-option:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.monitoring-page .date-range-option.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: #fff;
}

.monitoring-page .date-range-refresh {
    display: none;
    transition: all 0.15s;
    margin-left: 4px;
}

.monitoring-page .date-range-refresh:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

/* Monitoring Geo Selector */
.monitoring-geo-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
    min-height: 32px;
}

.monitoring-geo-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 12px;
    color: var(--text-primary);
}

.monitoring-geo-chip .chip-remove {
    cursor: pointer;
    color: var(--text-muted);
    font-size: 16px;
    line-height: 1;
    margin-left: 2px;
    transition: color 0.15s;
}

.monitoring-geo-chip .chip-remove:hover {
    color: var(--accent-red, #ef4444);
}

.monitoring-geo-chip .flag-icon {
    width: 16px;
    height: 12px;
    display: inline-block;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    border-radius: 1px;
    flex-shrink: 0;
}

.monitoring-geo-search-wrapper {
    position: relative;
}

.monitoring-geo-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    max-height: 250px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 10px 30px rgba(0,0,0,0.35);
    margin-top: 4px;
    padding: 4px 0;
}

.monitoring-geo-suggestion {
    padding: 9px 14px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.15s;
    border-left: 3px solid transparent;
}

.monitoring-geo-suggestion:hover {
    background: var(--bg-tertiary);
    border-left-color: var(--accent-primary);
}

.monitoring-geo-suggestion strong {
    min-width: 30px;
    color: var(--accent-primary);
}

.monitoring-geo-suggestion .flag-icon {
    width: 20px;
    height: 14px;
    display: inline-block;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    border-radius: 1px;
    flex-shrink: 0;
}

/* Load More button */
.monitoring-page .load-more-container {
    display: flex;
    justify-content: center;
    padding: 16px 0;
}

.monitoring-page .load-more-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.keywords-count {
    font-size: 14px;
    color: var(--text-muted);
}

.keywords-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* DEPRECATED: keyword-card styles replaced by .kw-row expandable rows (Phase 1).
   Kept temporarily for safety; remove after Phase 1 verification. */
.keyword-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px 20px;
    transition: border-color 0.2s;
}

.keyword-card:hover {
    border-color: var(--accent-primary);
}

.keyword-card.keyword-disabled {
    opacity: 0.6;
}

.keyword-main {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.keyword-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.keyword-meta {
    font-size: 13px;
    color: var(--text-muted);
    margin-left: 12px;
}

.keyword-details {
    display: flex;
    gap: 16px;
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-muted);
}

.keyword-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

/* =========================================
   KEYWORD EXPANDABLE ROWS (Phase 1)
   ========================================= */

.monitoring-page .kw-row {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    margin-bottom: 6px;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
    overflow: hidden;
}

.monitoring-page .kw-row:hover {
    border-color: var(--accent-primary);
}

.monitoring-page .kw-row.expanded {
    border-color: var(--accent-primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.monitoring-page .kw-row.failed {
    border-left: 3px solid var(--danger-color, #ef4444);
}

.monitoring-page .kw-row.keyword-disabled {
    opacity: 0.6;
}

.monitoring-page .kw-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    min-height: 42px;
    gap: 12px;
}

.monitoring-page .kw-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    min-width: 0;
}

.monitoring-page .kw-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.monitoring-page .kw-chevron {
    display: flex;
    align-items: center;
    transition: transform 0.2s;
    color: var(--text-muted);
    flex-shrink: 0;
}

.monitoring-page .kw-row.expanded .kw-chevron {
    transform: rotate(90deg);
}

.monitoring-page .kw-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 280px;
}

.monitoring-page .kw-geo {
    display: inline-flex;
    align-items: center;
    padding: 1px 6px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-secondary, rgba(0,0,0,0.04));
    border-radius: 4px;
    letter-spacing: 0.5px;
}

.monitoring-page .kw-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    font-size: 11px;
    color: var(--text-muted);
    background: var(--bg-secondary, rgba(0,0,0,0.04));
    border-radius: 4px;
}

.monitoring-page .kw-mini-stats {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 12px;
    color: var(--text-muted);
}

.monitoring-page .kw-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    font-size: 11px;
    font-weight: 500;
    border-radius: 12px;
    background: var(--bg-secondary, rgba(0,0,0,0.04));
    color: var(--text-muted);
    white-space: nowrap;
}

.monitoring-page .kw-badge.success {
    background: var(--success-bg, rgba(34, 197, 94, 0.1));
    color: var(--success-color, #16a34a);
}

.monitoring-page .kw-badge.failed {
    background: var(--danger-bg, rgba(239, 68, 68, 0.1));
    color: var(--danger-color, #ef4444);
}

.monitoring-page .kw-expand-body {
    padding: 0 16px 16px;
    border-top: 1px solid var(--border-color);
}

.monitoring-page .kw-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    padding: 16px 0;
}

.monitoring-page .kw-stat {
    text-align: center;
}

.monitoring-page .kw-stat-value {
    display: block;
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.monitoring-page .kw-stat-label {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.monitoring-page .kw-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
    flex-wrap: wrap;
}

.monitoring-page .kw-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
}

.monitoring-page .kw-action-btn:hover {
    border-color: var(--text-muted);
    background: var(--bg-secondary, rgba(0,0,0,0.02));
}

.monitoring-page .kw-action-btn.primary {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: #fff;
}

.monitoring-page .kw-action-btn.primary:hover {
    opacity: 0.9;
}

.monitoring-page .kw-action-btn.danger {
    color: var(--danger-color, #ef4444);
    border-color: var(--danger-color, #ef4444);
}

.monitoring-page .kw-action-btn.danger:hover {
    background: var(--danger-bg, rgba(239, 68, 68, 0.1));
}

@media (max-width: 640px) {
    .monitoring-page .kw-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .monitoring-page .kw-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }
    .monitoring-page .kw-name {
        max-width: 100%;
    }
}

/* Status Badges */
.status-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 4px;
    text-transform: uppercase;
}

.status-success { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.status-warning { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }
.status-error { background: rgba(220, 38, 38, 0.15); color: #dc2626; }
.status-pending { background: var(--bg-tertiary); color: var(--text-muted); }

/* (Legacy metric/site-footer styles removed — replaced by .sc-* styles) */

/* Alerts */
.alerts-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.alerts-stats {
    display: flex;
    gap: 12px;
}

.stat-pill {
    font-size: 12px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 20px;
}

.stat-pill.stat-new {
    background: rgba(220, 38, 38, 0.15);
    color: #dc2626;
}

.stat-pill.stat-ack {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
}

.alerts-filters {
    display: flex;
    gap: 12px;
}

.alerts-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.alert-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px 20px;
    border-left: 4px solid;
}

.alert-card.alert-critical { border-left-color: #dc2626; }
.alert-card.alert-warning { border-left-color: #f59e0b; }
.alert-card.alert-info { border-left-color: #3b82f6; }

.alert-card.alert-status-fixed { opacity: 0.6; }
.alert-card.alert-status-snoozed { opacity: 0.6; }

.alert-main {
    display: flex;
    gap: 12px;
}

.alert-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.alert-status-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--bg-tertiary);
    text-transform: uppercase;
}

/* Settings */
.settings-container {
    max-width: 800px;
}

.settings-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
}

.settings-section h3 {
    margin: 0 0 20px 0;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
}

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

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

.form-grid .full-width {
    grid-column: 1 / -1;
}

.settings-actions {
    padding-top: 20px;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    width: 48px;
    height: 26px;
    display: inline-block;
}

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

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-tertiary);
    transition: 0.3s;
    border-radius: 26px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

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

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

/* Modals */
.modal-large {
    max-width: 900px;
    width: 90%;
}

.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    cursor: pointer;
}

.checkbox-item:hover {
    background: var(--border-color);
}

/* Screenshot Viewer */
.screenshot-viewer {
    max-width: 95vw;
    max-height: 95vh;
    overflow-y: auto;
    background: var(--bg-card);
    border-radius: 12px;
    padding: 8px;
}

.screenshot-viewer img {
    width: 800px;
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

/* View PDF Button - Prominent CTA */
.pdf-section {
    margin-top: 16px;
}

.view-pdf-btn {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 24px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border-radius: 12px;
    color: white;
    text-decoration: none;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.view-pdf-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.4);
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

.view-pdf-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.view-pdf-text strong {
    font-size: 16px;
    font-weight: 600;
}

.view-pdf-text small {
    font-size: 12px;
    opacity: 0.85;
}

/* Legacy .btn-pdf-small kept for other pages */
.btn-pdf-small {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.15s;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.btn-pdf-small:hover {
    background: rgba(16, 185, 129, 0.25);
    border-color: rgba(16, 185, 129, 0.5);
}

/* SERP Results */
.serp-results {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.serp-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border-radius: 8px;
}

.serp-item.serp-brand {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.serp-rank {
    font-weight: 700;
    color: var(--text-muted);
    min-width: 30px;
}

.serp-title {
    font-weight: 500;
    color: var(--text-primary);
}

.serp-domain {
    font-size: 12px;
    color: var(--text-muted);
}

/* Competitors Table */
.competitors-table {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 12px;
    text-transform: uppercase;
}

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

.data-table tbody tr:hover {
    background: var(--bg-tertiary);
}

.competitor-name {
    font-weight: 600;
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Tab count badge */
.tab-count {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 6px;
    background: var(--bg-tertiary);
    border-radius: 10px;
    margin-left: 6px;
}

/* Monitoring disabled badge */
.monitoring-disabled-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: #f59e0b;
    padding: 6px 12px;
    background: rgba(245, 158, 11, 0.15);
    border-radius: 6px;
}

/* Monitoring loading */
.monitoring-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 3rem;
    color: var(--text-muted);
}

/* Scan items */
.scan-item {
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

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

.scan-keyword {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 14px;
}

.scan-meta {
    display: flex;
    gap: 8px;
    align-items: center;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.scan-status {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 11px;
}

.scan-success { color: #10b981; }
.scan-pending { color: var(--text-muted); }
.scan-failed { color: #dc2626; }

/* Text color helpers */
.text-success { color: #10b981; }
.text-error { color: #dc2626; }

/* Site detail grid */
.site-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 0;
}

.detail-section {
    margin-bottom: 20px;
}

.detail-section-full {
    grid-column: 1 / -1;
}

.detail-section h4 {
    margin: 0 0 12px 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

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

.detail-section-header h4 {
    margin: 0;
}

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

/* Modal header layout */
.modal-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.modal-header-left h3 {
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.modal-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.modal-badges {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

/* Device and geo badges */
.device-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.device-desktop {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
}

.device-mobile {
    background: rgba(168, 85, 247, 0.15);
    color: #c084fc;
}

.geo-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
}

.detail-metrics {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.detail-metric {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Casino list */
.casino-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.casino-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    background: var(--bg-tertiary);
    border-radius: 6px;
    font-size: 13px;
}

.casino-rank {
    font-weight: 700;
    color: var(--text-muted);
    min-width: 24px;
}

.casino-name {
    font-weight: 500;
    color: var(--text-primary);
}

.casino-bonus {
    font-size: 12px;
    color: var(--text-muted);
    margin-left: auto;
}

/* Crawl history */
.crawl-history {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.history-item {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border-radius: 6px;
    font-size: 13px;
}

.history-time {
    color: var(--text-muted);
    min-width: 140px;
    font-size: 12px;
}

.history-geo {
    color: var(--text-secondary);
    font-size: 12px;
    text-transform: uppercase;
    font-weight: 600;
}

.history-status {
    color: var(--text-muted);
}

.history-position {
    font-weight: 600;
    color: var(--accent-primary);
}

.history-item .btn-tiny {
    margin-left: auto;
}

/* (Legacy .site-footer-actions removed — replaced by .sc-actions) */

/* Delete / danger text button */
.btn-text-danger {
    color: var(--text-muted);
    opacity: 0.5;
    transition: opacity 0.2s, color 0.2s;
}

.btn-text-danger:hover {
    color: #ef4444;
    opacity: 1;
}

/* Small icon-only button */
.btn-tiny {
    padding: 2px 4px;
    font-size: 12px;
    line-height: 1;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
}

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

/* Outline button variant */
.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    text-decoration: none;
    transition: border-color 0.2s, color 0.2s;
}

.btn-outline:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

/* Competitor detail */
.competitor-stats {
    display: flex;
    gap: 32px;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.competitor-stats .stat {
    text-align: center;
}

.competitor-sites {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.competitor-site-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border-radius: 6px;
    font-size: 13px;
}

/* Bulk Delete / Select Mode (legacy .sites-header replaced by .sites-toolbar) */

.btn-active {
    background: var(--accent-primary) !important;
    color: white !important;
    border-color: var(--accent-primary) !important;
}

.btn-warning.btn-icon {
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.2);
    color: #f59e0b;
}

.btn-warning.btn-icon:hover {
    background: rgba(245, 158, 11, 0.15);
    border-color: #f59e0b;
}

/* (Legacy .site-checkbox / .site-card-selected removed — replaced by .sc-check / .sc-selected) */

.bulk-action-bar {
    position: sticky;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    margin-top: 16px;
    background: var(--bg-card);
    border: 1px solid var(--accent-primary);
    border-radius: 12px;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    z-index: 10;
}

.bulk-count {
    font-weight: 600;
    color: var(--text-primary);
}

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

.btn-danger-outline:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* Monitoring Responsive */
@media (max-width: 1024px) {
    .monitoring-page .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .monitoring-page .dashboard-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .checkbox-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .site-detail-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .monitoring-page .dashboard-stats {
        grid-template-columns: 1fr;
    }
    
    .sites-grid {
        grid-template-columns: 1fr;
    }
    
    .alerts-header {
        flex-direction: column;
        gap: 12px;
    }
}

/* ============================================
   SYNC HEALTH — Admin dashboard page
   ============================================ */

#page-sync-health .sync-health-panel {
    padding: 24px;
}

.sync-health-panel.no-tenants {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-secondary);
}

.sync-alert-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    margin-bottom: 20px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.25);
    border-radius: 10px;
    color: var(--accent-red);
    font-size: 13px;
    font-weight: 500;
}

.sync-alert-banner .status-icon {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.sync-alert-banner .status-icon.status-red {
    background: var(--accent-red);
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
}

.sync-health-panel-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

#page-sync-health .module-card.tenant-card {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0;
    border-radius: 14px;
    overflow: hidden;
    transition: transform 0.15s, box-shadow 0.15s;
}

#page-sync-health .module-card.tenant-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

#page-sync-health .module-card.tenant-card.status-red {
    border-color: rgba(239, 68, 68, 0.3);
}

#page-sync-health .module-card.tenant-card.status-yellow {
    border-color: rgba(234, 179, 8, 0.3);
}

#page-sync-health .module-card.tenant-card.status-green {
    border-color: rgba(16, 185, 129, 0.3);
}

.tenant-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 16px 12px;
}

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

.tenant-card-header .status-dot.status-green {
    background: var(--accent-green);
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
}

.tenant-card-header .status-dot.status-yellow {
    background: var(--accent-yellow);
    box-shadow: 0 0 8px rgba(234, 179, 8, 0.5);
}

.tenant-card-header .status-dot.status-red {
    background: var(--accent-red);
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
    animation: pulse 1.5s infinite;
}

.tenant-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    font-family: monospace;
}

.tenant-card-body {
    padding: 0 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tenant-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12.5px;
}

.tenant-stat .stat-label {
    color: var(--text-secondary);
    font-size: 12.5px;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
}

.tenant-stat .stat-value {
    color: var(--text-primary);
    font-size: 12.5px;
    font-weight: 500;
}

.tenant-failures {
    font-size: 12px;
    color: var(--accent-red);
    padding: 4px 0;
}

.tenant-failures .failures-count {
    font-weight: 700;
}

.progress-bar-container {
    position: relative;
    height: 6px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 4px;
}

.progress-bar-container .progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-cyan), var(--accent-green));
    border-radius: 3px;
    transition: width 0.3s ease;
    width: auto;
}

.progress-bar-container .progress-label {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 9px;
    font-weight: 600;
    color: var(--text-primary);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.tenant-card-actions {
    padding: 10px 16px;
    border-top: 1px solid var(--border-color, rgba(255, 255, 255, 0.06));
}

.btn-trigger-sync {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    font-size: 11.5px;
    font-weight: 500;
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: 8px;
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.btn-trigger-sync:hover {
    background: rgba(102, 126, 234, 0.2);
    border-color: rgba(102, 126, 234, 0.5);
}

/* Trace viewer modal */
.trace-viewer-modal {
    max-height: 60vh;
    overflow-y: auto;
}

.trace-log-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.trace-log-table th,
.trace-log-table td {
    padding: 8px 10px;
    text-align: left;
    border-bottom: 1px solid var(--border-color, rgba(255, 255, 255, 0.06));
}

.trace-log-table th {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: rgba(255, 255, 255, 0.02);
    position: sticky;
    top: 0;
}

.trace-log-table td {
    color: var(--text-primary);
    font-family: monospace;
    font-size: 11.5px;
}

/* Light theme overrides */
[data-theme="light"] .sync-alert-banner {
    background: rgba(239, 68, 68, 0.08);
}

[data-theme="light"] #page-sync-health .module-card.tenant-card {
    background: rgba(255, 255, 255, 0.9);
}

[data-theme="light"] .btn-trigger-sync {
    background: rgba(102, 126, 234, 0.08);
}

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

[data-theme="light"] .trace-log-table th {
    background: rgba(0, 0, 0, 0.02);
}

@media (max-width: 768px) {
    .sync-health-panel-grid {
        grid-template-columns: 1fr;
    }
}

/* ===== Sync Sidebar ===== */

.sync-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    z-index: 100;
    transition: width 0.3s ease, opacity 0.3s ease;
    overflow: hidden;
    background: var(--bg-primary, #fff);
    border-left: 1px solid var(--border-color, #e0e0e0);
    box-shadow: -2px 0 8px rgba(0,0,0,0.06);
}

.sync-sidebar--hidden { width: 0; opacity: 0; pointer-events: none; }
.sync-sidebar--collapsed { width: 48px; opacity: 1; cursor: pointer; }
.sync-sidebar--expanded { width: 360px; opacity: 1; overflow-y: auto; }

.main-content--sidebar-expanded { margin-right: 360px; transition: margin-right 0.3s ease; }
.main-content--sidebar-collapsed { margin-right: 48px; transition: margin-right 0.3s ease; }

.sync-sidebar__strip {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 0;
    gap: 8px;
    height: 100%;
}

.sync-sidebar__strip-icon.spinning { animation: spin 1.5s linear infinite; }

.sync-sidebar__mini-pct {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-secondary, #666);
}

.sync-sidebar__panel {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    height: 100%;
    overflow-y: auto;
}

.sync-sidebar__header {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sync-sidebar__title { font-size: 14px; font-weight: 600; margin: 0; flex: 1; }

.sync-sidebar__badge {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sync-sidebar__badge--idle { background: var(--bg-secondary, #f0f0f0); color: var(--text-secondary, #666); }
.sync-sidebar__badge--queued { background: #fff3e0; color: #e65100; }
.sync-sidebar__badge--running { background: #e3f2fd; color: #1565c0; }
.sync-sidebar__badge--success { background: #e8f5e9; color: #2e7d32; }
.sync-sidebar__badge--warning { background: #fff8e1; color: #f57f17; }
.sync-sidebar__badge--error { background: #fbe9e7; color: #c62828; }

.sync-sidebar__collapse-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    color: var(--text-primary, #333);
    font-size: 20px;
    line-height: 1;
    font-weight: 700;
    opacity: 0.7;
    transition: opacity 0.15s, background 0.15s;
}

.sync-sidebar__collapse-btn:hover { background: var(--bg-secondary, #f0f0f0); opacity: 1; }

.sync-sidebar__hero-progress {
    padding: 1rem;
}

.sync-sidebar__hero-bar {
    width: 100%;
    height: 20px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    overflow: hidden;
    position: relative;
}

.sync-sidebar__hero-fill {
    height: 100%;
    background: linear-gradient(90deg, #10b981, #3b82f6);
    border-radius: 12px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    min-width: 0;
}

.sync-sidebar__hero-glow {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 30px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3));
    border-radius: 0 12px 12px 0;
    animation: syncGlow 1.5s ease-in-out infinite;
}

@keyframes syncGlow {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.8; }
}

.sync-sidebar__hero-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    padding: 0 2px;
}

.sync-sidebar__hero-pct {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.sync-sidebar__hero-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.sync-sidebar__phase-details {
    padding: 0 1rem;
    margin-bottom: 0.5rem;
}

.sync-sidebar__phase-details summary {
    cursor: pointer;
    font-size: 0.8rem;
    color: var(--text-muted);
    padding: 4px 0;
    user-select: none;
}

.sync-sidebar__phase-details summary:hover {
    color: var(--text-secondary);
}

.sync-sidebar__phases {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sync-sidebar__phase {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    padding: 3px 0;
}

.sync-sidebar__phase--done { color: var(--success, #2e7d32); }
.sync-sidebar__phase--running { color: var(--primary, #1565c0); font-weight: 600; }
.sync-sidebar__phase--pending { color: var(--text-tertiary, #999); }

.sync-sidebar__timing {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-secondary, #666);
}

.sync-sidebar__errors { font-size: 12px; }
.sync-sidebar__errors summary { cursor: pointer; color: var(--error, #c62828); font-weight: 600; }
.sync-sidebar__errors ul { padding-left: 16px; margin: 4px 0; }
.sync-sidebar__errors li { margin: 2px 0; }

.sync-sidebar__divider { border: none; border-top: 1px solid var(--border-color, #e0e0e0); margin: 4px 0; }

.sync-sidebar__recent h4 { font-size: 12px; font-weight: 600; margin: 0 0 6px 0; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-secondary, #666); }

.sync-sidebar__recent-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    font-size: 12px;
    color: var(--text-primary, #333);
}

.sync-sidebar__no-history { font-size: 12px; color: var(--text-tertiary, #999); margin: 0; }

.sync-sidebar__footer {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--text-secondary, #666);
    margin-top: auto;
    padding-top: 8px;
    border-top: 1px solid var(--border-color, #e0e0e0);
}

.sync-sidebar__health-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.sync-sidebar__health-dot--good { background: #4caf50; }
.sync-sidebar__health-dot--warning { background: #ff9800; }
.sync-sidebar__health-dot--critical { background: #f44336; }
.sync-sidebar__health-dot--unknown { background: #9e9e9e; }

@media (max-width: 1024px) {
    .sync-sidebar--expanded {
        position: fixed;
        box-shadow: -4px 0 16px rgba(0,0,0,0.15);
    }
    .main-content--sidebar-expanded { margin-right: 0; }
}

@media (max-width: 768px) {
    .sync-sidebar { display: none; }
    .main-content--sidebar-expanded,
    .main-content--sidebar-collapsed { margin-right: 0; }
}

/* ============================================
   RETENTION INTELLIGENCE (ri-*)
   ============================================ */

.ri-page {
    padding: 1.5rem;
    max-width: 1600px;
    margin: 0 auto;
}

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

.ri-title h1 {
    margin: 0 0 0.25rem;
    font-size: 1.75rem;
    color: var(--text-primary);
}

.ri-title p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.ri-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.ri-sync-status {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.ri-sync-status > span {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.ri-sync-idle { color: var(--text-muted); }
.ri-sync-active { color: var(--accent-primary); }
.ri-sync-failure { color: var(--accent-red); }

.ri-sync-spin {
    animation: ri-spin 1.2s linear infinite;
    transform-origin: center;
}

@keyframes ri-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Sync button (matches btn-primary visual language) */
.ri-btn-sync {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--accent-primary);
    color: #fff;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: opacity 0.15s, transform 0.1s;
}

.ri-btn-sync:hover:not(:disabled) {
    opacity: 0.92;
}

.ri-btn-sync:active:not(:disabled) {
    transform: translateY(1px);
}

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

.ri-btn-sync-icon { display: inline-flex; align-items: center; }

/* Clear results button */
.ri-btn-clear {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 0.8rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-muted);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.15s;
}
.ri-btn-clear:hover {
    border-color: var(--danger);
    color: var(--danger);
    background: rgba(220, 53, 69, 0.08);
}

/* Backfill banner */
.ri-backfill-banner {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--status-info-bg, rgba(13, 110, 253, 0.08));
    color: var(--status-info, #0d6efd);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

/* Incremental sync banner */
.ri-incremental-banner {
    background: var(--bg-card);
    border: 1px solid var(--accent-primary, #10b981);
    border-radius: 8px;
    margin-bottom: 1rem;
    overflow: hidden;
}
.ri-incremental-inner {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
    color: var(--text-primary);
}
.ri-incremental-icon { flex-shrink: 0; color: var(--accent-primary, #10b981); }
.ri-incremental-text { flex: 1; }
.ri-incremental-steps {
    flex-shrink: 0;
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 600;
}
.ri-incremental-bar {
    height: 3px;
    background: var(--bg-tertiary);
}
.ri-incremental-fill {
    height: 100%;
    background: var(--accent-primary, #10b981);
    transition: width 0.4s ease;
}
.ri-insufficient-history {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-muted);
}
.ri-insufficient-history h3 {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}
.ri-coverage-info {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    padding: 0.5rem 0;
    border-top: 1px solid var(--border-color);
    margin-top: 1rem;
}

/* Help tooltip (?) that appears next to labels, headers, metrics. */
.ri-help {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    min-width: 14px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    cursor: help;
    user-select: none;
    margin-left: 4px;
    vertical-align: middle;
    transition: background 0.15s, color 0.15s;
    border: 1px solid var(--border-color);
}
.ri-help:hover,
.ri-help:focus {
    background: var(--accent-primary, #10b981);
    color: #fff;
    border-color: transparent;
    outline: none;
}
.ri-tooltip-pop {
    position: fixed;
    z-index: 10000;
    max-width: 320px;
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 30px rgba(0,0,0,0.35);
    padding: 0.6rem 0.75rem;
    border-radius: 6px;
    font-size: 0.82rem;
    line-height: 1.45;
    pointer-events: none;
    opacity: 0;
    transform: translateY(2px);
    transition: opacity 0.12s, transform 0.12s;
}
.ri-tooltip-pop.ri-tooltip-pop-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Campaign name truncation (fix first-column bleed into type column) */
.ri-campaign-name-cell {
    max-width: 280px;
    overflow: hidden;
}
.ri-campaign-name {
    font-weight: 600;
    color: var(--text-primary);
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Loading / waiting states */
.ri-loading {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* Filters row */
.ri-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: end;
    padding: 0.75rem 0 1rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1rem;
}

.ri-filter {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 160px;
}

.ri-filter-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.ri-filter select {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 0.4rem 0.6rem;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
}

.ri-filter select:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.ri-filter-meta {
    margin-left: auto;
    color: var(--text-muted);
    font-size: 0.85rem;
    padding-bottom: 0.2rem;
}

/* Campaign table */
.ri-campaign-table-wrap {
    overflow-x: auto;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.ri-campaign-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 860px;
}

.ri-campaign-table th {
    text-align: left;
    padding: 0.75rem 1rem;
    border-bottom: 2px solid var(--border-color);
    font-weight: 600;
    font-size: 0.78rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.ri-campaign-table th:hover {
    color: var(--text-primary);
}

.ri-campaign-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
    color: var(--text-primary);
    vertical-align: middle;
}

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

.ri-campaign-row {
    cursor: pointer;
    transition: background 0.15s;
}

.ri-campaign-row:hover {
    background: var(--bg-tertiary);
}

.ri-num { text-align: right; }
.ri-muted { color: var(--text-muted); font-size: 0.85rem; }

/* Attributed revenue colors */
.ri-revenue-positive { color: var(--accent-green); font-weight: 600; }
.ri-revenue-zero { color: var(--accent-red); font-weight: 600; }

/* Campaign table column widths */
.ri-campaign-table th:nth-child(1),
.ri-campaign-table td:nth-child(1) { width: 28%; }
.ri-campaign-table th:nth-child(5),
.ri-campaign-table td:nth-child(5) { min-width: 110px; }
.ri-campaign-table th:nth-child(6),
.ri-campaign-table td:nth-child(6) { min-width: 100px; }

.ri-state-badge {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    border-radius: 10px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-transform: capitalize;
    border: 1px solid var(--border-color);
}

/* Score badges — map to available semantic accents */
.ri-score {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    border-radius: 4px;
    font-weight: 700;
    font-size: 0.85rem;
    min-width: 28px;
    text-align: center;
}

.ri-score-a { background: rgba(16, 185, 129, 0.15); color: var(--accent-green); }
.ri-score-b { background: rgba(59, 130, 246, 0.15); color: var(--accent-blue); }
.ri-score-c { background: rgba(245, 158, 11, 0.15); color: var(--accent-yellow); }
.ri-score-d { background: rgba(249, 115, 22, 0.18); color: var(--accent-orange); }
.ri-score-f { background: rgba(239, 68, 68, 0.15); color: var(--accent-red); }

/* Confidence indicator */
.ri-confidence {
    display: inline-block;
    font-size: 0.78rem;
    padding: 0.18rem 0.55rem;
    border-radius: 12px;
    font-weight: 500;
}

.ri-confidence-high { background: rgba(16, 185, 129, 0.15); color: var(--accent-green); }
.ri-confidence-moderate { background: rgba(245, 158, 11, 0.15); color: var(--accent-yellow); }
.ri-confidence-low { background: rgba(239, 68, 68, 0.15); color: var(--accent-red); }

/* Empty / progress / error states */
.ri-empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
}

.ri-empty-state h2 {
    margin: 0 0 0.5rem;
    color: var(--text-primary);
    font-size: 1.15rem;
    font-weight: 600;
}

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

.ri-empty-icon {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
    color: var(--text-muted);
    opacity: 0.6;
}

.ri-empty-state-inline {
    padding: 2rem 1rem;
}

.ri-progress {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
}

.ri-progress-spinner {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
    color: var(--accent-primary);
}

.ri-error-banner {
    background: rgba(239, 68, 68, 0.1);
    color: var(--accent-red);
    border: 1px solid rgba(239, 68, 68, 0.3);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

/* No-access panel */
.ri-no-access {
    max-width: 480px;
    margin: 4rem auto;
    padding: 2.5rem 2rem;
    text-align: center;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-muted);
}

.ri-no-access-icon {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
    color: var(--text-muted);
    opacity: 0.6;
}

.ri-no-access h2 {
    margin: 0 0 0.5rem;
    color: var(--text-primary);
    font-size: 1.25rem;
}

.ri-no-access p {
    margin: 0;
    font-size: 0.9rem;
}

/* Detail view placeholder (expanded in Task 10) */
.ri-detail { padding: 0; }

.ri-detail-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.ri-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.4rem 0.8rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

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

.ri-back-icon { transform: rotate(180deg); }

/* Mobile */
@media (max-width: 768px) {
    .ri-page { padding: 1rem; }
    .ri-title h1 { font-size: 1.4rem; }
    .ri-filter { min-width: 140px; }
    .ri-filter-meta { margin-left: 0; width: 100%; }
}

/* ============================================
   RETENTION INTELLIGENCE — Campaign Detail View (Task 10)
   ============================================ */

.ri-detail-back {
    margin-bottom: 1rem;
}

.ri-detail-title {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.ri-detail-title-main {
    flex: 1 1 320px;
    min-width: 0;
}

.ri-detail-title-main h2 {
    margin: 0 0 0.5rem;
    color: var(--text-primary);
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.2;
    word-break: break-word;
}

.ri-detail-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
}

.ri-detail-score {
    display: flex;
    align-items: center;
}

.ri-score-large {
    font-size: 1.4rem;
    padding: 0.4rem 0.85rem;
    min-width: 52px;
    border-radius: 8px;
    font-weight: 700;
}

.ri-detail-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.ri-detail-section h3 {
    margin: 0 0 1rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* Stat cards (delivery) */
.ri-stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.75rem;
}

.ri-stat-card {
    padding: 1rem;
    border-radius: 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
}

.ri-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.1;
}

.ri-stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 0.45rem;
    font-weight: 600;
}

.ri-stat-sub {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.3rem;
}

.ri-delta-positive { color: var(--accent-green); font-weight: 600; }
.ri-delta-negative { color: var(--accent-red); font-weight: 600; }

/* Overlap warning */
.ri-overlap-warning {
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: var(--accent-yellow);
    padding: 0.85rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
}

.ri-overlap-warning .ri-overlap-icon { display: inline-flex; flex-shrink: 0; margin-top: 0.1rem; }
.ri-overlap-warning > div { color: var(--text-secondary); font-size: 0.9rem; line-height: 1.45; }
.ri-overlap-warning strong { color: var(--text-primary); display: block; margin-bottom: 0.15rem; }

.ri-overlap-warning.ri-overlap-high {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: var(--accent-red);
}

/* Analysis period indicators */
.ri-analysis-period-hint {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--text-muted);
    font-size: 0.82rem;
    padding: 0.35rem 0;
}
.ri-analysis-period-banner {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.75rem;
    margin: 0.75rem 0;
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.85rem;
}
.ri-analysis-period-header {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
}
.ri-analysis-period-header strong {
    color: var(--text-primary);
}

/* Retention Intelligence - Monthly Trend Table */
.ri-monthly-trend {
    margin: 1.5rem 0;
}

.ri-monthly-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.ri-monthly-table th,
.ri-monthly-table td {
    padding: 0.625rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color, #e0e0e0);
}

.ri-monthly-table th {
    font-weight: 600;
    color: var(--text-muted, #666);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
}

.ri-monthly-table td:nth-child(n+2) {
    text-align: right;
}

.ri-monthly-table th:nth-child(n+2) {
    text-align: right;
}

.ri-month-positive {
    background: rgba(76, 175, 80, 0.08);
}

.ri-month-positive td:nth-child(3) {
    color: var(--success-color, #4caf50);
    font-weight: 600;
}

.ri-month-selected {
    background: rgba(59, 130, 246, 0.12);
    border-left: 3px solid var(--primary-color, #3b82f6);
}

.ri-month-selected.ri-month-positive {
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.12) 0%, rgba(76, 175, 80, 0.08) 100%);
}

/* Period Selector (Task 3.2) */
.ri-period-selector {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: var(--bg-secondary, #f5f5f5);
    border-radius: 6px;
}

.ri-period-selector label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary, #666);
}

.ri-period-selector select {
    padding: 0.375rem 0.5rem;
    border: 1px solid var(--border-color, #ddd);
    border-radius: 4px;
    background: var(--bg-primary, #fff);
    font-size: 0.875rem;
    color: var(--text-primary, #333);
    cursor: pointer;
    min-width: 120px;
}

.ri-period-selector select:hover {
    border-color: var(--primary-color, #3b82f6);
}

.ri-period-selector select:focus {
    outline: none;
    border-color: var(--primary-color, #3b82f6);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.ri-period-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    margin-bottom: 1rem;
    background: rgba(59, 130, 246, 0.08);
    border-radius: 4px;
    font-size: 0.875rem;
    color: var(--primary-color, #3b82f6);
}

.ri-period-label svg {
    flex-shrink: 0;
}

/* Player movement cards */
.ri-player-movement { margin-bottom: 20px; }
.ri-movement-card {
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 8px;
    border-left: 3px solid transparent;
    background: var(--bg-card, rgba(255,255,255,0.03));
    margin-bottom: 8px;
}
.ri-movement-dormant { border-left-color: #14b8a6; }
.ri-movement-first { border-left-color: #3b82f6; }
.ri-movement-active { border-left-color: #22c55e; }
.ri-movement-nochange { border-left-color: #6b7280; }
.ri-movement-icon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.ri-movement-dormant .ri-movement-icon { background: rgba(20, 184, 166, 0.1); color: #14b8a6; }
.ri-movement-first .ri-movement-icon { background: rgba(59, 130, 246, 0.1); color: #3b82f6; }
.ri-movement-active .ri-movement-icon { background: rgba(34, 197, 94, 0.1); color: #22c55e; }
.ri-movement-nochange .ri-movement-icon { background: rgba(107, 114, 128, 0.1); color: #6b7280; }
.ri-movement-body { flex: 1; min-width: 0; }
.ri-movement-headline { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.ri-movement-detail { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }
.ri-movement-context { font-size: 12px; color: var(--text-tertiary, #6b7280); margin-top: 2px; }
.ri-movement-footnote { font-size: 12px; color: var(--text-tertiary, #6b7280); margin-top: 8px; padding-left: 4px; }

/* Engagement correlation */
.ri-engagement-body {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.ri-engagement-row {
    display: grid;
    grid-template-columns: minmax(160px, 220px) 1fr auto;
    gap: 0.75rem;
    align-items: center;
}

.ri-engagement-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.ri-engagement-bar-wrap {
    height: 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    overflow: hidden;
}

.ri-engagement-bar {
    height: 100%;
    background: var(--accent-primary);
    transition: width 0.3s ease;
    border-radius: 6px;
}

.ri-bar-opened { background: var(--accent-green); }
.ri-bar-clicked { background: var(--accent-blue); }
.ri-bar-baseline { background: var(--text-muted); opacity: 0.55; }

.ri-engagement-value {
    font-size: 0.85rem;
    color: var(--text-primary);
    font-weight: 600;
    white-space: nowrap;
    min-width: 90px;
    text-align: right;
}

.ri-engagement-lift {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
}

.ri-engagement-lift-sep { color: var(--text-muted); }

/* Baselines */
.ri-baseline-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 0.75rem;
}

.ri-baseline-card {
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-secondary);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.ri-baseline-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

.ri-baseline-title {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.9rem;
}

.ri-baseline-sub {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    padding: 0.1rem 0.45rem;
    border-radius: 10px;
    background: var(--bg-tertiary);
    white-space: nowrap;
}

.ri-baseline-desc {
    color: var(--text-muted);
    font-size: 0.8rem;
    line-height: 1.4;
}

.ri-baseline-body {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding-top: 0.4rem;
    border-top: 1px solid var(--border-color);
}

.ri-baseline-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 0.85rem;
    gap: 0.75rem;
}

.ri-baseline-label { color: var(--text-muted); }
.ri-baseline-value { color: var(--text-primary); font-weight: 500; text-align: right; }

/* Confidence */
.ri-confidence-block {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.ri-confidence-large {
    font-size: 0.95rem;
    padding: 0.35rem 0.9rem;
    border-radius: 14px;
    font-weight: 600;
}

.ri-confidence-reasons {
    border-top: 1px solid var(--border-color);
    padding-top: 0.75rem;
    margin-top: 0.5rem;
}

.ri-confidence-reasons summary {
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--accent-primary);
    font-weight: 500;
    user-select: none;
    list-style: none;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.ri-confidence-reasons summary::-webkit-details-marker { display: none; }

.ri-confidence-reasons summary::before {
    content: '▸';
    display: inline-block;
    transition: transform 0.15s;
    font-size: 0.7rem;
}

.ri-confidence-reasons[open] summary::before {
    transform: rotate(90deg);
}

.ri-confidence-reasons summary:hover { opacity: 0.85; }

.ri-confidence-reasons ul {
    margin: 0.75rem 0 0;
    padding-left: 1.25rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.5;
}

.ri-confidence-reasons li { margin-bottom: 0.35rem; }

/* Revenue Hero */
.ri-revenue-hero {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 16px;
}
.ri-revenue-hero.ri-rev-positive { border-left-color: #22c55e; }
.ri-revenue-hero.ri-rev-zero { border-left-color: #ef4444; }
.ri-revenue-hero.ri-rev-none { border-left-color: var(--text-secondary); color: var(--text-secondary); }
.ri-section-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}
.ri-hero-metrics {
    display: flex;
    gap: 16px;
}
@media (max-width: 900px) {
    .ri-hero-metrics { flex-direction: column; }
}
.ri-rev-card {
    background: var(--bg-tertiary, rgba(255,255,255,0.03));
    border-radius: 8px;
    padding: 16px;
    text-align: center;
    flex: 1;
}
.ri-hero-primary-card {
    flex: 1.2;
}
.ri-hero-primary {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}
.ri-rev-positive .ri-hero-primary { color: #22c55e; }
.ri-rev-zero .ri-hero-primary { color: #ef4444; }
.ri-rev-none .ri-hero-primary { color: var(--text-secondary); }
.ri-hero-secondary {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-secondary);
    line-height: 1.2;
}
.ri-rev-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Verdict Badge */
.ri-verdict-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
}
.ri-verdict {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}
.ri-verdict-repeat { background: rgba(34, 197, 94, 0.12); color: #22c55e; }
.ri-verdict-modify { background: rgba(234, 179, 8, 0.12); color: #eab308; }
.ri-verdict-stop { background: rgba(239, 68, 68, 0.12); color: #ef4444; }
.ri-verdict-none { background: var(--bg-tertiary, rgba(255,255,255,0.05)); color: var(--text-secondary); }
.ri-verdict-reason {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Engagement Proof */
.ri-engagement-proof {
    font-size: 12px;
    margin-top: 8px;
    padding-left: 2px;
}
.ri-proof-strong { color: #22c55e; }
.ri-proof-moderate { color: #eab308; }
.ri-proof-weak { color: var(--text-secondary); }


/* Engagement Funnel */
.ri-funnel-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 16px;
}
.ri-funnel {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}
.ri-funnel-step { text-align: center; min-width: 80px; }
.ri-funnel-value { font-size: 18px; font-weight: 700; color: var(--text-primary); }
.ri-funnel-label { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.ri-funnel-pct { font-size: 11px; color: var(--accent-primary); font-weight: 600; margin-top: 2px; }
.ri-funnel-arrow { font-size: 18px; color: var(--text-secondary); opacity: 0.5; }

/* Advanced Analytics toggle */
.ri-advanced-section {
    margin-top: 8px;
    margin-bottom: 16px;
}
.ri-advanced-toggle {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary);
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 12px;
    list-style: none;
}
.ri-advanced-toggle::-webkit-details-marker { display: none; }
.ri-advanced-section[open] .ri-advanced-toggle { border-bottom-color: var(--accent-primary); }

/* Technical Details collapsible */
.ri-technical-details {
    margin-top: 20px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}
.ri-technical-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    background: var(--bg-tertiary, rgba(255,255,255,0.02));
    list-style: none;
}
.ri-technical-toggle::-webkit-details-marker { display: none; }
.ri-technical-toggle:hover { color: var(--text-primary); }
.ri-technical-details[open] .ri-technical-toggle { border-bottom: 1px solid var(--border-color); }
.ri-technical-content { padding: 16px; }

/* Recommendations */
.ri-recommendations { margin-bottom: 20px; }
.ri-recommendation-list {
    margin: 8px 0;
    padding-left: 24px;
}
.ri-recommendation-item {
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 6px;
    line-height: 1.5;
}
.ri-confidence-line {
    font-size: 12px;
    color: var(--text-tertiary, #6b7280);
    margin-top: 8px;
}
.ri-confidence-level { font-weight: 600; text-transform: capitalize; }

/* Transactional notice */
.ri-transactional-notice {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--bg-tertiary, rgba(255,255,255,0.03));
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

/* AI analysis */
.ri-ai-summary {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-left: 3px solid var(--accent-primary);
    padding: 1.25rem;
    border-radius: 0 8px 8px 0;
    margin-bottom: 1rem;
}

.ri-ai-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.ri-ai-title {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--accent-primary);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.ri-ai-headline {
    margin: 0.75rem 0 1rem;
    color: var(--text-primary);
    font-size: 1.15rem;
    font-weight: 600;
    line-height: 1.35;
    text-transform: none;
    letter-spacing: 0;
}

.ri-ai-sub {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: 1rem 0 0.4rem;
    font-weight: 600;
}

.ri-ai-findings,
.ri-ai-recs {
    margin: 0;
    padding-left: 1.25rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.55;
}

.ri-ai-findings li,
.ri-ai-recs li {
    margin-bottom: 0.5rem;
}

.ri-ai-verdict {
    margin: 0;
    color: var(--text-primary);
    font-size: 0.9rem;
    line-height: 1.55;
}

.ri-ai-fallback {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-tertiary);
    color: var(--text-muted);
    border-radius: 6px;
    font-size: 0.8rem;
    margin: 0.5rem 0 0.75rem;
}

.ri-ai-unavailable {
    border-left-color: var(--text-muted);
}

/* ----------------------------------------
   Task 11: Setup flow, UI states, gear button
   ---------------------------------------- */

.ri-btn-gear {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.4rem 0.5rem;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

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

.ri-setup {
    max-width: 560px;
    margin: 2.5rem auto;
    padding: 2.5rem 2rem;
    text-align: center;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
}

.ri-setup-icon {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
    color: var(--accent-primary);
    opacity: 0.85;
}

.ri-setup h2 {
    margin: 0 0 0.5rem;
    font-size: 1.3rem;
    font-weight: 600;
}

.ri-setup-lead {
    margin: 0 auto 1.25rem;
    max-width: 440px;
    color: var(--text-muted);
    font-size: 0.92rem;
    line-height: 1.5;
}

.ri-setup-existing {
    margin: 0 auto 1.25rem;
    padding: 0.75rem 1rem;
    max-width: 440px;
    text-align: left;
    background: var(--bg-tertiary);
    border-radius: 8px;
    font-size: 0.85rem;
}

.ri-setup-existing-row {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.2rem 0;
}

.ri-setup-form {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    max-width: 420px;
    margin: 0 auto;
    text-align: left;
}

.ri-setup-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.ri-setup-field-label {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-primary);
}

.ri-setup-field-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.ri-setup-input {
    width: 100%;
    padding: 0.55rem 0.7rem;
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.9rem;
    box-sizing: border-box;
}

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

.ri-setup-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 0.5rem;
}

.ri-setup-btn-primary {
    background: var(--accent-primary);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 0.55rem 1rem;
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.ri-setup-btn-primary:hover:not(:disabled) { opacity: 0.92; }
.ri-setup-btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.ri-setup-btn-secondary {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.55rem 1rem;
    font-size: 0.88rem;
    cursor: pointer;
}

.ri-setup-btn-secondary:hover { background: var(--bg-tertiary); }

.ri-setup-btn-danger {
    background: transparent;
    color: var(--accent-red);
    border: 1px solid rgba(239, 68, 68, 0.4);
    border-radius: 6px;
    padding: 0.55rem 1rem;
    font-size: 0.88rem;
    cursor: pointer;
}

.ri-setup-btn-danger:hover { background: rgba(239, 68, 68, 0.1); }

.ri-setup-status {
    margin-top: 0.25rem;
    font-size: 0.85rem;
    min-height: 1.25rem;
    text-align: center;
}

.ri-setup-status-pending { color: var(--text-muted); }
.ri-setup-status-success { color: var(--status-success, #10b981); display: inline-flex; align-items: center; gap: 0.35rem; justify-content: center; }
.ri-setup-status-error { color: var(--accent-red); }

/* Phase progress (renderSyncInProgress) */
.ri-phase-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin: 1.25rem auto 0;
    max-width: 460px;
    text-align: left;
}

.ri-phase-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.7rem 0.9rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.ri-phase-icon {
    display: inline-flex;
    align-items: center;
    padding-top: 0.1rem;
    color: var(--text-muted);
}

.ri-phase-complete .ri-phase-icon { color: var(--status-success, #10b981); }
.ri-phase-running .ri-phase-icon { color: var(--accent-primary); }
.ri-phase-queued .ri-phase-icon { color: var(--text-muted); opacity: 0.6; }

.ri-phase-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.ri-phase-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.1rem;
}

.ri-phase-status {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
    padding-top: 0.15rem;
}

.ri-phase-complete .ri-phase-status { color: var(--status-success, #10b981); }
.ri-phase-running .ri-phase-status { color: var(--accent-primary); }

.ri-phase-progress {
    margin-top: 0.5rem;
}

.ri-phase-progress-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.3rem;
}

.ri-progress-bar {
    width: 100%;
    height: 6px;
    background: var(--bg-primary);
    border-radius: 3px;
    overflow: hidden;
}

.ri-progress-fill {
    height: 100%;
    background: var(--accent-primary);
    transition: width 0.4s ease;
}

/* Sync failure banner (above list) */
.ri-failure-banner {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    margin-bottom: 1rem;
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-left: 3px solid var(--accent-red);
    border-radius: 8px;
    color: var(--text-primary);
}

.ri-failure-icon {
    color: var(--accent-red);
    display: inline-flex;
    padding-top: 0.1rem;
}

.ri-failure-body {
    flex: 1;
    min-width: 0;
}

.ri-failure-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--accent-red);
}

.ri-failure-detail {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
    word-break: break-word;
}

.ri-failure-retry {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: var(--accent-red);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 0.45rem 0.85rem;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    align-self: center;
}

.ri-failure-retry:hover { opacity: 0.9; }

/* Mobile adjustments */
@media (max-width: 768px) {
    .ri-detail-title h2 { font-size: 1.2rem; }
    .ri-score-large { font-size: 1.2rem; padding: 0.3rem 0.7rem; }
    .ri-engagement-row {
        grid-template-columns: 1fr;
        gap: 0.35rem;
    }
    .ri-engagement-value { text-align: left; min-width: 0; }
    .ri-stat-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ============================================
   UNIFIED CHAT SYSTEM
   ============================================ */

/* Chat Layout */
/* Chat page container override — remove page-section padding and constrain height */
#page-chat { padding: 0 !important; overflow: hidden; min-height: 0 !important; }
#page-chat.active { display: flex !important; height: calc(100vh - 65px); max-height: calc(100vh - 65px); }
#page-chat #chatRoot { flex: 1; min-height: 0; display: flex; flex-direction: column; }

.chat-container { display: flex; flex: 1; min-height: 0; }
.chat-sidebar { width: 240px; background: var(--bg-secondary); border-right: 1px solid var(--border-color); display: flex; flex-direction: column; overflow-y: auto; flex-shrink: 0; overflow-x: hidden; }
.chat-main { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; background: var(--bg-primary); }

/* Chat Sidebar */
.chat-sidebar-header { height: 48px; padding: 0 16px; display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; border-bottom: 1px solid var(--border-color); }
.chat-sidebar-title { font-weight: 700; font-size: 15px; color: var(--text-primary); }
.chat-sidebar-header-actions { display: flex; gap: 4px; }
.chat-sidebar-header-actions button { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 4px 8px; border-radius: 4px; font-size: 16px; }
.chat-sidebar-header-actions button:hover { background: var(--bg-tertiary); color: var(--text-primary); }

.chat-sidebar-section { padding: 4px 0; }
.chat-sidebar-section-title { padding: 6px 16px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); cursor: pointer; display: flex; align-items: center; justify-content: space-between; user-select: none; }
.chat-sidebar-section-title:hover { color: var(--text-secondary); }
.chat-sidebar-section-title .section-add-btn { font-size: 14px; opacity: 0; transition: opacity 0.15s; }
.chat-sidebar-section-title:hover .section-add-btn { opacity: 1; }
.chat-sidebar-section.collapsed .chat-sidebar-section-items { display: none; }

.chat-sidebar-item { padding: 5px 12px 5px 16px; cursor: pointer; display: flex; align-items: center; gap: 8px; color: var(--text-secondary); font-size: 14px; border-left: 3px solid transparent; transition: background 0.1s, color 0.1s; }
.chat-sidebar-item:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.chat-sidebar-item.active { background: rgba(16, 185, 129, 0.08); border-left-color: var(--accent-primary); color: var(--text-primary); }
.chat-sidebar-item .channel-hash { color: var(--text-muted); font-weight: 500; width: 16px; text-align: center; flex-shrink: 0; }
.chat-sidebar-item .unread-badge { background: var(--accent-primary); color: #000; border-radius: 10px; padding: 1px 7px; font-size: 10px; font-weight: 600; margin-left: auto; flex-shrink: 0; min-width: 8px; min-height: 8px; }
.chat-sidebar-item.unread .item-name { font-weight: 600; color: var(--text-primary); }
.chat-sidebar-item .online-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.chat-sidebar-item .online-dot.online { background: var(--accent-primary); }
.chat-sidebar-item .online-dot.offline { background: var(--text-muted); }
.chat-sidebar-item .item-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-sidebar-item .item-hint { font-size: 10px; color: var(--text-muted); flex-shrink: 0; max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Chat Top Bar */
.chat-topbar { height: 48px; padding: 0 20px; border-bottom: 1px solid var(--border-color); display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.chat-topbar-title { font-weight: 600; font-size: 15px; color: var(--text-primary); display: flex; align-items: baseline; gap: 6px; }
.chat-topbar-hash { color: var(--text-muted); font-size: 15px; font-weight: 400; }
.chat-topbar-subtitle { font-size: 12px; font-weight: 400; color: var(--text-muted); margin-left: 4px; }
.chat-topbar-actions { margin-left: auto; display: flex; gap: 10px; align-items: center; color: var(--text-muted); }
.chat-topbar-actions button { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 4px; border-radius: 4px; transition: color 0.15s, background 0.15s; }
.chat-topbar-actions button:hover { color: var(--text-primary); background: var(--bg-tertiary); }
.chat-settings-btn { padding: 6px !important; }
.chat-settings-btn:hover { color: var(--accent-blue) !important; }

/* Message List */
.chat-messages { flex: 1; overflow-y: auto; display: flex; flex-direction: column; padding: 8px 0; overscroll-behavior: contain; }
.chat-messages-inner { display: flex; flex-direction: column; min-height: 100%; justify-content: flex-end; }

/* Individual Message */
.chat-message { padding: 6px 16px; display: flex; gap: 10px; position: relative; }
.chat-message:hover { background: var(--bg-tertiary); }
.chat-message:hover .chat-message-actions { display: flex; }
.chat-message-avatar { width: 36px; height: 36px; border-radius: 6px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 14px; font-weight: 600; }
/* Compact mode disabled - every message shows full header */
.chat-message-compact { /* not used */ }
.chat-message-body { flex: 1; min-width: 0; }
.chat-message-header { display: flex; align-items: baseline; gap: 8px; margin-bottom: 2px; }
.chat-message-sender { font-weight: 600; font-size: 14px; color: var(--text-primary); }
.chat-message-time { font-size: 11px; color: var(--text-muted); }
.chat-message-text { line-height: 1.5; word-wrap: break-word; overflow-wrap: break-word; color: var(--text-secondary); }
.chat-message-text p { margin: 0 0 4px 0; }
.chat-message-text p:last-child { margin-bottom: 0; }
.chat-message-text strong { color: var(--text-primary); }
.chat-message-text code { background: var(--bg-tertiary); padding: 2px 5px; border-radius: 3px; font-size: 13px; color: #e06c75; }
[data-theme="light"] .chat-message-text code { color: #c7254e; }
.chat-message-text pre { background: var(--bg-tertiary); padding: 8px 12px; border-radius: 6px; overflow-x: auto; margin: 4px 0; }
.chat-message-text a { color: var(--accent-primary); text-decoration: none; }
.chat-message-text a:hover { text-decoration: underline; }
.chat-message-text blockquote { border-left: 3px solid var(--accent-primary); margin: 4px 0; padding: 4px 12px; color: var(--text-muted); }
.chat-message-edited { font-size: 10px; color: var(--text-muted); font-style: italic; margin-left: 4px; }
.chat-message-deleted { padding: 2px 16px; }
.chat-deleted-notice { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted); font-style: italic; opacity: 0.6; padding: 2px 0; }

/* Message Hover Actions */
.chat-message-actions { display: none; position: absolute; top: 2px; right: 16px; background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 6px; padding: 2px; gap: 1px; box-shadow: 0 2px 8px rgba(0,0,0,0.3); z-index: 10; pointer-events: auto; }
.chat-message-actions button { background: none; border: none; padding: 5px 8px; cursor: pointer; border-radius: 4px; color: var(--text-muted); font-size: 14px; line-height: 1; }
.chat-message-actions button:hover { background: var(--bg-tertiary); color: var(--text-primary); }

/* Reactions */
.chat-reactions { display: flex; gap: 4px; margin-top: 4px; flex-wrap: wrap; }
.chat-reaction { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 12px; padding: 2px 8px; font-size: 12px; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; color: var(--text-secondary); transition: border-color 0.15s, background 0.15s; }
.chat-reaction:hover { background: var(--bg-tertiary); border-color: var(--text-muted); }
.chat-reaction.reacted { border-color: var(--accent-primary); background: rgba(0, 212, 170, 0.08); color: var(--accent-primary); }

/* Message Wrapper */
.chat-message-wrapper { position: relative; }
.chat-message-wrapper.msg-sent { margin-left: auto; max-width: 75%; }
.chat-message-wrapper.msg-received { margin-right: auto; max-width: 75%; }
.chat-message-wrapper.msg-sent .chat-message { flex-direction: row-reverse; background: rgba(16, 185, 129, 0.10); border-radius: 16px 16px 4px 16px; padding: 8px 12px; }
.chat-message-wrapper.msg-received .chat-message { background: var(--bg-card); border-radius: 16px 16px 16px 4px; padding: 8px 12px; }
.chat-message-wrapper.msg-sent .chat-message-header { flex-direction: row-reverse; }
.chat-message-wrapper.msg-sent .chat-message-body { text-align: right; }
.chat-message-wrapper.msg-sent .chat-message-text { text-align: right; }
.chat-message-wrapper.msg-sent .chat-message-actions { right: auto; left: 16px; }
.chat-message-wrapper.msg-sent .chat-reactions { justify-content: flex-end; }
.chat-message-wrapper.msg-sent .chat-message:hover { background: rgba(16, 185, 129, 0.16); }
[data-theme="light"] .chat-message-wrapper.msg-sent .chat-message { background: rgba(5, 150, 105, 0.10); }
[data-theme="light"] .chat-message-wrapper.msg-sent .chat-message:hover { background: rgba(5, 150, 105, 0.16); }

/* DM Sidebar & Modal Avatars */
.chat-dm-avatar { border-radius: 50%; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; color: #fff; font-weight: 600; overflow: hidden; }

/* Thread Link */
.chat-thread-link { color: var(--accent-primary); font-size: 12px; cursor: pointer; margin-top: 4px; display: inline-flex; align-items: center; gap: 4px; }
.chat-thread-link:hover { text-decoration: underline; }

/* Inline Thread */
.chat-inline-thread { display: none; }
.chat-inline-thread.open { display: block; margin: 0 16px 8px 62px; border-left: 2px solid var(--accent-primary); border-radius: 0 8px 8px 0; background: var(--bg-secondary); }
.chat-inline-thread-inner { display: flex; flex-direction: column; }
.chat-inline-thread-replies { max-height: 300px; overflow-y: auto; padding: 8px 0; }
.chat-inline-reply { display: flex; gap: 8px; padding: 4px 12px; align-items: flex-start; position: relative; }
.chat-inline-reply:hover { background: var(--bg-tertiary); }
.chat-inline-reply:hover > .chat-message-actions { display: flex; }
.chat-inline-reply > .chat-message-actions { top: 2px; right: 8px; }
.chat-inline-reply-avatar { width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 10px; font-weight: 600; overflow: hidden; }
.chat-inline-reply-body { flex: 1; min-width: 0; }
.chat-inline-reply-name { font-weight: 600; font-size: 12px; color: var(--text-primary); margin-right: 6px; }
.chat-inline-reply-time { font-size: 10px; color: var(--text-muted); }
.chat-inline-reply-text { font-size: 13px; color: var(--text-secondary); line-height: 1.4; word-wrap: break-word; }
.chat-inline-thread-compose { padding: 6px 12px 8px; border-top: 1px solid var(--border-color); }
.chat-inline-thread-compose .chat-compose-editor { border-radius: 6px; }
.chat-inline-thread-compose .ql-editor { min-height: 32px; max-height: 120px; }

/* Date Divider */
.chat-date-divider { display: flex; align-items: center; gap: 12px; padding: 12px 16px; color: var(--text-muted); font-size: 12px; font-weight: 500; }
.chat-date-divider::before,
.chat-date-divider::after { content: ''; flex: 1; height: 1px; background: var(--border-color); }

/* Typing Indicator */
.chat-typing { padding: 4px 16px 4px 62px; font-size: 12px; color: var(--text-muted); font-style: italic; min-height: 22px; flex-shrink: 0; }

/* Compose Area */
.chat-compose { padding: 8px 16px 16px; flex-shrink: 0; }
.chat-compose-editor { border: 1px solid var(--border-color); border-radius: 8px; overflow: hidden; background: var(--bg-card); transition: border-color 0.15s; }
.chat-compose-editor:focus-within { border-color: var(--accent-primary); }
.chat-compose-actions { display: flex; align-items: center; padding: 4px 8px; border-top: 1px solid var(--border-color); gap: 2px; }
.chat-compose-actions button { background: none; border: none; color: var(--text-muted); padding: 5px 8px; cursor: pointer; border-radius: 4px; font-size: 16px; }
.chat-compose-actions button:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.chat-send-btn { background: var(--accent-primary) !important; color: #000 !important; border-radius: 6px !important; padding: 5px 18px !important; font-size: 12px !important; font-weight: 600 !important; margin-left: auto !important; transition: opacity 0.15s; }
.chat-send-btn:hover { opacity: 0.9; }

/* Thread View (legacy — kept for compatibility) */
.chat-thread-header { padding: 10px 16px; border-bottom: 1px solid var(--border-color); display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.chat-thread-divider { padding: 8px 16px; font-size: 11px; color: var(--text-muted); border-bottom: 1px solid var(--border-color); }

/* Attachments */
.chat-attachment { margin-top: 6px; max-width: 360px; }
.chat-attachment-image { border-radius: 8px; overflow: hidden; }
.chat-attachment-image img { max-width: 100%; display: block; border-radius: 8px; cursor: pointer; transition: opacity 0.15s; }
.chat-attachment-image img:hover { opacity: 0.85; }
.chat-attachment-file { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 8px; padding: 10px 14px; display: flex; align-items: center; gap: 10px; cursor: pointer; transition: background 0.15s; }
.chat-attachment-file:hover { background: var(--bg-tertiary); }
.chat-attachment-file-info { flex: 1; min-width: 0; }
.chat-attachment-file-name { font-size: 13px; color: var(--accent-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-attachment-file-size { font-size: 11px; color: var(--text-muted); }

/* Pinned Messages Panel */
.chat-pins-panel { position: absolute; top: 48px; right: 16px; width: 380px; max-height: 420px; background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 10px; overflow-y: auto; z-index: 100; box-shadow: 0 8px 24px rgba(0,0,0,0.4); }
.chat-pins-panel-header { padding: 12px 16px; border-bottom: 1px solid var(--border-color); font-weight: 600; color: var(--text-primary); display: flex; align-items: center; justify-content: space-between; }
.chat-pins-panel-item { padding: 10px 16px; border-bottom: 1px solid var(--border-color); }
.chat-pins-panel-item:last-child { border-bottom: none; }
.chat-pins-panel-actions { display: flex; gap: 8px; margin-top: 6px; }
.chat-pins-panel-actions button { font-size: 11px; color: var(--accent-primary); background: none; border: none; cursor: pointer; padding: 0; }
.chat-pins-panel-actions button:hover { text-decoration: underline; }

/* Pinned message indicator & badge */
.chat-message-pinned { background: rgba(0, 212, 170, 0.04); border-left: 2px solid var(--accent-primary); }
.chat-pinned-indicator { display: inline-flex; align-items: center; margin-left: 6px; color: var(--accent-primary); opacity: 0.7; vertical-align: middle; }
.chat-pin-badge { position: absolute; top: -4px; right: -4px; min-width: 16px; height: 16px; background: var(--accent-primary); color: #000; font-size: 10px; font-weight: 700; border-radius: 8px; display: flex; align-items: center; justify-content: center; padding: 0 4px; line-height: 1; }
.chat-pin-btn.pinned { color: var(--accent-primary) !important; }
.chat-message-highlight { animation: chat-highlight-fade 2s ease-out; }
.chat-message-wrapper.chat-message-highlight > .chat-message { animation: chat-highlight-fade 2s ease-out; }
@keyframes chat-highlight-fade { 0% { background: rgba(0, 212, 170, 0.15); } 100% { background: transparent; } }

/* Search Overlay */
.chat-search-overlay { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.6); z-index: 200; display: flex; align-items: flex-start; justify-content: center; padding-top: 60px; }
.chat-search-box { width: 580px; background: var(--bg-card); border-radius: 10px; border: 1px solid var(--border-color); overflow: hidden; box-shadow: 0 8px 24px rgba(0,0,0,0.4); max-height: 70vh; display: flex; flex-direction: column; }
.chat-search-input { padding: 14px 16px; border: none; background: transparent; color: var(--text-primary); font-size: 16px; outline: none; border-bottom: 1px solid var(--border-color); }
.chat-search-results { flex: 1; overflow-y: auto; padding: 8px 0; }
.chat-search-result { padding: 8px 16px; cursor: pointer; }
.chat-search-result:hover { background: var(--bg-tertiary); }
.chat-search-result-context { font-size: 11px; color: var(--text-muted); margin-bottom: 2px; }
.chat-search-result-text { font-size: 13px; color: var(--text-secondary); }
.chat-search-result-text mark { background: rgba(0, 212, 170, 0.2); color: var(--accent-primary); border-radius: 2px; padding: 0 2px; }

/* Quill Editor Theme Overrides */
.chat-compose .ql-toolbar { background: transparent; border: none !important; border-bottom: 1px solid var(--border-color) !important; padding: 4px 8px !important; }
.chat-compose .ql-toolbar .ql-stroke { stroke: var(--text-muted); }
.chat-compose .ql-toolbar .ql-fill { fill: var(--text-muted); }
.chat-compose .ql-toolbar .ql-picker-label { color: var(--text-muted); }
.chat-compose .ql-toolbar button:hover .ql-stroke,
.chat-compose .ql-toolbar button.ql-active .ql-stroke { stroke: var(--accent-primary); }
.chat-compose .ql-toolbar button:hover .ql-fill,
.chat-compose .ql-toolbar button.ql-active .ql-fill { fill: var(--accent-primary); }
.chat-compose .ql-toolbar .ql-picker-options { background: var(--bg-card); border-color: var(--border-color); }
.chat-compose .ql-container { border: none !important; font-size: 14px; color: var(--text-primary); }
.chat-compose .ql-editor { min-height: 40px; max-height: 200px; overflow-y: auto; color: var(--text-primary); padding: 8px 12px; }
.chat-compose .ql-editor.ql-blank::before { color: var(--text-muted); font-style: normal; }

/* Emoji Picker */
.chat-emoji-popup { position: fixed; z-index: 300; }
emoji-picker { --background: var(--bg-card); --text-color: var(--text-primary); --border-color: var(--border-color); --indicator-color: var(--accent-primary); --input-border-color: var(--border-color); --input-font-color: var(--text-primary); --outline-color: var(--accent-primary); }

/* Mention Autocomplete */
.chat-mention-dropdown { position: absolute; bottom: 100%; left: 16px; background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 8px; max-height: 200px; overflow-y: auto; z-index: 150; min-width: 220px; box-shadow: 0 4px 16px rgba(0,0,0,0.4); }
.chat-mention-item { padding: 7px 14px; cursor: pointer; display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-secondary); }
.chat-mention-item:hover,
.chat-mention-item.active { background: var(--bg-tertiary); color: var(--text-primary); }
.chat-mention-item-avatar { width: 24px; height: 24px; border-radius: 4px; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 10px; font-weight: 600; flex-shrink: 0; }

/* Upload Progress */
.chat-upload-progress { padding: 4px 16px; }
.chat-upload-progress-bar { height: 3px; background: var(--border-color); border-radius: 2px; overflow: hidden; }
.chat-upload-progress-fill { height: 100%; background: var(--accent-primary); transition: width 0.2s; }

/* Context Menu */
.chat-context-menu { position: fixed; background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 8px; z-index: 300; min-width: 180px; box-shadow: 0 4px 16px rgba(0,0,0,0.4); padding: 4px 0; }
.chat-context-menu-item { padding: 7px 14px; cursor: pointer; font-size: 13px; color: var(--text-secondary); display: flex; align-items: center; gap: 10px; }
.chat-context-menu-item:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.chat-context-menu-item.danger { color: #e74c3c; }
.chat-context-menu-item.danger:hover { background: rgba(231, 76, 60, 0.1); }
.chat-context-menu-divider { height: 1px; background: var(--border-color); margin: 4px 0; }

/* Empty State */
.chat-empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; flex: 1; color: var(--text-muted); gap: 12px; padding: 40px; text-align: center; }
.chat-empty-state-icon { font-size: 48px; opacity: 0.3; }
.chat-empty-state-title { font-size: 18px; font-weight: 600; color: var(--text-secondary); }
.chat-empty-state-text { font-size: 14px; max-width: 320px; line-height: 1.5; }

/* Create Conversation Modal */
.chat-create-modal { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.6); z-index: 400; display: flex; align-items: center; justify-content: center; }
.chat-create-modal-content { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 12px; width: 440px; max-height: 70vh; overflow-y: auto; box-shadow: 0 8px 32px rgba(0,0,0,0.5); }
.chat-create-modal-header { padding: 16px 20px; border-bottom: 1px solid var(--border-color); display: flex; align-items: center; justify-content: space-between; }
.chat-create-modal-header h3 { margin: 0; font-size: 16px; color: var(--text-primary); }
.chat-create-modal-body { padding: 16px 20px; }
.chat-create-modal-body input[type="text"] { width: 100%; padding: 10px 12px; background: var(--bg-primary); border: 1px solid var(--border-color); border-radius: 6px; color: var(--text-primary); font-size: 14px; outline: none; box-sizing: border-box; }
.chat-create-modal-body input[type="text"]:focus { border-color: var(--accent-primary); }
.chat-create-modal-body label { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.5px; }
.chat-create-modal-footer { padding: 12px 20px; border-top: 1px solid var(--border-color); display: flex; justify-content: flex-end; gap: 8px; }
.chat-create-modal-footer button { padding: 8px 20px; border-radius: 6px; font-size: 13px; cursor: pointer; border: none; }
.chat-create-modal-footer .btn-cancel { background: transparent; color: var(--text-muted); }
.chat-create-modal-footer .btn-cancel:hover { color: var(--text-primary); }
.chat-create-modal-footer .btn-create { background: var(--accent-primary); color: #000; font-weight: 600; }
.chat-create-modal-footer .btn-create:hover { opacity: 0.9; }

/* User Status */
.chat-user-status { font-size: 11px; color: var(--text-muted); margin-left: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 120px; }

/* Settings Panel */
.chat-settings-panel { padding: 16px 20px; }
.chat-settings-group { margin-bottom: 20px; }
.chat-settings-group-title { font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); margin-bottom: 10px; }
.chat-settings-item { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; }
.chat-settings-item label { font-size: 14px; color: var(--text-secondary); }

/* Paste Preview Overlay */
.chat-paste-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.6); z-index: 100; display: flex; align-items: center; justify-content: center; }
.chat-paste-dialog { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 12px; width: 360px; max-width: 90%; box-shadow: 0 8px 32px rgba(0,0,0,0.4); overflow: hidden; }
.chat-paste-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--border-color); font-size: 14px; font-weight: 600; color: var(--text-primary); }
.chat-paste-close { background: none; border: none; color: var(--text-muted); font-size: 20px; cursor: pointer; padding: 0 4px; line-height: 1; }
.chat-paste-close:hover { color: var(--text-primary); }
.chat-paste-body { padding: 16px; text-align: center; }
.chat-paste-img { max-width: 100%; max-height: 200px; border-radius: 8px; border: 1px solid var(--border-color); object-fit: contain; }
.chat-paste-file-icon { color: var(--text-muted); padding: 16px 0; }
.chat-paste-name { font-size: 13px; color: var(--text-primary); margin-top: 10px; word-break: break-all; }
.chat-paste-size { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.chat-paste-actions { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 16px; border-top: 1px solid var(--border-color); }
.chat-paste-cancel { background: none; border: 1px solid var(--border-color); color: var(--text-secondary); padding: 6px 16px; border-radius: 6px; cursor: pointer; font-size: 13px; }
.chat-paste-cancel:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.chat-paste-send { background: var(--accent-primary); border: none; color: #000; padding: 6px 20px; border-radius: 6px; cursor: pointer; font-size: 13px; font-weight: 600; }
.chat-paste-send:hover { opacity: 0.9; }

/* Permission System UI */
.role-template-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.role-template-card { background: var(--bg-secondary, #1e2028); border: 1px solid var(--border-color, #2a2d35); border-radius: 10px; padding: 16px; transition: border-color 0.2s; }
.role-template-card:hover { border-color: var(--accent-primary, #ffd700); }
.role-template-header { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.role-template-name { font-weight: 600; font-size: 14px; }
.role-template-meta { font-size: 12px; color: var(--text-secondary, #8a8f98); margin-bottom: 12px; }
.role-template-actions { display: flex; gap: 8px; }
.badge-scope-all { background: rgba(76, 175, 80, 0.15); color: #4caf50; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; text-transform: uppercase; }
.badge-scope-team { background: rgba(33, 150, 243, 0.15); color: #2196f3; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; text-transform: uppercase; }
.badge-scope-own { background: rgba(255, 152, 0, 0.15); color: #ff9800; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; text-transform: uppercase; }

.permission-editor { display: flex; flex-direction: column; gap: 16px; }
.permission-editor-section h4 { font-size: 14px; font-weight: 600; margin-bottom: 8px; color: var(--text-primary); }
.permission-editor-hint { font-size: 12px; color: var(--text-secondary, #8a8f98); margin-bottom: 8px; }

.perm-group { margin-bottom: 12px; }
.perm-group-title { font-size: 13px; font-weight: 600; color: var(--text-secondary, #8a8f98); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.5px; }
.perm-group-toggles { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.perm-toggle { display: flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; padding: 3px 0; }
.perm-toggle input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent-primary, #ffd700); cursor: pointer; }
.perm-label { color: var(--text-primary); }
.perm-toggle.overridden { background: rgba(255, 193, 7, 0.1); padding: 3px 6px; border-radius: 4px; }
.perm-toggle.overridden .perm-label { color: #ffc107; }

.role-template-modal-content { padding: 20px; }
.role-template-modal-content h3 { margin-bottom: 16px; }

/* Permission Denied Page */
.permission-denied-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 200px);
    padding: 2rem;
}

.permission-denied-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 3rem;
    text-align: center;
    max-width: 450px;
    width: 100%;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.1);
}

.permission-denied-icon {
    color: var(--accent-orange);
    margin-bottom: 1.5rem;
    opacity: 0.9;
}

.permission-denied-card h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.permission-denied-card p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    line-height: 1.6;
}

.permission-denied-hint {
    font-size: 0.85rem !important;
    color: var(--text-muted) !important;
    margin-bottom: 1.5rem !important;
}

.permission-denied-card .btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
}

.permission-denied-msg {
    padding: 2rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .permission-denied-card {
        padding: 2rem;
    }
    
    .permission-denied-card h2 {
        font-size: 1.25rem;
    }
}

/* ============================================
   GENERIC LOAD MORE PAGINATION
   ============================================ */

.load-more-container {
    text-align: center;
    padding: 1rem 0;
}

.load-more-container .load-more-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
    border: none;
    padding: 0.65rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.load-more-container .load-more-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.35);
}

.load-more-container .load-more-info {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 6px;
}
