/**
 * Kweezi Chat App Styles (static/css/app.css)
 *
 * Extracted from chat_app.html for better maintainability.
 * 
 * Sections:
 *   - Variables & Reset
 *   - Navigation
 *   - Login View
 *   - Chat View
 *   - Settings View
 *   - Accounting View
 *   - Calendar View
 *   - Accounting Sub-pages
 *   - Transactions & Reports Views
 *   - Password Setup Modal
 *   - Responsive Styles
 */

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

:root {
    /* Website colors */
    --whatsapp-green: #25D366;
    --whatsapp-dark: #128C7E;
    --whatsapp-darker: #075E54;
    --whatsapp-light: #DCF8C6;
    --text-primary: #1a1a1a;
    --text-secondary: #6b7280;
    --bg-light: #f9fafb;
    --white: #ffffff;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
    --shadow-xl: 0 25px 50px -12px rgba(0,0,0,0.15);

    /* Chat colors (dark theme) */
    --bg-dark: #111b21;
    --bg-surface: #202c33;
    --bg-chat: #0b141a;
    --border: #2a3942;
    --chat-text-primary: #e9edef;
    --chat-text-secondary: #8696a0;
    --accent-green: #00a884;
    --accent-green-hover: #02906f;
    --bubble-incoming: #202c33;
    --bubble-outgoing: #005c4b;
    --danger: #ef4444;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 50%, #bbf7d0 100%);
    min-height: 100vh;
}

/* ================================
   NAVIGATION
   ================================ */
nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(255,255,255,0.98);
    backdrop-filter: blur(10px);
    z-index: 1000;
    padding: 1rem 2rem;
    box-shadow: var(--shadow-sm);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--whatsapp-darker);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-logo-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
}

.nav-logo-icon svg {
    width: 100%;
    height: 100%;
}

.nav-links {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.nav-links a:hover {
    color: var(--whatsapp-dark);
}

.nav-cta {
    background: var(--whatsapp-green);
    color: white !important;
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    transition: background 0.2s, transform 0.2s !important;
}

.nav-cta:hover {
    background: var(--whatsapp-dark);
    transform: translateY(-1px);
}

.nav-login {
    border: 2px solid var(--whatsapp-green);
    color: var(--whatsapp-green) !important;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.2s !important;
}

.nav-login:hover,
.nav-login.active {
    background: var(--whatsapp-green);
    color: white !important;
}

/* ================================
   LOGIN VIEW
   ================================ */
.login-page {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 100px 20px 40px;
}

.login-container {
    background: var(--white);
    border-radius: 24px;
    padding: 40px;
    max-width: 420px;
    width: 100%;
    text-align: center;
    box-shadow: var(--shadow-xl);
}

.login-container.hidden { display: none; }

.logo {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
}

.logo svg {
    width: 100%;
    height: 100%;
}

.login-title {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.login-subtitle {
    color: var(--text-secondary);
    font-size: 15px;
    margin-bottom: 30px;
}

.qr-section {
    background: var(--bg-light);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 20px;
    border: 1px solid #e5e7eb;
}

.qr-code {
    width: 200px;
    height: 200px;
    margin: 0 auto 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border-radius: 12px;
    padding: 10px;
}

.qr-code img {
    max-width: 100%;
    max-height: 100%;
}

.qr-instructions {
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.6;
}

.qr-instructions strong {
    color: var(--whatsapp-dark);
}

.divider {
    display: flex;
    align-items: center;
    margin: 25px 0;
    color: var(--text-secondary);
    font-size: 12px;
}

.divider::before, .divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e5e7eb;
}

.divider span {
    padding: 0 15px;
}

.magic-link-section {
    text-align: left;
}

.magic-link-section label {
    display: block;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 500;
}

.input-group {
    display: flex;
    gap: 10px;
}

.input-group input {
    flex: 1;
    padding: 12px 16px;
    border-radius: 10px;
    border: 2px solid #e5e7eb;
    background: white;
    color: var(--text-primary);
    font-size: 14px;
    transition: border-color 0.2s;
}

.input-group input::placeholder {
    color: #9ca3af;
}

.input-group input:focus {
    outline: none;
    border-color: var(--whatsapp-green);
}

.btn {
    padding: 12px 20px;
    border-radius: 10px;
    border: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: linear-gradient(135deg, var(--whatsapp-green), var(--whatsapp-dark));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

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

.status-message {
    margin-top: 20px;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 13px;
}

.status-message.waiting {
    background: rgba(37, 211, 102, 0.1);
    color: var(--whatsapp-dark);
}

.status-message.error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.status-message.success {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
}

/* Login Tabs */
.login-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 25px;
    background: var(--bg-light);
    padding: 4px;
    border-radius: 12px;
}

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

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

.login-tab.active {
    background: linear-gradient(135deg, var(--whatsapp-green), var(--whatsapp-dark));
    color: white;
    box-shadow: var(--shadow-sm);
}

.login-panel {
    display: none;
}

.login-panel.active {
    display: block;
}

/* Password form styles */
.password-section {
    text-align: left;
}

.password-section .form-group {
    margin-bottom: 16px;
}

.password-section label {
    display: block;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 500;
}

.password-section input {
    width: 100%;
    padding: 12px 16px;
    border-radius: 10px;
    border: 2px solid #e5e7eb;
    background: white;
    color: var(--text-primary);
    font-size: 14px;
    transition: border-color 0.2s;
}

.password-section input::placeholder {
    color: #9ca3af;
}

.password-section input:focus {
    outline: none;
    border-color: var(--whatsapp-green);
}

.password-section .btn-block {
    width: 100%;
    margin-top: 10px;
}

.form-footer {
    margin-top: 20px;
    font-size: 13px;
    color: var(--text-secondary);
}

.form-footer a {
    color: var(--whatsapp-dark);
    cursor: pointer;
    text-decoration: none;
    font-weight: 600;
}

.form-footer a:hover {
    text-decoration: underline;
}

/* Demo Tier Buttons */
.demo-tier-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 14px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.demo-tier-btn:hover {
    border-color: var(--accent-green);
    background: rgba(0, 168, 132, 0.05);
}

.demo-tier-icon {
    font-size: 20px;
    width: 32px;
    text-align: center;
}

.demo-tier-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.demo-tier-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 14px;
}

.demo-tier-price {
    font-size: 11px;
    color: var(--text-secondary);
}

.demo-tier-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
}

.demo-tier-badge.basic {
    background: rgba(99, 102, 241, 0.15);
    color: #6366f1;
}

.demo-tier-badge.business {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.demo-tier-badge.enterprise {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
}

.loading-dots {
    display: inline-flex;
    gap: 4px;
}

.loading-dots span {
    width: 6px;
    height: 6px;
    background: currentColor;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Hide nav when in chat mode */
body.chat-mode nav {
    display: none;
}

body.chat-mode {
    background: var(--bg-dark);
}

body.chat-mode .login-page {
    display: none;
}

@media (max-width: 768px) {
    .nav-links {
        display: none;
    }

    .login-page {
        padding: 80px 16px 24px;
    }

    .login-container {
        padding: 30px 24px;
    }
}

/* ================================
   CHAT VIEW
   ================================ */
.chat-container {
    width: 100%;
    height: 100vh;
    display: none;
    flex-direction: row;
    color: var(--chat-text-primary);
}

.chat-container.visible {
    display: flex;
}

/* Sidebar */
.chat-sidebar {
    width: 280px;
    min-width: 280px;
    background: var(--bg-dark);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.sidebar-header {
    padding: 16px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: var(--accent-green);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 600;
    color: white;
}

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

.sidebar-user-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--chat-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-status {
    font-size: 12px;
    color: var(--chat-text-secondary);
}

.sidebar-tier-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sidebar-tier-badge.trial {
    background: rgba(156, 163, 175, 0.2);
    color: #9ca3af;
}

.sidebar-tier-badge.basic {
    background: rgba(99, 102, 241, 0.2);
    color: #818cf8;
}

.sidebar-tier-badge.business {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
}

.sidebar-tier-badge.enterprise {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
}

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

.nav-section {
    margin-bottom: 20px;
}

.nav-section-title {
    padding: 8px 16px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--chat-text-secondary);
    letter-spacing: 0.5px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--chat-text-primary);
    cursor: pointer;
    transition: background 0.2s;
}

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

.nav-item.active {
    background: var(--bg-surface);
    border-left: 3px solid var(--accent-green);
}

.nav-item-icon {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--chat-text-secondary);
}

.nav-item.active .nav-item-icon {
    color: var(--accent-green);
}

.nav-item-label {
    font-size: 14px;
}

.nav-item-badge {
    margin-left: auto;
    background: var(--accent-green);
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border);
}

.btn-sidebar {
    width: 100%;
    padding: 10px;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--chat-text-secondary);
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn-sidebar:hover {
    background: var(--bg-surface);
    color: var(--chat-text-primary);
}

/* Main chat area */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.chat-header {
    background: var(--bg-surface);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    border-bottom: 1px solid var(--border);
}

.chat-header-logo {
    width: 40px;
    height: 40px;
}

.chat-header-info {
    flex: 1;
}

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

.chat-header-status {
    font-size: 12px;
    color: var(--text-secondary);
}

.chat-header-status.online {
    color: var(--accent-green);
}

.btn-logout {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    padding: 8px 16px;
    font-size: 13px;
}

.btn-logout:hover {
    background: var(--border);
    color: var(--text-primary);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: var(--bg-chat);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.date-divider {
    text-align: center;
    margin: 15px 0;
}

.date-divider span {
    background: var(--bg-surface);
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 12px;
    color: var(--text-secondary);
}

.message {
    max-width: 65%;
    display: flex;
    flex-direction: column;
}

.message.incoming {
    align-self: flex-start;
}

.message.outgoing {
    align-self: flex-end;
}

.message-bubble {
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.message.incoming .message-bubble {
    background: var(--bubble-incoming);
    border-bottom-left-radius: 4px;
}

.message.outgoing .message-bubble {
    background: var(--bubble-outgoing);
    border-bottom-right-radius: 4px;
}

.message-time {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 4px;
    padding: 0 4px;
}

.message.outgoing .message-time {
    text-align: right;
}

.message-source {
    font-size: 10px;
    color: var(--text-secondary);
    opacity: 0.7;
}

.chat-input-area {
    background: var(--bg-surface);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-top: 1px solid var(--border);
}

.chat-input {
    flex: 1;
    padding: 12px 16px;
    border-radius: 24px;
    border: none;
    background: var(--bg-dark);
    color: var(--text-primary);
    font-size: 14px;
    resize: none;
    max-height: 120px;
    overflow-y: auto;
}

.chat-input::placeholder {
    color: var(--text-secondary);
}

.chat-input:focus {
    outline: none;
}

.btn-send {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.btn-send svg {
    width: 20px;
    height: 20px;
}

.btn-send:disabled {
    opacity: 0.5;
}

/* Attachment and Voice buttons */
.btn-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: transparent;
    border: none;
    color: var(--chat-text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-icon:hover {
    color: var(--accent-green);
    background: rgba(255, 255, 255, 0.1);
}

.btn-icon svg {
    width: 22px;
    height: 22px;
}

.btn-icon.recording {
    color: #ef4444;
    animation: pulse-recording 1.5s infinite;
}

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

/* Hidden file input */
#fileInput {
    display: none;
}

/* File preview */
.file-preview {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-dark);
    border-radius: 8px;
    margin-bottom: 8px;
}

.file-preview.visible {
    display: flex;
}

.file-preview-icon {
    font-size: 24px;
}

.file-preview-info {
    flex: 1;
    overflow: hidden;
}

.file-preview-name {
    font-size: 13px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

.file-preview-remove {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.file-preview-remove:hover {
    background: rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
}

/* Voice recording indicator */
.recording-indicator {
    display: none;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-dark);
    border-radius: 24px;
    flex: 1;
}

.recording-indicator.visible {
    display: flex;
}

.recording-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #ef4444;
    animation: pulse-recording 1s infinite;
}

.recording-time {
    font-size: 14px;
    color: var(--text-primary);
    font-family: monospace;
}

.recording-cancel {
    margin-left: auto;
    padding: 6px 12px;
    border-radius: 16px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 12px;
}

.recording-cancel:hover {
    background: rgba(255, 255, 255, 0.2);
}

.typing-indicator {
    display: none;
    align-self: flex-start;
    padding: 12px 16px;
    background: var(--bubble-incoming);
    border-radius: 12px;
    border-bottom-left-radius: 4px;
}

.typing-indicator.visible {
    display: block;
}

.typing-indicator .loading-dots span {
    background: var(--text-secondary);
}

/* ================================
   SETTINGS VIEW
   ================================ */
.settings-section {
    background: var(--bg-surface);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
}

.settings-section-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--chat-text-primary);
    margin-bottom: 4px;
}

.settings-section-desc {
    font-size: 13px;
    color: var(--chat-text-secondary);
    margin-bottom: 16px;
}

.connection-cards {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.connection-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 10px;
    transition: border-color 0.2s;
}

.connection-card:hover {
    border-color: var(--accent-green);
}

.connection-card.disabled {
    opacity: 0.6;
}

.connection-card.disabled:hover {
    border-color: var(--border);
}

.connection-card.connected {
    border-color: var(--accent-green);
    background: rgba(0, 168, 132, 0.1);
}

.connection-logo {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.connection-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--chat-text-primary);
    margin-bottom: 2px;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
}

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

.status-dot.connected {
    background: var(--accent-green);
}

.status-dot.disconnected {
    background: var(--chat-text-secondary);
}

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

.status-text.coming-soon {
    color: var(--chat-text-secondary);
    font-style: italic;
}

.btn-connect {
    padding: 8px 16px;
    border-radius: 6px;
    border: none;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--accent-green);
    color: white;
}

.btn-connect:hover {
    background: var(--accent-green-hover);
}

.btn-connect:disabled {
    background: var(--border);
    color: var(--chat-text-secondary);
    cursor: not-allowed;
}

.btn-connect.connected {
    background: transparent;
    border: 1px solid var(--accent-green);
    color: var(--accent-green);
}

/* ================================
   ACCOUNTING VIEW
   ================================ */

/* NOTE: Old accounting-period-filter and accounting-summary-panel styles
   removed in v2.40.20 - replaced by clean-filter-bar and summary-panel styles
   in the CLEAN FILTER BAR section below */

.accounting-stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

@media (max-width: 900px) {
    .accounting-stats-row {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 500px) {
    .accounting-stats-row {
        grid-template-columns: 1fr;
    }
}

.accounting-stat-card {
    background: var(--bg-surface);
    border-radius: 14px;
    padding: 18px;
    display: flex;
    align-items: center;
    border: 1px solid var(--border-color);
    gap: 12px;
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

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

.stat-icon.expense-icon {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.stat-icon.profit-icon {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}

.stat-icon.journal-icon {
    background: rgba(168, 85, 247, 0.15);
    color: #a855f7;
}

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

.stat-label {
    font-size: 12px;
    color: var(--chat-text-secondary);
    margin-bottom: 4px;
}

.stat-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--chat-text-primary);
}

.stat-value.income {
    color: #22c55e;
}

.stat-value.expense {
    color: #ef4444;
}

.accounting-section {
    background: var(--bg-surface);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
}

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

.accounting-section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.accounting-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
}

.accounting-tile {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.accounting-tile:hover {
    border-color: var(--accent-green);
    background: rgba(0, 168, 132, 0.08);
    transform: translateY(-1px);
}

.tile-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.tile-icon.income-bg {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

.tile-icon.expense-bg {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.tile-icon.profit-bg {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}

.tile-icon.reports-bg {
    background: rgba(168, 85, 247, 0.15);
    color: #a855f7;
}

.tile-icon.ledger-bg {
    background: rgba(249, 115, 22, 0.15);
    color: #f97316;
}

.tile-icon.journal-bg {
    background: rgba(236, 72, 153, 0.15);
    color: #ec4899;
}

.tile-icon.statement-bg {
    background: rgba(20, 184, 166, 0.15);
    color: #14b8a6;
}

.tile-icon.receivable-bg {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

.tile-icon.payable-bg {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.tile-icon.supplier-bg {
    background: rgba(249, 115, 22, 0.15);
    color: #f97316;
}

.tile-icon.customer-bg {
    background: rgba(139, 92, 246, 0.15);
    color: #8b5cf6;
}

.tile-icon.settings-bg {
    background: rgba(107, 114, 128, 0.15);
    color: #6b7280;
}

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

.tile-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--chat-text-primary);
    margin-bottom: 2px;
}

.tile-desc {
    font-size: 12px;
    color: var(--chat-text-secondary);
}

.tile-arrow {
    font-size: 18px;
    color: var(--chat-text-secondary);
    opacity: 0;
    transition: opacity 0.2s, transform 0.2s;
}

.accounting-tile:hover .tile-arrow {
    opacity: 1;
    transform: translateX(3px);
}

/* Locked tile styles */
.accounting-tile.tile-locked {
    opacity: 0.6;
    pointer-events: auto;
    position: relative;
}

.accounting-tile.tile-locked:hover {
    border-color: rgba(255, 193, 7, 0.5);
    background: rgba(255, 193, 7, 0.05);
}

.tile-lock-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: linear-gradient(135deg, #ffc107, #ff9800);
    color: #1a1a2e;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
}

.tile-lock-badge .lock-icon {
    font-size: 10px;
}

/* ================================
   CALENDAR VIEW
   ================================ */
.calendar-stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

@media (max-width: 900px) {
    .calendar-stats-row {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 500px) {
    .calendar-stats-row {
        grid-template-columns: 1fr;
    }
}

.calendar-stat-card {
    background: var(--bg-surface);
    border-radius: 14px;
    padding: 18px;
    display: flex;
    align-items: center;
    border: 1px solid var(--border-color);
    gap: 12px;
}

.stat-icon.today-icon {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}

.stat-icon.week-icon {
    background: rgba(168, 85, 247, 0.15);
    color: #a855f7;
}

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

.stat-icon.overdue-icon {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.stat-value.overdue {
    color: #ef4444;
}

.calendar-filter-row {
    display: flex;
    gap: 16px;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.calendar-period-select {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 14px;
    color: var(--chat-text-primary);
    font-size: 14px;
    cursor: pointer;
}

.calendar-period-select:focus {
    outline: none;
    border-color: var(--accent-green);
}

.calendar-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--chat-text-secondary);
    font-size: 14px;
    cursor: pointer;
}

.calendar-checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent-green);
}

.calendar-info-banner {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 10px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    color: #3b82f6;
    font-size: 13px;
}

/* Visual Calendar Grid Styles (v2.38) */
.calendar-grid-container {
    margin-bottom: 24px;
}

.calendar-grid-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.calendar-grid-tab {
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-surface);
    cursor: pointer;
    font-size: 13px;
    color: var(--chat-text-secondary);
    transition: all 0.2s;
}

.calendar-grid-tab:hover {
    background: var(--bg-tertiary);
}

.calendar-grid-tab.active {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

.calendar-grid {
    display: none;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
}

.calendar-grid.active {
    display: block;
}

.calendar-grid-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
}

.calendar-grid-header-cell {
    padding: 12px 8px;
    text-align: center;
    font-weight: 600;
    font-size: 12px;
    color: var(--chat-text-secondary);
}

.calendar-grid-body {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}

.calendar-grid-cell {
    min-height: 80px;
    padding: 8px;
    border-right: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    position: relative;
}

.calendar-grid-cell:nth-child(7n) {
    border-right: none;
}

.calendar-grid-cell.other-month {
    background: var(--bg-tertiary);
    opacity: 0.5;
}

.calendar-grid-cell.today {
    background: rgba(59, 130, 246, 0.1);
}

.calendar-grid-cell.has-event {
    background: rgba(34, 197, 94, 0.05);
}

.calendar-day-number {
    font-size: 14px;
    font-weight: 600;
    color: var(--chat-text-primary);
    margin-bottom: 4px;
}

.calendar-grid-cell.today .calendar-day-number {
    background: var(--accent-color);
    color: white;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.calendar-cell-events {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.calendar-cell-event {
    font-size: 10px;
    padding: 2px 4px;
    border-radius: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}

.calendar-cell-event.invoice_due {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.calendar-cell-event.recurring_expense {
    background: rgba(168, 85, 247, 0.15);
    color: #a855f7;
}

.calendar-cell-event.reminder {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
}

/* Weekly grid specific */
.calendar-weekly-grid .calendar-grid-cell {
    min-height: 100px;
}

@media (max-width: 768px) {
    .calendar-grid-cell {
        min-height: 60px;
        padding: 4px;
    }
    .calendar-day-number {
        font-size: 12px;
    }
    .calendar-cell-event {
        font-size: 9px;
    }
    .calendar-grid-header-cell {
        padding: 8px 4px;
        font-size: 10px;
    }
}

.calendar-events-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.calendar-loading {
    text-align: center;
    padding: 40px;
    color: var(--chat-text-secondary);
}

.calendar-empty {
    text-align: center;
    padding: 40px;
    color: var(--chat-text-secondary);
}

.calendar-event-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    gap: 14px;
    align-items: flex-start;
}

.calendar-event-card.overdue {
    border-color: rgba(239, 68, 68, 0.4);
    background: rgba(239, 68, 68, 0.05);
}

.calendar-event-card.completed {
    opacity: 0.6;
}

.event-date-box {
    background: var(--bg-tertiary);
    border-radius: 8px;
    padding: 10px 14px;
    text-align: center;
    min-width: 60px;
}

.event-date-box.today {
    background: rgba(59, 130, 246, 0.15);
}

.event-date-box.overdue {
    background: rgba(239, 68, 68, 0.15);
}

.event-date-day {
    font-size: 22px;
    font-weight: 700;
    color: var(--chat-text-primary);
}

.event-date-month {
    font-size: 11px;
    color: var(--chat-text-secondary);
    text-transform: uppercase;
}

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

.event-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--chat-text-primary);
    margin-bottom: 4px;
}

.event-meta {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    font-size: 12px;
    color: var(--chat-text-secondary);
}

.event-type-badge {
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 500;
}

.event-type-badge.invoice_due {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.event-type-badge.recurring_expense {
    background: rgba(168, 85, 247, 0.15);
    color: #a855f7;
}

.event-type-badge.custom_task {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}

.event-type-badge.reminder {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

.event-status-badge {
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 500;
}

.event-status-badge.overdue {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.event-status-badge.completed {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

.event-amount {
    font-weight: 600;
    color: var(--chat-text-primary);
}

/* Trial banner */
.trial-banner {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #00a884, #128c7e);
    color: white;
    padding: 10px 16px;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 13px;
    z-index: 100;
}

.trial-banner.visible {
    display: flex;
}

/* Adjust main content when trial banner is visible */
.chat-container:has(.trial-banner.visible) {
    padding-top: 44px;
}

.trial-banner-content {
    display: flex;
    align-items: center;
    gap: 8px;
}

.trial-banner-icon {
    font-size: 16px;
}

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

.trial-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 5px 12px;
    border-radius: 16px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

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

.trial-btn-upgrade {
    background: white;
    color: #128c7e;
    font-weight: 600;
}

.trial-btn-upgrade:hover {
    background: #f0f0f0;
}

/* Upgrade modal */
.upgrade-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.upgrade-modal-overlay.visible {
    display: flex;
}

.upgrade-modal {
    background: var(--bg-surface);
    border-radius: 16px;
    max-width: 400px;
    width: 100%;
    padding: 24px;
    text-align: center;
}

.upgrade-modal-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.upgrade-modal h2 {
    color: var(--text-primary);
    font-size: 20px;
    margin-bottom: 8px;
}

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

.upgrade-tiers {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.upgrade-tier {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s;
}

.upgrade-tier:hover {
    border-color: var(--accent-green);
}

.upgrade-tier.recommended {
    border-color: var(--accent-green);
    background: rgba(0, 168, 132, 0.1);
}

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

.upgrade-tier-name {
    color: var(--text-primary);
    font-weight: 600;
}

.upgrade-tier-price {
    color: var(--accent-green);
    font-weight: 700;
}

.upgrade-tier-desc {
    color: var(--text-secondary);
    font-size: 12px;
}

.upgrade-tier-badge {
    background: var(--accent-green);
    color: white;
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 8px;
}

.upgrade-modal-close {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
}

.upgrade-modal-close:hover {
    background: var(--bg-tertiary);
}

.accounting-toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px 24px;
    min-width: 280px;
    max-width: 400px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    z-index: 9999;
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.accounting-toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--chat-text-primary);
    margin-bottom: 4px;
}

.toast-desc {
    font-size: 13px;
    color: var(--chat-text-secondary);
    margin-bottom: 8px;
}

.toast-hint {
    font-size: 12px;
    color: var(--accent-green);
    font-weight: 500;
}

/* ================================
   ACCOUNTING SUB-PAGES
   ================================ */
.acc-page-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 500;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.acc-page-overlay.visible {
    opacity: 1;
    visibility: visible;
}

.acc-page-panel {
    position: fixed;
    top: 0;
    right: -500px;
    width: 100%;
    max-width: 500px;
    height: 100vh;
    background: var(--bg-chat);
    z-index: 501;
    display: flex;
    flex-direction: column;
    transition: right 0.3s ease;
    box-shadow: -5px 0 30px rgba(0,0,0,0.3);
}

.acc-page-panel.visible {
    right: 0;
}

@media (max-width: 600px) {
    .acc-page-panel {
        max-width: 100%;
    }
}

.acc-page-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
}

.acc-page-back {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: var(--bg-tertiary);
    color: var(--chat-text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: background 0.2s;
}

.acc-page-back:hover {
    background: var(--bg-hover);
}

.acc-page-title {
    flex: 1;
    font-size: 18px;
    font-weight: 600;
    color: var(--chat-text-primary);
}

.acc-page-action {
    padding: 8px 16px;
    border-radius: 8px;
    border: none;
    background: var(--accent-green);
    color: white;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.acc-page-action:hover {
    opacity: 0.9;
}

.acc-page-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

/* Summary Cards in Pages */
.acc-summary-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.acc-summary-card {
    background: var(--bg-surface);
    border-radius: 12px;
    padding: 16px;
    border: 1px solid var(--border-color);
}

.acc-summary-label {
    font-size: 12px;
    color: var(--chat-text-secondary);
    margin-bottom: 4px;
}

.acc-summary-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--chat-text-primary);
}

.acc-summary-value.income { color: #22c55e; }
.acc-summary-value.expense { color: #ef4444; }
.acc-summary-value.profit { color: #3b82f6; }

/* Transaction List in Pages */
.acc-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.acc-list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.acc-list-item:hover {
    border-color: var(--accent-green);
    background: rgba(0, 168, 132, 0.05);
}

.acc-list-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.acc-list-icon.income { background: rgba(34, 197, 94, 0.15); }
.acc-list-icon.expense { background: rgba(239, 68, 68, 0.15); }
.acc-list-icon.invoice { background: rgba(59, 130, 246, 0.15); }
.acc-list-icon.category { background: rgba(168, 85, 247, 0.15); }

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

.acc-list-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--chat-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.acc-list-subtitle {
    font-size: 12px;
    color: var(--chat-text-secondary);
    margin-top: 2px;
}

.acc-list-amount {
    font-size: 15px;
    font-weight: 600;
    text-align: right;
}

.acc-list-amount.income { color: #22c55e; }
.acc-list-amount.expense { color: #ef4444; }

.acc-list-date {
    font-size: 11px;
    color: var(--chat-text-secondary);
    text-align: right;
    margin-top: 2px;
}

/* v2.40.12: Multi-currency display */
.acc-list-amounts {
    text-align: right;
    min-width: 100px;
}

.acc-list-converted {
    font-size: 11px;
    color: var(--chat-text-secondary);
    margin-top: 2px;
}

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

.acc-empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.acc-empty-text {
    font-size: 14px;
    margin-bottom: 20px;
}

/* Add Form Modal */
.acc-form-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 600;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.acc-form-overlay.visible {
    display: flex;
}

.acc-form {
    background: var(--bg-surface);
    border-radius: 16px;
    width: 100%;
    max-width: 400px;
    max-height: 90vh;
    overflow-y: auto;
}

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

.acc-form-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--chat-text-primary);
}

.acc-form-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: var(--bg-tertiary);
    color: var(--chat-text-secondary);
    cursor: pointer;
    font-size: 18px;
}

.acc-form-body {
    padding: 20px;
}

.acc-form-group {
    margin-bottom: 16px;
}

.acc-form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--chat-text-secondary);
    margin-bottom: 8px;
}

.acc-form-input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-tertiary);
    color: var(--chat-text-primary);
    font-size: 14px;
}

.acc-form-input:focus {
    outline: none;
    border-color: var(--accent-green);
}

.acc-form-select {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-tertiary);
    color: var(--chat-text-primary);
    font-size: 14px;
    cursor: pointer;
}

.acc-form-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 12px;
}

.acc-form-btn {
    flex: 1;
    padding: 12px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: opacity 0.2s;
}

.acc-form-btn.primary {
    background: var(--accent-green);
    color: white;
}

.acc-form-btn.secondary {
    background: var(--bg-tertiary);
    color: var(--chat-text-primary);
    border: 1px solid var(--border-color);
}

/* Category Grid */
.acc-category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
}

.acc-category-item {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.acc-category-item:hover {
    border-color: var(--accent-green);
}

.acc-category-icon {
    font-size: 24px;
    margin-bottom: 8px;
}

.acc-category-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--chat-text-primary);
    margin-bottom: 4px;
}

.acc-category-count {
    font-size: 11px;
    color: var(--chat-text-secondary);
}

/* Financial Statement Tables */
.acc-table {
    width: 100%;
    border-collapse: collapse;
}

.acc-table th,
.acc-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.acc-table th {
    font-size: 12px;
    font-weight: 600;
    color: var(--chat-text-secondary);
    text-transform: uppercase;
    background: var(--bg-surface);
}

.acc-table td {
    font-size: 14px;
    color: var(--chat-text-primary);
}

.acc-table .amount {
    text-align: right;
    font-weight: 500;
    font-family: monospace;
}

.acc-table .total-row {
    font-weight: 700;
    background: var(--bg-surface);
}

.acc-table .total-row td {
    border-top: 2px solid var(--border-color);
}

/* Invoice Status Badges */
.acc-status {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.acc-status.paid { background: rgba(34, 197, 94, 0.15); color: #22c55e; }
.acc-status.pending { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }
.acc-status.overdue { background: rgba(239, 68, 68, 0.15); color: #ef4444; }
.acc-status.draft { background: rgba(156, 163, 175, 0.15); color: #9ca3af; }

/* Section Headers in Pages */
.acc-section-header {
    font-size: 13px;
    font-weight: 600;
    color: var(--chat-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 24px 0 12px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.acc-section-header:first-child {
    margin-top: 0;
}

/* Filter/Search Bar */
.acc-filter-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.acc-search {
    flex: 1;
    position: relative;
}

.acc-search input {
    width: 100%;
    padding: 10px 14px 10px 36px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-surface);
    color: var(--chat-text-primary);
    font-size: 14px;
}

.acc-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--chat-text-secondary);
    font-size: 14px;
}

.acc-filter-btn {
    padding: 10px 16px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-surface);
    color: var(--chat-text-primary);
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
}

.acc-filter-btn.active {
    background: var(--accent-green);
    border-color: var(--accent-green);
    color: white;
}

.settings-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

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

.settings-item-label {
    font-size: 14px;
    color: var(--chat-text-secondary);
}

.settings-item-value {
    font-size: 14px;
    color: var(--chat-text-primary);
    font-weight: 500;
}

.settings-item-editable {
    flex-shrink: 0;
}

.settings-input,
.settings-select {
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 14px;
    color: var(--chat-text-primary);
    min-width: 180px;
    transition: border-color 0.2s;
}

.settings-input:focus,
.settings-select:focus {
    outline: none;
    border-color: var(--accent-green);
}

.settings-input::placeholder {
    color: var(--chat-text-secondary);
}

.settings-select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='%238696a0'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
}

.settings-select option {
    background: var(--bg-surface);
    color: var(--chat-text-primary);
}

/* Toggle Switch */
.settings-toggle {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
}

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

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--border);
    border-radius: 26px;
    transition: 0.3s;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.3s;
}

.settings-toggle input:checked + .toggle-slider {
    background: var(--accent-green);
}

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

/* Clickable Settings Item */
.settings-item.clickable {
    cursor: pointer;
    transition: background 0.2s;
}

.settings-item.clickable:hover {
    background: var(--bg-dark);
    margin: 0 -20px;
    padding: 12px 20px;
}

.settings-item-arrow {
    color: var(--chat-text-secondary);
}

/* Save Button Container */
.settings-save-container {
    margin-top: 20px;
    padding: 20px;
    background: var(--bg-surface);
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.btn-save-settings {
    min-width: 140px;
}

.settings-save-status {
    font-size: 13px;
    color: var(--accent-green);
}

.settings-save-status.error {
    color: var(--danger);
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .chat-sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        z-index: 100;
        transition: left 0.3s ease;
    }

    .chat-sidebar.open {
        left: 0;
    }

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

    .sidebar-overlay.show {
        display: block;
    }

    .menu-toggle {
        display: flex !important;
    }
}

@media (max-width: 600px) {
    .login-container {
        border-radius: 0;
        height: 100vh;
        max-width: 100%;
        width: 100%;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }

    .qr-code {
        width: 180px;
        height: 180px;
    }

    .message {
        max-width: 85%;
    }
}

.menu-toggle {
    display: none;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    border-radius: 8px;
}

.menu-toggle:hover {
    background: var(--bg-dark);
}

/* ================================
   TRANSACTIONS & REPORTS VIEWS
   ================================ */
.view-container {
    flex: 1;
    display: none;
    flex-direction: column;
    background: var(--bg-chat);
    overflow-y: auto;
    padding: 20px;
}

.view-container.active {
    display: flex;
}

/* Chat view needs no padding - has its own layout */
#chatViewContent {
    padding: 0;
}

.view-header {
    padding: 20px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
}

.view-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 4px;
}

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

/* ================================
   MODERN FILTER BAR (v2.40.22)
   ================================ */

.filter-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: linear-gradient(180deg, var(--bg-surface) 0%, rgba(32, 44, 51, 0.95) 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    flex-wrap: wrap;
    backdrop-filter: blur(10px);
}

.search-input {
    flex: 1;
    min-width: 140px;
    max-width: 220px;
    padding: 10px 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    background: rgba(17, 27, 33, 0.6);
    color: var(--chat-text-primary);
    font-size: 14px;
    transition: all 0.2s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--accent-green);
    background: rgba(17, 27, 33, 0.8);
    box-shadow: 0 0 0 3px rgba(0, 168, 132, 0.15);
}

.search-input::placeholder {
    color: var(--chat-text-secondary);
}

.filter-dropdown {
    padding: 10px 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    background: rgba(17, 27, 33, 0.6);
    color: var(--chat-text-primary);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='%238696a0'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

.filter-dropdown:hover {
    border-color: rgba(255, 255, 255, 0.2);
    background-color: rgba(17, 27, 33, 0.8);
}

.filter-dropdown:focus {
    outline: none;
    border-color: var(--accent-green);
    box-shadow: 0 0 0 3px rgba(0, 168, 132, 0.15);
}

.clear-btn {
    padding: 10px 18px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.clear-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.3);
}

.custom-dates {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    background: rgba(17, 27, 33, 0.4);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.custom-dates input[type="date"] {
    padding: 10px 14px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    background: rgba(17, 27, 33, 0.6);
    color: var(--chat-text-primary);
    font-size: 14px;
    transition: all 0.2s ease;
}

.custom-dates input[type="date"]:focus {
    outline: none;
    border-color: var(--accent-green);
}

.custom-dates span {
    color: var(--chat-text-secondary);
    font-size: 14px;
}

.filter-summary {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 14px 20px;
    background: rgba(17, 27, 33, 0.5);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 14px;
}

.filter-summary #filterCount {
    color: var(--chat-text-secondary);
    font-weight: 500;
}

.filter-summary .summary-income {
    color: #34d399;
    font-weight: 600;
    padding: 4px 12px;
    background: rgba(16, 185, 129, 0.1);
    border-radius: 20px;
}

.filter-summary .summary-expense {
    color: #f87171;
    font-weight: 600;
    padding: 4px 12px;
    background: rgba(239, 68, 68, 0.1);
    border-radius: 20px;
}

/* Date Range */
.date-range {
    font-size: 13px;
    color: var(--chat-text-secondary);
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
}

/* Show Summary Button */
.show-summary-btn {
    padding: 10px 20px;
    background: linear-gradient(135deg, var(--accent-green) 0%, #02906f 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    margin-left: auto;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 168, 132, 0.3);
}

.show-summary-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 168, 132, 0.4);
}

.show-summary-btn:active {
    transform: translateY(0);
}

/* Summary Panel */
.summary-panel {
    background: var(--bg-surface);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    margin: 20px;
    overflow: hidden;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
}

.summary-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 20px;
    background: linear-gradient(135deg, var(--accent-green) 0%, #02906f 100%);
    color: white;
}

.summary-panel-header span {
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.summary-panel .close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.summary-panel .close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.summary-panel-body {
    padding: 20px;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

@media (max-width: 500px) {
    .summary-grid {
        grid-template-columns: 1fr;
    }
}

.summary-panel .summary-card {
    padding: 20px;
    background: rgba(17, 27, 33, 0.5);
    border-radius: 14px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.2s ease;
}

.summary-panel .summary-card:hover {
    background: rgba(17, 27, 33, 0.7);
    border-color: rgba(255, 255, 255, 0.1);
}

.summary-panel .summary-card .card-label {
    font-size: 12px;
    color: var(--chat-text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.summary-panel .summary-card .card-value {
    font-size: 26px;
    font-weight: 700;
}

.summary-panel .summary-card.income .card-value { color: #34d399; }
.summary-panel .summary-card.expense .card-value { color: #f87171; }
.summary-panel .summary-card.profit .card-value { color: #60a5fa; }

.summary-categories {
    background: rgba(17, 27, 33, 0.5);
    border-radius: 14px;
    padding: 18px;
    margin-bottom: 16px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.summary-categories .categories-title {
    font-size: 12px;
    color: var(--chat-text-secondary);
    margin-bottom: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.summary-categories .categories-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.summary-categories .category-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
    font-size: 14px;
    transition: all 0.2s ease;
}

.summary-categories .category-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

.summary-categories .cat-name {
    color: var(--chat-text-primary);
    font-weight: 500;
}

.summary-categories .cat-amount {
    color: var(--chat-text-secondary);
    font-weight: 600;
}

.summary-footer {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: var(--chat-text-secondary);
    padding-top: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

/* Mobile */
@media (max-width: 600px) {
    .filter-bar {
        gap: 10px;
        padding: 14px 16px;
    }

    .search-input {
        max-width: none;
        width: 100%;
    }

    .show-summary-btn {
        margin-left: 0;
        width: 100%;
    }

    .summary-panel {
        margin: 12px;
    }
}

/* Transactions List */
.transactions-list {
    padding: 12px;
}

.transaction-item {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    background: var(--bg-surface);
    border-radius: 10px;
    margin-bottom: 8px;
    color: var(--chat-text-primary);  /* v2.40.7: Fix invisible text on dark bg */
}

.transaction-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    margin-right: 14px;
}

.transaction-icon.expense {
    background: rgba(239, 68, 68, 0.15);
}

.transaction-icon.income {
    background: rgba(16, 185, 129, 0.15);
}

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

.transaction-vendor {
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.transaction-category {
    font-size: 12px;
    color: var(--chat-text-secondary);  /* v2.40.7: Use chat color for dark bg */
}

.transaction-amount {
    font-size: 15px;
    font-weight: 600;
    text-align: right;
}

.transaction-amount.expense {
    color: #ef4444;
}

.transaction-amount.income {
    color: #10b981;
}

.transaction-date {
    font-size: 11px;
    color: var(--chat-text-secondary);  /* v2.40.7: Use chat color for dark bg */
    text-align: right;
}

/* v2.40.8: Currency conversion display */
.transaction-amounts {
    text-align: right;
    min-width: 100px;
}

.transaction-converted {
    font-size: 11px;
    color: var(--chat-text-secondary);
    margin-top: 2px;
}

/* Reports Summary */
.summary-cards {
    display: flex;
    gap: 12px;
    padding: 16px;
}

.summary-card {
    flex: 1;
    background: var(--bg-surface);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
}

.summary-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.summary-value {
    font-size: 24px;
    font-weight: 700;
}

.summary-value.income {
    color: #10b981;
}

.summary-value.expense {
    color: #ef4444;
}

/* Category List */
.category-section {
    padding: 0 16px 16px;
}

.category-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-secondary);
}

.category-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-surface);
    border-radius: 10px;
    margin-bottom: 8px;
}

.category-name {
    flex: 1;
    font-size: 14px;
}

.category-amount {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
}

.category-bar {
    width: 100%;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    margin-top: 8px;
    overflow: hidden;
}

.category-bar-fill {
    height: 100%;
    background: var(--accent-green);
    border-radius: 2px;
}

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

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state-text {
    font-size: 15px;
}

/* ================================
   PASSWORD SETUP MODAL
   ================================ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 2000;
    display: none;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

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

.modal-content {
    background: var(--white);
    border-radius: 20px;
    padding: 32px;
    max-width: 400px;
    width: 100%;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
}

.modal-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 20px;
    background: linear-gradient(135deg, var(--whatsapp-green), var(--whatsapp-dark));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-icon svg {
    width: 30px;
    height: 30px;
    color: white;
}

.modal-title {
    font-size: 22px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.modal-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 24px;
    line-height: 1.5;
}

.modal-form .form-group {
    margin-bottom: 16px;
}

.modal-form label {
    display: block;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 500;
}

.modal-form input {
    width: 100%;
    padding: 12px 16px;
    border-radius: 10px;
    border: 2px solid #e5e7eb;
    background: white;
    color: var(--text-primary);
    font-size: 14px;
    transition: border-color 0.2s;
}

.modal-form input:focus {
    outline: none;
    border-color: var(--whatsapp-green);
}

.modal-form .password-requirements {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 8px;
}

.modal-form .btn-submit {
    width: 100%;
    margin-top: 8px;
    padding: 14px;
    font-size: 15px;
}

.modal-form .error-message {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 16px;
    display: none;
}

.modal-form .error-message.visible {
    display: block;
}

/* ================================
   REPORTS VIEW (v2.40.26)
   ================================ */
.section-header {
    padding: 24px 20px 16px;
}

.section-header h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--chat-text-primary);
    margin: 0 0 4px;
}

.section-desc {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0;
}

.reports-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    padding: 0 20px 20px;
}

.report-tile {
    background: var(--bg-surface);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.report-tile:hover {
    background: rgba(37, 211, 102, 0.08);
    transform: translateY(-2px);
}

.report-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.report-icon svg {
    opacity: 0.9;
}

.report-content {
    flex: 1;
}

.report-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--chat-text-primary);
    margin-bottom: 4px;
}

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

.report-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.placeholder-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.placeholder-text {
    font-size: 16px;
    font-weight: 600;
    color: var(--chat-text-primary);
    margin-bottom: 8px;
}

.placeholder-desc {
    font-size: 13px;
    color: var(--text-secondary);
    max-width: 300px;
}

/* ================================
   RECEIVABLES VIEW (v2.40.26)
   ================================ */
.receivables-summary {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    padding: 0 20px 20px;
}

.receivables-card {
    background: var(--bg-surface);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.receivables-card .card-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.receivables-card.receivable .card-icon {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.receivables-card.payable .card-icon {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.receivables-card .card-content {
    flex: 1;
}

.receivables-card .card-label {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.receivables-card .card-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--chat-text-primary);
}

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

.receivables-tabs {
    display: flex;
    gap: 8px;
    padding: 0 20px 16px;
}

.receivables-tab {
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.receivables-tab:hover {
    background: rgba(255, 255, 255, 0.05);
}

.receivables-tab.active {
    background: var(--whatsapp-green);
    color: white;
}

.receivables-list {
    padding: 0 20px 20px;
}

.receivable-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: var(--bg-surface);
    border-radius: 10px;
    margin-bottom: 8px;
}

.receivable-info {
    flex: 1;
}

.receivable-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--chat-text-primary);
}

.receivable-desc {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.receivable-amount {
    font-size: 15px;
    font-weight: 600;
}

.receivable-amount.receivable {
    color: #10b981;
}

.receivable-amount.payable {
    color: #ef4444;
}

/* ================================
   CONTACTS VIEW (v2.40.26)
   ================================ */
.contacts-tabs {
    display: flex;
    gap: 8px;
    padding: 0 20px 16px;
}

.contacts-tab {
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.contacts-tab:hover {
    background: rgba(255, 255, 255, 0.05);
}

.contacts-tab.active {
    background: var(--whatsapp-green);
    color: white;
}

.contacts-actions {
    display: flex;
    gap: 12px;
    padding: 0 20px 16px;
}

.contacts-actions .search-input {
    flex: 1;
}

.contacts-list {
    padding: 0 20px 20px;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: var(--bg-surface);
    border-radius: 10px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.contact-item:hover {
    background: rgba(37, 211, 102, 0.08);
}

.contact-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--whatsapp-green), #128c7e);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 600;
    color: white;
    flex-shrink: 0;
}

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

.contact-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--chat-text-primary);
}

.contact-detail {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.contact-balance {
    font-size: 14px;
    font-weight: 600;
}

.contact-balance.receivable {
    color: #10b981;
}

.contact-balance.payable {
    color: #ef4444;
}

/* Mobile responsive for new views */
@media (max-width: 600px) {
    .receivables-summary {
        grid-template-columns: 1fr;
    }

    .reports-tiles {
        grid-template-columns: 1fr;
    }

    .receivables-card .card-value {
        font-size: 20px;
    }
}

/* ================================
   COMING SOON PLACEHOLDER (v2.41)
   ================================ */
.coming-soon-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 60px 24px;
    min-height: 400px;
}

.coming-soon-icon {
    font-size: 64px;
    margin-bottom: 24px;
    opacity: 0.9;
}

.coming-soon-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--chat-text-primary);
    margin: 0 0 16px 0;
}

.coming-soon-desc {
    font-size: 15px;
    color: var(--chat-text-secondary);
    max-width: 400px;
    line-height: 1.5;
    margin: 0 0 20px 0;
}

.coming-soon-tip {
    font-size: 14px;
    color: var(--chat-text-tertiary);
    background: var(--bg-surface);
    padding: 12px 20px;
    border-radius: 8px;
    max-width: 400px;
    line-height: 1.5;
    margin: 0;
}

.coming-soon-tip strong {
    color: var(--primary-color);
}

@media (max-width: 600px) {
    .coming-soon-container {
        padding: 40px 20px;
        min-height: 300px;
    }

    .coming-soon-icon {
        font-size: 48px;
    }

    .coming-soon-title {
        font-size: 20px;
    }

    .coming-soon-desc,
    .coming-soon-tip {
        font-size: 14px;
    }
}

/* Beta testing hints */
.empty-state-hint,
.form-hint {
    font-size: 12px;
    color: var(--primary-color);
    opacity: 0.8;
    margin-top: 8px;
}

/* =================================
   DOCUMENTS VIEW (v2.42.2)
   ================================= */

/* Storage Usage Bar */
.documents-usage {
    background: var(--bg-surface);
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 16px;
}

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

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

.usage-text {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}

.usage-bar {
    height: 6px;
    background: var(--border-color);
    border-radius: 3px;
    overflow: hidden;
}

.usage-fill {
    height: 100%;
    background: var(--primary-color);
    border-radius: 3px;
    transition: width 0.3s ease, background-color 0.3s ease;
}

/* Documents Tabs */
.documents-tabs {
    display: flex;
    gap: 8px;
    padding: 0 0 16px 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.documents-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--bg-surface);
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
    transition: all 0.2s ease;
}

.documents-tab:hover {
    background: var(--border-color);
}

.documents-tab.active {
    background: var(--primary-color);
    color: white;
}

.documents-tab .tab-icon {
    font-size: 16px;
}

.documents-tab .tab-count {
    font-size: 11px;
    background: rgba(0, 0, 0, 0.1);
    padding: 2px 6px;
    border-radius: 10px;
}

.documents-tab.active .tab-count {
    background: rgba(255, 255, 255, 0.2);
}

/* Documents Actions */
.documents-actions {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 16px;
}

#uploadDocBtn {
    display: flex;
    align-items: center;
    gap: 8px;
}

#uploadDocBtn svg {
    width: 18px;
    height: 18px;
}

/* Documents Grid */
.documents-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
    padding-bottom: 16px;
}

.document-card {
    background: var(--bg-surface);
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.document-thumb {
    aspect-ratio: 1;
    background: var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    overflow: hidden;
}

.document-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.document-icon {
    font-size: 48px;
    opacity: 0.5;
}

.document-info {
    padding: 12px;
}

.document-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.document-meta {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.document-actions {
    display: flex;
    padding: 0 8px 12px;
    gap: 4px;
}

.doc-action-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    background: var(--border-color);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.doc-action-btn:hover {
    background: var(--primary-color);
    color: white;
}

.doc-action-btn.delete:hover {
    background: #ef4444;
}

/* Documents Loading */
.documents-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

/* Breadcrumb Navigation */
.documents-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 0;
    font-size: 14px;
}

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

.breadcrumb-item.active {
    color: var(--text-primary);
    font-weight: 500;
}

.breadcrumb-item.clickable {
    cursor: pointer;
    color: var(--primary-color);
}

.breadcrumb-item.clickable:hover {
    text-decoration: underline;
}

.breadcrumb-separator {
    color: var(--text-secondary);
    font-size: 12px;
}

/* Monthly Folders Grid */
.documents-months {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    padding-bottom: 16px;
}

.month-folder {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--bg-surface);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.month-folder:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    background: var(--border-color);
}

.month-folder-icon {
    font-size: 36px;
    flex-shrink: 0;
}

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

.month-folder-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.month-folder-meta {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.month-folder-counts {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.count-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-secondary);
}

.count-badge.invoices {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

.count-badge.bills {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

.count-badge.receipts {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.count-badge.photos {
    background: rgba(139, 92, 246, 0.1);
    color: #8b5cf6;
}

/* Mobile Responsive */
@media (max-width: 600px) {
    .documents-months {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .month-folder {
        padding: 14px;
    }

    .month-folder-icon {
        font-size: 28px;
    }

    .month-folder-name {
        font-size: 14px;
    }

    .documents-tabs {
        padding: 0 0 12px 0;
    }

    .documents-tab {
        padding: 8px 12px;
        font-size: 12px;
    }

    .documents-tab .tab-label {
        display: none;
    }

    .documents-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 12px;
    }

    .document-icon {
        font-size: 36px;
    }

    .document-info {
        padding: 10px;
    }

    .document-name {
        font-size: 12px;
    }
}
