/* --- Dark theme (default) --- */
:root, [data-theme="dark"] {
    --primary: #6366F1;
    --primary-dark: #4F46E5;
    --primary-light: #818CF8;
    --primary-glow: rgba(99, 102, 241, 0.3);
    --accent: #F59E0B;
    --accent-dark: #D97706;
    --accent-light: #FCD34D;
    --bg: #0F1117;
    --bg-secondary: #161822;
    --surface: #1E2030;
    --surface-hover: #252840;
    --surface-border: rgba(255,255,255,0.06);
    --glass: rgba(30, 32, 48, 0.8);
    --glass-border: rgba(255,255,255,0.08);
    --text: #F1F5F9;
    --text-secondary: #94A3B8;
    --text-muted: #64748B;
    --border: rgba(255,255,255,0.08);
    --success: #10B981;
    --success-bg: rgba(16, 185, 129, 0.12);
    --danger: #EF4444;
    --danger-bg: rgba(239, 68, 68, 0.12);
    --warning: #F59E0B;
    --warning-bg: rgba(245, 158, 11, 0.12);
    --radius: 12px;
    --radius-lg: 16px;
    --shadow: 0 4px 24px rgba(0,0,0,0.3);
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --code-bg: rgba(255,255,255,0.08);
    --scrollbar-thumb: rgba(255,255,255,0.1);
    --scrollbar-hover: rgba(255,255,255,0.2);
    --login-gradient-1: rgba(99,102,241,0.15);
    --login-gradient-2: rgba(245,158,11,0.1);
    --select-arrow: %2364748B;
    --toggle-bg: var(--surface-hover);
    --toggle-knob: var(--text-muted);
    --disabled-opacity: 0.5;
}

/* --- Light theme --- */
[data-theme="light"] {
    --primary: #4F46E5;
    --primary-dark: #4338CA;
    --primary-light: #6366F1;
    --primary-glow: rgba(79, 70, 229, 0.2);
    --accent: #D97706;
    --accent-dark: #B45309;
    --accent-light: #F59E0B;
    --bg: #F5F7FA;
    --bg-secondary: #FFFFFF;
    --surface: #FFFFFF;
    --surface-hover: #F1F5F9;
    --surface-border: rgba(0,0,0,0.06);
    --glass: rgba(255, 255, 255, 0.9);
    --glass-border: rgba(0,0,0,0.08);
    --text: #111827;
    --text-secondary: #4B5563;
    --text-muted: #9CA3AF;
    --border: rgba(0,0,0,0.1);
    --success: #059669;
    --success-bg: rgba(5, 150, 105, 0.08);
    --danger: #DC2626;
    --danger-bg: rgba(220, 38, 38, 0.08);
    --warning: #D97706;
    --warning-bg: rgba(217, 119, 6, 0.08);
    --shadow: 0 4px 24px rgba(0,0,0,0.08);
    --code-bg: rgba(0,0,0,0.05);
    --scrollbar-thumb: rgba(0,0,0,0.15);
    --scrollbar-hover: rgba(0,0,0,0.25);
    --login-gradient-1: rgba(79,70,229,0.08);
    --login-gradient-2: rgba(217,119,6,0.06);
    --select-arrow: %239CA3AF;
    --toggle-bg: #E5E7EB;
    --toggle-knob: #9CA3AF;
    --disabled-opacity: 0.6;
}

/* Light theme overrides for gradients that can't use variables */
[data-theme="light"] .sidebar-header h2 {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
[data-theme="light"] .login-card h1,
[data-theme="light"] .register-card h1 {
    background: linear-gradient(135deg, var(--text), var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
/* In light mode the Zinzino branding is more visible */
[data-theme="light"] .login-partner-branding {
    opacity: 0.65;
}
[data-theme="light"] .login-partner-branding:hover {
    opacity: 0.9;
}
[data-theme="light"] .message.user .message-bubble {
    color: white;
}

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

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

/* Scrollbar styling */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--scrollbar-hover); }

/* --- Modal --- */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}
.modal-overlay.show { display: flex; }

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

.modal-box {
    background: var(--surface);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 28px;
    max-width: 420px;
    width: 90%;
    box-shadow: var(--shadow);
    animation: slideUp 0.25s ease;
}

.modal-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    font-size: 22px;
}
.modal-icon.warning { background: var(--warning-bg); }
.modal-icon.error { background: var(--danger-bg); }
.modal-icon.success { background: var(--success-bg); }
.modal-icon.info { background: rgba(99,102,241,0.12); }

.modal-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
}

.modal-message {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 20px;
}

.modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* --- Login Page --- */
.login-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg);
    background-image:
        radial-gradient(ellipse at 20% 50%, var(--login-gradient-1) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, var(--login-gradient-2) 0%, transparent 50%);
}

.login-card {
    background: var(--surface);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 28px 32px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow);
}

.login-card h1 {
    font-size: 24px;
    margin-bottom: 8px;
    text-align: center;
    background: linear-gradient(135deg, var(--text), var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.login-card .subtitle {
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 12px;
    font-size: 14px;
}

/* Login page logo */
.login-logo {
    text-align: center;
    margin-bottom: 4px;
}
.login-logo-img {
    width: 100%;
    max-width: 380px;
    height: auto;
}

/* Zinzino partner branding at bottom of login */
.login-partner-branding {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-top: 32px;
    padding: 16px 0;
    opacity: 0.55;
    transition: opacity var(--transition);
}
.login-partner-branding:hover {
    opacity: 0.85;
}
.partner-divider {
    width: 60px;
    height: 1px;
    background: var(--border);
    margin-bottom: 4px;
}
.partner-label {
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}
.partner-logo {
    width: 160px;
    max-width: 100%;
    height: auto;
}

/* Sidebar logo */
.sidebar-logo-link {
    display: block;
    text-decoration: none;
    transition: opacity var(--transition);
}
.sidebar-logo-link:hover {
    opacity: 0.85;
}
.sidebar-logo {
    width: 160px;
    max-width: 100%;
    height: auto;
}

/* Mobile header logo */
.mobile-logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
}
.mobile-header-logo {
    height: 32px;
    width: auto;
}

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

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    color: var(--text);
    outline: none;
    transition: all var(--transition);
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

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

.form-group select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%2394A3B8' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.form-group select option {
    background: var(--surface);
    color: var(--text);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    gap: 6px;
}

.btn-primary {
    background: var(--primary);
    color: white;
    width: 100%;
}
.btn-primary:hover { background: var(--primary-dark); box-shadow: 0 4px 16px var(--primary-glow); }

.btn-danger {
    background: var(--danger-bg);
    color: var(--danger);
    padding: 6px 12px;
    font-size: 13px;
    border: 1px solid rgba(239,68,68,0.2);
}
.btn-danger:hover { background: rgba(239,68,68,0.2); }

.btn-secondary {
    background: var(--surface-hover);
    color: var(--text-secondary);
    padding: 6px 12px;
    font-size: 13px;
    border: 1px solid var(--border);
}
.btn-secondary:hover { background: rgba(255,255,255,0.08); color: var(--text); }

.error-msg {
    background: var(--danger-bg);
    color: var(--danger);
    padding: 10px 14px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 14px;
    border: 1px solid rgba(239,68,68,0.2);
}

/* --- Chat Layout --- */
.app-layout {
    display: flex;
    height: 100vh;
}

.sidebar {
    width: 260px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.sidebar-header h2 {
    font-size: 18px;
    background: linear-gradient(135deg, var(--primary-light), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 700;
}

.sidebar-header .team-name {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.sidebar-nav {
    padding: 12px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: var(--radius);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    margin-bottom: 4px;
    cursor: pointer;
    transition: all var(--transition);
}

.nav-item:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.nav-item.active {
    background: rgba(99,102,241,0.12);
    color: var(--primary-light);
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-info {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.sidebar-footer a {
    font-size: 13px;
    color: var(--text-muted);
    text-decoration: none;
    transition: color var(--transition);
}
.sidebar-footer a:hover { color: var(--danger); }

/* --- Main Content --- */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    background: var(--bg);
}

.chat-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-header h3 {
    font-size: 16px;
    font-weight: 600;
}

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

.message {
    display: flex;
    gap: 12px;
    max-width: 80%;
    animation: slideUp 0.3s ease;
}

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

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
    letter-spacing: -0.5px;
}

.message.assistant .message-avatar {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
}

.message.user .message-avatar {
    background: var(--surface-hover);
    color: var(--text-secondary);
}

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

.message.assistant .message-bubble {
    background: var(--surface);
    border: 1px solid var(--border);
}

.message.user .message-bubble {
    background: var(--primary);
    color: white;
}

/* KB correction button (admin only) */
.kb-correct-btn {
    display: block;
    margin-top: 8px;
    padding: 3px 10px;
    font-size: 11px;
    color: var(--text-muted);
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
}
.message-bubble:hover .kb-correct-btn {
    opacity: 1;
}
.kb-correct-btn:hover {
    color: #D4A843;
    border-color: #D4A843;
}

.message-bubble p { margin-bottom: 8px; }
.message-bubble p:last-child { margin-bottom: 0; }
.message-bubble ul, .message-bubble ol { margin: 8px 0 8px 20px; }
.message-bubble code {
    background: var(--code-bg);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
}
.message-bubble strong { font-weight: 600; }

.typing-indicator {
    display: none;
    align-self: flex-start;
    padding: 12px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    color: var(--text-muted);
    font-size: 14px;
    animation: pulse 1.5s infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
.typing-indicator.show { display: block; }

/* --- Chat Input --- */
.chat-input-area {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    background: var(--bg-secondary);
}

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

.chat-input-wrapper textarea {
    flex: 1;
    padding: 12px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    font-size: 14px;
    font-family: inherit;
    color: var(--text);
    resize: none;
    outline: none;
    min-height: 48px;
    max-height: 120px;
    transition: all var(--transition);
}

.chat-input-wrapper textarea::placeholder { color: var(--text-muted); }

.chat-input-wrapper textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.send-btn {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-lg);
    width: 48px;
    height: 48px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    flex-shrink: 0;
}
.send-btn:hover { background: var(--primary-dark); box-shadow: 0 4px 16px var(--primary-glow); }
.send-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* --- Social Post Generator Panel --- */
.post-generator {
    display: none;
    flex: 1;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}
.post-generator.active { display: flex; }
.chat-container { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow: hidden; }
.chat-container.hidden { display: none; }

.post-form {
    padding: 24px;
    flex: 1;
    overflow-y: auto;
}

.post-output {
    margin-top: 20px;
    padding: 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    font-size: 14px;
    line-height: 1.7;
    white-space: pre-wrap;
    display: none;
    color: var(--text);
}
.post-output.show { display: block; }

.copy-btn {
    margin-top: 8px;
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid rgba(16,185,129,0.2);
    padding: 8px 16px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all var(--transition);
}
.copy-btn:hover { background: rgba(16,185,129,0.2); }

/* --- Admin Page --- */
.admin-container {
    max-width: 960px;
    margin: 0 auto;
    padding: 32px 24px;
    overflow-y: auto;
    height: 100vh;
}

.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
}
.admin-header h1 { font-size: 24px; }

.stats-row {
    display: flex;
    gap: 16px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    flex: 1;
    text-align: center;
}

.stat-card .number {
    font-size: 32px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-light), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.stat-card .label {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}

.section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
}

.section h2 {
    font-size: 18px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.doc-list, .user-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.doc-item, .user-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.doc-item .doc-info, .user-item .user-info-row { flex: 1; }
.doc-item .doc-title, .user-item .user-name { font-weight: 500; font-size: 14px; }
.doc-item .doc-meta, .user-item .user-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.upload-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.tab-buttons {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.tab-btn {
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 13px;
    transition: all var(--transition);
}
.tab-btn:hover { background: var(--surface-hover); }
.tab-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.text-entry-form {
    display: none;
    flex-direction: column;
    gap: 12px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}
.text-entry-form.show { display: flex; }
.upload-form.hidden { display: none; }

/* --- Dashboard View --- */
.dashboard-view {
    display: none;
    flex: 1;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}
.dashboard-view.active { display: flex; }

.dashboard-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    align-content: start;
    -webkit-overflow-scrolling: touch;
}

.admin-balance-alerts {
    margin-bottom: 12px;
}
.balance-alert {
    background: #2a1a1a;
    border: 1px solid #ff4444;
    border-radius: 10px;
    padding: 12px 16px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.balance-alert-icon {
    font-size: 20px;
    color: #ff4444;
}
.balance-alert-text {
    font-size: 14px;
    font-weight: 600;
    color: #ff6666;
    flex: 1;
}
.balance-alert-action {
    font-size: 12px;
    color: var(--text-muted);
}

.dashboard-card {
    background: var(--surface);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-lg);
    padding: 20px;
    transition: all var(--transition);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.dashboard-card:hover {
    border-color: var(--primary-glow);
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.dashboard-card .card-icon {
    font-size: 24px;
    margin-bottom: 8px;
    line-height: 1;
}

.dashboard-card h4 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 10px;
}

.dashboard-card .card-text {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.dashboard-card .card-topic {
    font-size: 13px;
    font-weight: 600;
    color: var(--primary-light);
    margin-bottom: 8px;
    padding: 6px 10px;
    background: var(--primary-glow);
    border-radius: 6px;
    display: inline-block;
}

.dashboard-card .card-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 12px;
    line-height: 1.5;
}

.snippet-text {
    font-size: 13px !important;
    line-height: 1.6;
    color: var(--text-secondary);
}

.motivation-card {
    grid-column: 1 / -1;
    background: linear-gradient(135deg, var(--surface) 0%, rgba(99, 102, 241, 0.12) 50%, rgba(245, 158, 11, 0.06) 100%);
    border-color: rgba(99, 102, 241, 0.25);
    text-align: center;
    padding: 24px 20px;
}
.motivation-card .card-icon { font-size: 28px; }
.motivation-card .card-text {
    font-size: 16px;
    font-style: italic;
    color: var(--text);
    line-height: 1.7;
}

.todo-card {
    grid-column: 1 / -1;
}

/* --- Daily Game Plan Card --- */
.gameplan-card {
    grid-column: 1 / -1;
    background: linear-gradient(135deg, var(--surface) 0%, rgba(212, 168, 67, 0.04) 100%);
    border-color: rgba(212, 168, 67, 0.2);
}
.game-plan-content {
    font-size: 14px;
    line-height: 1.7;
    color: var(--text-secondary);
}
.game-plan-content h2.gp-greeting {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 4px 0;
    text-align: center;
}
.game-plan-content p.gp-date {
    font-size: 13px;
    color: #D4A843;
    text-align: center;
    margin-bottom: 12px;
}
.game-plan-content hr.gp-divider {
    border: none;
    border-top: 2px solid #D4A843;
    margin: 12px 0 20px 0;
}
.game-plan-content h3.gp-section-title {
    font-size: 15px;
    font-weight: 700;
    color: #D4A843;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 24px 0 10px 0;
}
.game-plan-content h3.gp-section-title:first-of-type {
    margin-top: 0;
}
.game-plan-content .gp-win {
    padding: 8px 0 8px 14px;
    border-left: 3px solid #D4A843;
    margin: 8px 0;
    color: var(--text-secondary);
}
.game-plan-content .gp-win strong,
.game-plan-content .gp-prospect strong {
    color: #D4A843;
}
.game-plan-content .gp-prospect {
    padding: 10px 14px;
    border-left: 3px solid #D4A843;
    margin: 10px 0;
    color: var(--text-secondary);
}
.game-plan-content .gp-script {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(212, 168, 67, 0.25);
    border-radius: 8px;
    padding: 14px 16px;
    margin: 10px 0;
    font-size: 13px;
    line-height: 1.7;
    color: var(--text);
    white-space: pre-wrap;
}
.game-plan-content p {
    margin: 6px 0;
}
.game-plan-content p strong {
    color: var(--text);
}

.leads-card {
    grid-column: 1 / -1;
}

.btn-sm {
    font-size: 12px;
    padding: 6px 14px;
}

.dashboard-date-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}
.dashboard-date-nav .btn-sm {
    padding: 4px 10px;
    font-size: 14px;
    min-width: 32px;
}

/* --- Leads Section --- */
.leads-search-form {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}
.leads-search-form input {
    flex: 1;
    padding: 10px 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color var(--transition);
}
.leads-search-form input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.leads-disclaimer {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    padding: 10px 12px;
    background: var(--warning-bg);
    border: 1px solid rgba(245, 158, 11, 0.2);
    border-radius: 8px;
    font-size: 12px;
    color: var(--warning);
    margin-bottom: 12px;
    line-height: 1.5;
}

.leads-results {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.lead-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    transition: all var(--transition);
}
.lead-card:hover {
    border-color: var(--primary-glow);
}

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

.lead-business {
    font-size: 14px;
    color: var(--text);
}

.lead-type {
    font-size: 11px;
    padding: 2px 8px;
    background: var(--primary-glow);
    color: var(--primary-light);
    border-radius: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.lead-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 6px;
}

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

.lead-label {
    font-weight: 500;
    color: var(--text-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.lead-reason {
    font-size: 12px;
    color: var(--text-muted);
    padding-top: 6px;
    border-top: 1px solid var(--border);
    font-style: italic;
    line-height: 1.4;
}

.lead-rating {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}
.lead-maps-link {
    color: var(--accent);
    text-decoration: none;
    font-size: 13px;
}
.lead-maps-link:hover {
    text-decoration: underline;
}
.lead-field a {
    color: var(--accent);
    text-decoration: none;
}
.lead-field a:hover {
    text-decoration: underline;
}

.leads-loading, .leads-empty, .leads-error {
    text-align: center;
    padding: 20px;
    font-size: 14px;
    color: var(--text-muted);
}
.leads-error { color: var(--danger); }

/* --- Todo List --- */
.todo-list {
    margin-bottom: 10px;
}

.todo-empty {
    font-size: 13px;
    color: var(--text-muted);
    padding: 8px 0;
}

.todo-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 4px;
    border-bottom: 1px solid var(--border);
    transition: all var(--transition);
}
.todo-item:last-child { border-bottom: none; }
.todo-item.completed .todo-text {
    text-decoration: line-through;
    color: var(--text-muted);
}

.todo-check {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0;
    line-height: 1;
    flex-shrink: 0;
    transition: color var(--transition);
}
.todo-item.completed .todo-check { color: var(--success); }

.todo-text {
    flex: 1;
    font-size: 13px;
    color: var(--text);
    line-height: 1.4;
}

.todo-delete {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 16px;
    cursor: pointer;
    padding: 0 4px;
    opacity: 0;
    transition: all var(--transition);
}
.todo-item:hover .todo-delete { opacity: 1; }
.todo-delete:hover { color: var(--danger); }

.todo-add-form {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
}
.todo-add-form input {
    flex: 1;
    padding: 8px 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 13px;
    font-family: inherit;
    outline: none;
    transition: border-color var(--transition);
}
.todo-add-form input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.todo-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}
.todo-suggestion-label {
    font-size: 11px;
    color: var(--text-muted);
    width: 100%;
    margin-bottom: 2px;
}

/* --- Scripts Panel --- */
.scripts-panel {
    display: none;
    flex: 1;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}
.scripts-panel.active { display: flex; }

.scripts-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.scripts-no-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    background: var(--warning-bg);
    border: 1px solid rgba(245, 158, 11, 0.2);
    border-radius: 8px;
    font-size: 13px;
    color: var(--warning);
    margin-bottom: 16px;
}
.scripts-no-link a { color: var(--primary-light); }

.scripts-categories {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.script-category {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.script-category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    cursor: pointer;
    transition: background var(--transition);
}
.script-category-header:hover { background: var(--surface-hover); }
.script-category-header h4 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 2px;
}
.script-category-header p {
    font-size: 12px;
    color: var(--text-muted);
}
.script-toggle {
    font-size: 12px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.script-category-body {
    border-top: 1px solid var(--border);
    padding: 12px 20px;
}

.script-item {
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}
.script-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.script-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}
.script-item-header strong {
    font-size: 13px;
    color: var(--primary-light);
}

.script-text {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: inherit;
    max-height: 300px;
    overflow-y: auto;
}

.scripts-loading {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
}

.app-version-footer {
    text-align: center;
    font-size: 10px;
    color: var(--text-muted);
    opacity: 0.5;
    margin-top: 4px;
}

/* --- Mobile bottom nav bar --- */
.mobile-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    z-index: 100;
    padding: 0;
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.mobile-nav-items {
    display: flex;
    justify-content: space-around;
    align-items: center;
    height: 56px;
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 8px;
    color: var(--text-muted);
    font-size: 9px;
    font-weight: 500;
    cursor: pointer;
    transition: color var(--transition);
    text-decoration: none;
    border: none;
    background: none;
    flex: 1;
    min-width: 0;
}

.mobile-nav-item span:first-child {
    font-size: 20px;
    line-height: 1;
}

.mobile-nav-item.active {
    color: var(--primary-light);
}

/* --- Mobile header bar --- */
.mobile-header {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 200;
    flex-shrink: 0;
}

.mobile-header h2 {
    font-size: 16px;
    background: linear-gradient(135deg, var(--primary-light), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 700;
}
.mobile-header .mobile-header-logo {
    height: 28px;
    width: auto;
}

.mobile-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}
.mobile-credits-badge {
    font-size: 11px;
    padding: 2px 8px;
    white-space: nowrap;
}

.mobile-profile-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
}
.mobile-profile-btn:hover {
    color: var(--text);
}

/* --- Responsive: Tablet --- */
@media (max-width: 768px) {
    .sidebar { width: 200px; }
    .message { max-width: 95%; }
    .stats-row { flex-direction: column; }
    .chat-messages { padding: 16px; }
    .post-form { padding: 16px; }
    .profile-form { padding: 16px; }
    .chat-header { padding: 12px 16px; }
    .chat-input-area { padding: 12px 16px; }
}

/* --- Responsive: Mobile --- */
@media (max-width: 600px) {
    .sidebar { display: none; }
    .mobile-nav { display: block; }
    .mobile-header { display: flex; }

    .app-layout { flex-direction: column; }

    .main-content {
        padding-bottom: 70px; /* space for bottom nav + safe area */
    }

    .mobile-nav {
        z-index: 150;
    }

    .dashboard-content {
        grid-template-columns: 1fr;
        padding: 16px;
        gap: 14px;
    }
    .dashboard-card {
        padding: 16px;
        border-radius: var(--radius);
        box-shadow: 0 2px 12px rgba(0,0,0,0.15);
    }
    .dashboard-card .card-icon { font-size: 22px; margin-bottom: 6px; }
    .dashboard-card h4 { font-size: 15px; margin-bottom: 8px; }
    .dashboard-card .card-text { font-size: 13px; margin-bottom: 10px; }
    .motivation-card { padding: 20px 16px; }
    .motivation-card .card-icon { font-size: 24px; }
    .motivation-card .card-text { font-size: 15px; }
    .dashboard-date-nav span { font-size: 12px; }
    .leads-search-form { flex-direction: column; }
    .todo-delete { opacity: 0.6; }
    .todo-suggestions .suggestion-chip { font-size: 11px; padding: 4px 10px; }

    .scripts-content { padding: 16px; }
    .script-category-header { padding: 12px 14px; }
    .script-category-header h4 { font-size: 14px; }
    .script-category-body { padding: 10px 14px; }
    .script-text { padding: 10px; font-size: 12px; }

    .login-card { margin: 12px; padding: 20px 24px; }
    .register-card { margin: 16px; padding: 24px; }

    .chat-header h3 { font-size: 14px; }
    .chat-messages { padding: 12px; gap: 12px; }
    .message { max-width: 92%; }
    .message-avatar { width: 30px; height: 30px; font-size: 10px; }
    .message-bubble { padding: 10px 12px; font-size: 13px; }
    .kb-correct-btn { opacity: 1; font-size: 10px; padding: 4px 8px; }

    .chat-input-area { padding: 10px 12px; padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px)); margin-bottom: 60px; }
    .chat-input-wrapper textarea { padding: 10px 12px; min-height: 42px; font-size: 14px; }
    .send-btn { width: 42px; height: 42px; border-radius: 10px; }

    .post-form { padding: 16px; }
    .post-tips { padding: 12px; font-size: 12px; }
    .post-tips h4 { font-size: 13px; }

    .suggestion-chip { padding: 4px 10px; font-size: 11px; }
    .topic-suggestions { gap: 4px; }

    .platform-info { padding: 10px 12px; font-size: 12px; }

    .profile-form { padding: 16px; max-width: 100%; }

    .replicated-link-box { flex-direction: column; align-items: stretch; gap: 8px; }
    .replicated-link-box .copy-link-btn { text-align: center; }

    .reminder-banner { flex-direction: column; gap: 8px; padding: 10px 16px; font-size: 13px; }
    .reminder-banner .btn-banner { align-self: flex-start; }

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

    .modal-box { margin: 16px; padding: 20px; }

    /* Admin page mobile */
    .admin-container { padding: 16px; }
    .admin-header { flex-direction: column; gap: 12px; align-items: flex-start; }
    .admin-header h1 { font-size: 20px; }
    .stat-card { padding: 14px; }
    .stat-card .number { font-size: 24px; }
    .section { padding: 16px; }
    .section h2 { font-size: 16px; }
    .doc-item { flex-direction: column; align-items: flex-start; gap: 8px; padding: 10px 12px; }
    .tab-buttons { flex-wrap: wrap; }
}

/* --- Accent button --- */
.btn-accent {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    width: 100%;
    font-weight: 600;
    letter-spacing: 0.3px;
}
.btn-accent:hover {
    box-shadow: 0 4px 20px var(--primary-glow);
    transform: translateY(-1px);
}

/* --- Login page secondary link --- */
.login-toggle {
    text-align: center;
    margin-top: 16px;
    font-size: 14px;
    color: var(--text-muted);
}
.login-toggle a {
    color: var(--primary-light);
    text-decoration: none;
    font-weight: 500;
}
.login-toggle a:hover { text-decoration: underline; }

/* --- Registration form --- */
.register-card {
    background: var(--surface);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 48px;
    width: 100%;
    max-width: 480px;
    box-shadow: var(--shadow);
}
.register-card h1 {
    font-size: 24px;
    margin-bottom: 8px;
    text-align: center;
    background: linear-gradient(135deg, var(--text), var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.register-card .subtitle {
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 32px;
    font-size: 14px;
}
.success-msg {
    background: var(--success-bg);
    color: var(--success);
    padding: 10px 14px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 14px;
    border: 1px solid rgba(16,185,129,0.2);
}
.form-row {
    display: flex;
    gap: 12px;
}
.form-row .form-group { flex: 1; }

/* --- Zinzino ID Reminder Banner --- */
.reminder-banner {
    background: linear-gradient(90deg, rgba(245,158,11,0.12), rgba(245,158,11,0.06));
    border-bottom: 1px solid rgba(245,158,11,0.2);
    padding: 10px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 14px;
    color: var(--accent-light);
}
.reminder-banner .banner-text {
    display: flex;
    align-items: center;
    gap: 8px;
}
.reminder-banner .btn-banner {
    background: var(--accent);
    color: var(--bg);
    border: none;
    padding: 6px 16px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all var(--transition);
}
.reminder-banner .btn-banner:hover { background: var(--accent-dark); }

/* --- Profile / Settings Panel --- */
.profile-panel {
    display: none;
    flex: 1;
    flex-direction: column;
}
.profile-panel.active { display: flex; }
.profile-form {
    padding: 24px;
    max-width: 560px;
}

.replicated-link-box {
    background: var(--success-bg);
    border: 1px solid rgba(16,185,129,0.2);
    border-radius: var(--radius);
    padding: 14px 18px;
    margin-top: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.replicated-link-box .link-url {
    font-size: 14px;
    font-weight: 500;
    color: var(--success);
    word-break: break-all;
}
.replicated-link-box .copy-link-btn {
    background: var(--success);
    color: white;
    border: none;
    padding: 6px 14px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 13px;
    white-space: nowrap;
    transition: all var(--transition);
}
.replicated-link-box .copy-link-btn:hover { opacity: 0.85; }

.no-link-msg {
    background: var(--warning-bg);
    border: 1px solid rgba(245,158,11,0.2);
    border-radius: var(--radius);
    padding: 14px 18px;
    margin-top: 12px;
    font-size: 14px;
    color: var(--accent-light);
}

/* --- Post Generator Improvements --- */
.platform-info {
    background: rgba(99,102,241,0.08);
    border: 1px solid rgba(99,102,241,0.15);
    border-radius: var(--radius);
    padding: 12px 16px;
    margin-top: 8px;
    font-size: 13px;
    color: var(--primary-light);
    line-height: 1.5;
}

.post-tips {
    background: rgba(99,102,241,0.06);
    border: 1px solid rgba(99,102,241,0.12);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 20px;
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-secondary);
}
.post-tips h4 {
    font-size: 14px;
    margin-bottom: 8px;
    color: var(--primary-light);
}
.post-tips ul {
    margin: 0;
    padding-left: 18px;
}
.post-tips li { margin-bottom: 4px; }

/* Topic suggestions */
.topic-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    margin-bottom: 8px;
}
.suggestion-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-right: 4px;
}
.suggestion-chip {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 5px 14px;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
    font-weight: 500;
}
.suggestion-chip:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 2px 12px var(--primary-glow);
    transform: translateY(-1px);
}

/* --- Toggle switch for include link --- */
.toggle-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

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

.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--toggle-bg);
    border-radius: 12px;
    transition: all var(--transition);
    border: 1px solid var(--border);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    height: 18px;
    width: 18px;
    left: 2px;
    bottom: 2px;
    background: var(--toggle-knob);
    border-radius: 50%;
    transition: all var(--transition);
}

/* --- Theme toggle button --- */
.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.15);
    background: rgba(255,255,255,0.08);
    color: var(--accent-light);
    cursor: pointer;
    transition: all var(--transition);
    font-size: 18px;
    flex-shrink: 0;
    padding: 0;
    line-height: 1;
}
.theme-toggle:hover {
    background: rgba(255,255,255,0.15);
    border-color: var(--accent);
    transform: scale(1.1);
}
[data-theme="light"] .theme-toggle {
    border: 1px solid rgba(0,0,0,0.15);
    background: rgba(0,0,0,0.05);
    color: var(--primary);
}
[data-theme="light"] .theme-toggle:hover {
    background: rgba(0,0,0,0.1);
    border-color: var(--primary);
}

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

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

.toggle-label {
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
}

/* --- User Table List (Admin) --- */
.user-search-bar {
    margin-bottom: 12px;
}
.user-search-bar input {
    width: 100%;
    max-width: 400px;
    padding: 8px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 14px;
}
.user-search-bar input:focus {
    border-color: var(--primary);
    outline: none;
}
.user-search-empty {
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
    padding: 16px;
}

.user-table-wrap {
    overflow-x: auto;
}
.user-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.user-table thead th {
    text-align: left;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.user-table tbody tr.user-row {
    cursor: pointer;
    transition: background var(--transition);
}
.user-table tbody tr.user-row:hover {
    background: var(--surface-hover);
}
.user-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    color: var(--text);
}
.user-table td.cell-muted {
    color: var(--text-muted);
}
.user-table td strong {
    font-weight: 600;
}

.card-role {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-left: 6px;
    vertical-align: middle;
}
.card-role.role-admin {
    background: rgba(99,102,241,0.15);
    color: var(--primary-light);
}

.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: middle;
}
.status-dot.active { background: #10B981; }
.status-dot.disabled { background: #EF4444; }

/* --- User Detail Modal (Admin) --- */
.user-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(4px);
}
.user-modal-overlay.show {
    display: flex;
}

.user-modal {
    background: var(--surface);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 32px;
    max-width: 560px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow);
}

.user-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}
.user-modal-header h3 {
    font-size: 20px;
    margin: 0;
}
.user-modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
}
.user-modal-close:hover { color: var(--text); }

.modal-section {
    margin-bottom: 20px;
}
.modal-section-title {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 10px;
    font-weight: 600;
}

.modal-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.modal-info-item label {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 2px;
}
.modal-info-item span {
    font-size: 14px;
    color: var(--text);
}

.credit-display {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
}
.credit-stat {
    text-align: center;
}
.credit-stat .big-number {
    font-size: 32px;
    font-weight: 700;
    color: var(--primary-light);
    line-height: 1;
}
.credit-stat .stat-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

.add-credits-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 12px;
}
.add-credits-row input {
    width: 100px;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 14px;
}

.modal-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.btn-success {
    background: var(--success);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all var(--transition);
}
.btn-success:hover { opacity: 0.85; }

.btn-warning {
    background: var(--warning);
    color: var(--bg);
    border: none;
    padding: 8px 16px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all var(--transition);
}
.btn-warning:hover { opacity: 0.85; }

/* --- Credits display in sidebar --- */
.credits-badge {
    font-size: 12px;
    color: #fff;
    padding: 4px 10px;
    background: #2ea043;
    border-radius: 20px;
    border: none;
    font-weight: 600;
}
.credits-badge.credits-low {
    background: #d29922;
}
.credits-badge.credits-out {
    background: #da3633;
}

/* Mobile responsive for user table */
@media (max-width: 600px) {
    .user-search-bar input {
        max-width: 100%;
    }
    .user-table {
        font-size: 13px;
    }
    .user-table td, .user-table thead th {
        padding: 8px 8px;
    }
    .user-modal {
        margin: 10px;
        padding: 20px;
        max-height: 85vh;
    }
    .modal-info-grid {
        grid-template-columns: 1fr;
    }
    .credit-display {
        gap: 16px;
    }
}

/* --- Chat List (Sidebar Conversations) --- */
.chat-list {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    border-top: 1px solid var(--border);
}

.chat-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

.new-chat-btn {
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 6px;
    width: 24px;
    height: 24px;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition);
}
.new-chat-btn:hover { background: var(--primary-dark); }

.chat-list-items {
    flex: 1;
    overflow-y: auto;
    padding: 4px 8px;
}

.chat-list-empty {
    padding: 12px 8px;
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
}

.chat-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: background var(--transition);
    margin-bottom: 2px;
}
.chat-list-item:hover {
    background: var(--surface-hover);
}
.chat-list-item.active {
    background: var(--primary-glow);
}

.chat-list-title {
    flex: 1;
    font-size: 13px;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.chat-list-actions {
    display: flex;
    gap: 2px;
    opacity: 0;
    transition: opacity var(--transition);
    flex-shrink: 0;
}
.chat-list-item:hover .chat-list-actions {
    opacity: 1;
}

.chat-action-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 14px;
    padding: 2px 4px;
    border-radius: 4px;
    line-height: 1;
}
.chat-action-btn:hover {
    color: var(--text);
    background: var(--surface);
}
.chat-action-btn.delete:hover {
    color: var(--danger);
}

/* --- Chat Images --- */
.chat-image {
    max-width: 100%;
    max-height: 400px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: transform var(--transition);
    display: block;
}
.chat-image:hover {
    transform: scale(1.02);
}
.image-bubble {
    padding: 8px !important;
}
.image-caption {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 8px;
    padding: 0 4px;
    line-height: 1.4;
}

/* --- Post Generator Image Output --- */
.post-image-output {
    margin-top: 16px;
    text-align: center;
}
.post-generated-image {
    max-width: 100%;
    max-height: 500px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}
.download-img-btn {
    margin-top: 8px;
    background: rgba(99,102,241,0.12);
    color: var(--primary-light);
    border: 1px solid rgba(99,102,241,0.2);
    padding: 8px 16px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    display: inline-block;
    transition: all var(--transition);
}
.download-img-btn:hover {
    background: rgba(99,102,241,0.2);
}

/* --- Image generation loading --- */
.image-loading {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px;
    color: var(--text-muted);
    font-size: 13px;
}
.image-loading .spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Mobile adjustments for images */
@media (max-width: 600px) {
    .chat-image { max-height: 250px; }
    .post-generated-image { max-height: 300px; }
}

/* --- Daily Believe Quote (Login Page) --- */
.daily-quote {
    background: linear-gradient(135deg, rgba(99,102,241,0.1), rgba(245,158,11,0.08));
    border: 1px solid rgba(99,102,241,0.15);
    border-radius: var(--radius);
    padding: 12px 16px;
    margin-bottom: 16px;
    text-align: center;
}
.daily-quote-text {
    font-size: 15px;
    font-style: italic;
    color: var(--text);
    line-height: 1.6;
    margin-bottom: 6px;
}
.daily-quote-author {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

/* --- Daily Believe Quote Banner (Dashboard) --- */
.daily-quote-banner {
    background: linear-gradient(90deg, rgba(99,102,241,0.08), rgba(245,158,11,0.06));
    border-bottom: 1px solid rgba(99,102,241,0.12);
    padding: 10px 24px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: var(--text-secondary);
    flex-wrap: wrap;
}
.daily-quote-banner .quote-star {
    font-size: 16px;
    flex-shrink: 0;
}
.daily-quote-banner .quote-text {
    font-style: italic;
    color: var(--text);
}
.daily-quote-banner .quote-author {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
}

/* --- Image Creator View --- */
.image-creator {
    display: none;
    flex: 1;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}
.image-creator.active { display: flex; }
.image-creator-form {
    padding: 24px;
    flex: 1;
    overflow-y: auto;
}
.image-creator-output {
    margin-top: 20px;
    text-align: center;
}
.image-creator-caption {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 8px;
    line-height: 1.4;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* Mobile adjustments for daily quote banner */
@media (max-width: 600px) {
    .daily-quote-banner {
        padding: 8px 16px;
        font-size: 13px;
    }
    .image-creator-form {
        padding: 16px;
    }
}

/* --- Inline Chat History Panel --- */
.inline-chat-list {
    border-bottom: 1px solid var(--border);
    background: var(--bg);
    max-height: 240px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.inline-chat-list-items {
    padding: 8px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.inline-chat-list .chat-list-item {
    padding: 8px 10px;
    border-radius: var(--radius);
    font-size: 13px;
}
.inline-chat-list .chat-list-empty {
    padding: 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

/* --- Fix bottom nav z-index and scroll containment --- */
@media (max-width: 600px) {
    .mobile-nav {
        z-index: 150;
    }
    .main-content {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    /* When chat is active, main-content must not scroll — let chat-container handle its own flex layout */
    .main-content.chat-active {
        overflow: hidden;
    }
    .main-content.chat-active .chat-container {
        height: 100%;
    }
}

/* --- Mobile More Menu --- */
.mobile-more-menu { display: none; }
.mobile-more-menu.show { display: block; }
.mobile-more-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 200;
}
.mobile-more-sheet {
    position: fixed; bottom: 60px; left: 8px; right: 8px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 8px 0; z-index: 201;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.3);
}
.mobile-more-item {
    display: flex; align-items: center; gap: 12px;
    width: 100%; padding: 14px 20px; background: none; border: none;
    color: var(--text); font-size: 15px; cursor: pointer;
    text-decoration: none;
}
.mobile-more-item:hover, .mobile-more-item:active { background: var(--bg); }
.mobile-more-item span { font-size: 18px; width: 24px; text-align: center; }

/* --- Follow-Up Tracker --- */
.followups-panel { display: none; padding: 0; }
.followups-panel.active { display: block; }
.followups-content { padding: 20px 24px; }
/* Search Bar */
.followups-search-bar {
    margin-bottom: 12px;
}
.followups-search-bar input {
    width: 100%; padding: 10px 14px; border-radius: var(--radius-lg); border: 1px solid var(--border);
    background: var(--surface); color: var(--text); font-size: 14px; box-sizing: border-box;
    outline: none; transition: border-color 0.2s;
}
.followups-search-bar input:focus { border-color: var(--accent); }

/* Tab Bar */
.followups-tabs {
    display: flex; gap: 4px; margin-bottom: 12px; border-bottom: 1px solid var(--border); padding-bottom: 0;
}
.followup-tab {
    padding: 8px 16px; border: none; background: none; color: var(--text-muted); font-size: 13px;
    font-weight: 500; cursor: pointer; border-bottom: 2px solid transparent; transition: all 0.2s;
    position: relative; white-space: nowrap;
}
.followup-tab:hover { color: var(--text); }
.followup-tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.tab-badge {
    font-size: 10px; background: var(--accent); color: #fff; border-radius: 10px;
    padding: 1px 6px; margin-left: 4px; font-weight: 600; min-width: 16px; text-align: center;
    display: inline-block;
}
.tab-badge:empty { display: none; }

/* Toolbar */
.followups-toolbar {
    display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap;
}
.followup-toggle-filters {
    display: flex; gap: 4px; flex-wrap: wrap; flex: 1;
}
.filter-pill {
    padding: 4px 12px; border-radius: 20px; border: 1px solid var(--border); background: var(--surface);
    color: var(--text-muted); font-size: 11px; cursor: pointer; transition: all 0.2s; font-weight: 500;
    white-space: nowrap;
}
.filter-pill:hover { border-color: var(--accent); color: var(--text); }
.filter-pill.active {
    background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 600;
}
.followups-toolbar-right {
    display: flex; gap: 8px; align-items: center; margin-left: auto;
}
.followup-sort-select {
    padding: 4px 8px; border-radius: var(--radius); border: 1px solid var(--border);
    background: var(--surface); color: var(--text); font-size: 12px;
}
.followups-toolbar select {
    padding: 6px 12px; border-radius: var(--radius); border: 1px solid var(--border);
    background: var(--surface); color: var(--text); font-size: 13px;
}
.followup-form {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
    padding: 16px; margin-bottom: 16px;
}
.followup-form h4 { margin: 0 0 12px; font-size: 15px; }
.followup-form-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
.followup-form .form-group { margin-bottom: 8px; }
.followup-form label { font-size: 12px; color: var(--text-muted); margin-bottom: 2px; display: block; }
.followup-form input, .followup-form textarea {
    width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius);
    background: var(--bg); color: var(--text); font-size: 13px; box-sizing: border-box;
}
.followup-form-actions { display: flex; gap: 8px; margin-top: 8px; }

.followups-list { display: flex; flex-direction: column; gap: 10px; }
.followups-empty, .followups-loading {
    text-align: center; padding: 24px; color: var(--text-muted); font-size: 14px;
}

.followup-card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 14px; transition: border-color 0.2s;
}
.followup-card:hover { border-color: var(--primary); }
.followup-card-header {
    display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 8px;
}
.followup-name { font-size: 15px; }
.followup-business { font-size: 13px; color: var(--text-muted); margin-left: 8px; }
.followup-status-badge {
    font-size: 11px; padding: 2px 10px; border-radius: 20px; color: #fff;
    font-weight: 600; white-space: nowrap;
}
.followup-card-details {
    display: flex; flex-wrap: wrap; gap: 10px; font-size: 12px; color: var(--text-muted); margin-bottom: 6px;
}
.followup-type {
    background: var(--bg); padding: 2px 8px; border-radius: 8px; font-size: 11px;
}
.followup-overdue { color: var(--danger); font-weight: 600; }
.followup-notes {
    font-size: 12px; color: var(--text-muted); font-style: italic; margin-bottom: 8px;
    padding: 6px 8px; background: var(--bg); border-radius: var(--radius); line-height: 1.4;
}
.platform-badge {
    font-size: 10px; padding: 2px 8px; border-radius: 12px; color: #fff;
    font-weight: 600; text-transform: capitalize; margin-left: 6px; display: inline-block;
}
.lead-type-badge {
    font-size: 10px; padding: 2px 8px; border-radius: 12px; color: #fff;
    font-weight: 600; text-transform: capitalize; margin-left: 4px; display: inline-block;
}
.followup-handle {
    color: var(--accent); text-decoration: none; font-size: 13px;
}
.followup-handle:hover { text-decoration: underline; }
.followup-why-contact {
    font-size: 12px; color: var(--text-secondary); margin-bottom: 6px;
    padding: 4px 8px; background: var(--bg); border-radius: var(--radius);
    border-left: 3px solid var(--accent); line-height: 1.4;
}
.followup-script-section {
    margin-bottom: 8px; padding: 8px; background: var(--bg); border-radius: var(--radius);
    border: 1px dashed var(--border);
}
.followup-script-text {
    font-size: 12px; color: var(--text-secondary); line-height: 1.5;
    margin-bottom: 6px; white-space: pre-wrap;
}
.copy-script-btn {
    font-size: 11px !important; padding: 3px 10px !important;
}
.followup-card-actions {
    display: flex; gap: 8px; align-items: center;
}
.followup-status-select {
    padding: 4px 8px; border-radius: var(--radius); border: 1px solid var(--border);
    background: var(--bg); color: var(--text); font-size: 12px;
}
.lead-track-btn {
    margin-top: 8px; font-size: 11px !important;
}

/* --- Follow-Ups Dashboard Widget --- */
.followups-widget-card { grid-column: 1 / -1; }
.followups-widget-list { margin-bottom: 10px; }
.followups-widget-empty {
    font-size: 13px; color: var(--text-muted); padding: 8px 0;
}
.followup-widget-item {
    display: flex; align-items: center; gap: 10px; padding: 6px 0;
    border-bottom: 1px solid var(--border); font-size: 13px;
}
.followup-widget-item:last-child { border-bottom: none; }
.fw-name { font-weight: 600; }
.fw-biz { color: var(--text-muted); font-size: 12px; }
.fw-date { margin-left: auto; font-size: 11px; color: var(--text-muted); }
.fw-date.overdue { color: var(--danger); font-weight: 600; }
.followup-widget-item.overdue { color: var(--danger); }

/* Nav Inbox Badge */
.nav-inbox-badge {
    font-size: 10px; background: var(--danger, #e53e3e); color: #fff; border-radius: 10px;
    padding: 1px 6px; margin-left: 4px; font-weight: 700; min-width: 16px; text-align: center;
    display: inline-block; line-height: 1.4;
}
.nav-inbox-badge:empty { display: none; }

/* Engaged & Sent Script Badges */
.engaged-badge {
    font-size: 10px; padding: 2px 8px; border-radius: 12px;
    background: #f59e0b; color: #fff; font-weight: 600;
    margin-left: 4px; display: inline-block;
}
.sent-script-badge {
    font-size: 10px; padding: 2px 8px; border-radius: 12px;
    background: #06b6d4; color: #fff; font-weight: 600;
    margin-left: 4px; display: inline-block;
}
.btn-engaged-active {
    background: #f59e0b !important; color: #fff !important; border-color: #f59e0b !important;
}

/* Snooze Buttons */
.snooze-btns { margin-left: 4px; }
.snooze-btn {
    padding: 1px 6px; font-size: 10px; border-radius: 8px; border: 1px solid var(--border);
    background: var(--surface); color: var(--text-muted); cursor: pointer;
    transition: all 0.15s; font-weight: 500;
}
.snooze-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

/* Archived card style */
.followup-card.archived { opacity: 0.7; }

/* Sent Script Modal */
#sentScriptOverlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 1000;
    display: flex; align-items: center; justify-content: center;
}
#sentScriptOverlay .modal-box {
    background: var(--surface); border-radius: var(--radius-lg); padding: 24px 32px;
    text-align: center; max-width: 320px; width: 90%; border: 1px solid var(--border);
}

@media (max-width: 640px) {
    .followup-form-grid { grid-template-columns: 1fr; }
    .followups-content { padding: 14px; }
    .followups-tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .followup-tab { padding: 8px 12px; font-size: 12px; }
    .followups-toolbar { flex-direction: column; align-items: stretch; }
    .followups-toolbar-right { margin-left: 0; justify-content: flex-end; }
    .followup-card-actions { flex-wrap: wrap; }
}

/* Priority Badge */
.priority-badge {
    font-size: 10px; padding: 2px 8px; border-radius: 12px;
    color: #fff; font-weight: 600;
    margin-left: 4px; display: inline-block;
}

/* Analytics Stats Grid */
.analytics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-top: 12px;
}
.stat-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 8px;
    text-align: center;
}
.stat-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--accent);
    line-height: 1.2;
}
.stat-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}
.stat-loading {
    color: var(--text-muted);
    font-size: 13px;
    grid-column: 1 / -1;
}
@media (max-width: 640px) {
    .analytics-grid { grid-template-columns: repeat(2, 1fr); }
}
