/* ==========================================
   IMMOCOMPTA - MODERN STYLE SYSTEM (VANILLA CSS)
   ========================================== */

/* Design Tokens & Theme Variables */
:root {
    --font-primary: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    
    /* Palette claire */
    --bg-app-wrapper: #e2e8f0;
    --bg-phone-body: #f8fafc;
    --bg-surface: #ffffff;
    --bg-surface-elevated: #f1f5f9;
    --border-color: #cbd5e1;
    --border-color-light: #94a3b8;
    
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    
    --color-accent: #2563eb;
    --color-accent-hover: #1d4ed8;
    --color-success: #059669;
    --color-danger: #e11d48;
    --color-warning: #d97706;
    --color-purple: #7c3aed;
    --color-gold: #b45309;

    --gradient-primary: linear-gradient(135deg, #1e40af 0%, #2563eb 100%);
    --gradient-emerald: linear-gradient(135deg, #065f46 0%, #059669 100%);
    --gradient-rose: linear-gradient(135deg, #9f1239 0%, #e11d48 100%);
    --gradient-dark: linear-gradient(180deg, #f1f5f9 0%, #e2e8f0 100%);
    --gradient-gold: linear-gradient(135deg, #92400e 0%, #d97706 50%, #f59e0b 100%);
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(0, 0, 0, 0.08);
}

/* Global Reset & Base Setup */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: var(--font-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background-color: var(--bg-app-wrapper);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* App Wrapper & Desktop Mockup Frame */
.app-wrapper {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

/* iPhone/Android Native-like Mockup on Desktop */
.phone-frame {
    width: 412px;
    height: 840px;
    background: #000000;
    border-radius: 48px;
    padding: 12px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7), 
                0 0 0 4px #2c3545;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Phone Screen Area */
.phone-screen {
    width: 100%;
    height: 100%;
    background-color: var(--bg-phone-body);
    border-radius: 38px;
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
}

/* Phone Notch and Status Styling */
.phone-notch {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 140px;
    height: 25px;
    background: #000000;
    border-bottom-left-radius: 18px;
    border-bottom-right-radius: 18px;
    z-index: 1000;
}

/* APP HEADER STYLING */
.app-header {
    background: var(--bg-surface);
    padding: 35px 20px 15px 20px; /* 35px top to clear the notch area */
    border-bottom: 1px solid var(--border-color);
    z-index: 90;
}

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

.society-selector-container {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-grow: 1;
}

.society-select {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 1.15rem;
    font-weight: 700;
    outline: none;
    cursor: pointer;
    max-width: 220px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

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

.header-actions {
    display: flex;
    gap: 10px;
}

.header-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.badge-regime {
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--border-color);
    padding: 3px 10px;
    border-radius: 20px;
    color: var(--text-secondary);
}

.premium-tag {
    font-size: 0.72rem;
    font-weight: 700;
    background: var(--gradient-gold);
    color: #ffffff;
    padding: 3px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    animation: pulseGold 2s infinite;
}

/* BUTTONS & ICONS */
.btn-icon {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
}

.btn-icon:hover {
    background: var(--border-color);
    transform: scale(1.05);
}

.btn-icon-small {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    transition: color 0.2s ease;
}

.btn-icon-small:hover {
    color: var(--text-primary);
}

.notification-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: var(--color-danger);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--bg-surface);
}

/* APP BOTTOM NAVIGATION */
.app-nav {
    display: flex;
    justify-content: space-around;
    align-items: center;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--glass-border);
    height: 75px;
    padding-bottom: 12px; /* Leaves space for phone home indicators */
    z-index: 100;
}

.nav-item {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    cursor: pointer;
    font-size: 0.68rem;
    font-weight: 500;
    transition: all 0.2s ease;
    flex: 1;
}

.nav-item svg {
    transition: transform 0.2s ease;
}

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

.nav-item.active svg {
    transform: translateY(-2px);
    stroke: var(--color-accent);
}

/* FLOATING SCAN BUTTON (FAB) */
.fab-scan {
    position: absolute;
    bottom: 85px;
    right: 20px;
    background: var(--gradient-primary);
    border: none;
    color: #ffffff;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 25px -5px rgba(59, 130, 246, 0.5);
    cursor: pointer;
    z-index: 95;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.fab-scan:hover {
    transform: rotate(90deg) scale(1.1);
    box-shadow: 0 15px 30px -5px rgba(59, 130, 246, 0.6);
}

/* SCROLLABLE MAIN CONTENT */
.app-content {
    flex-grow: 1;
    overflow-y: auto;
    padding: 20px;
    padding-bottom: 90px; /* Leaves room for FAB and Bottom Nav */
    scrollbar-width: none; /* Hide default scrollbar Firefox */
}

.app-content::-webkit-scrollbar {
    display: none; /* Hide default scrollbar Safari/Chrome */
}

/* ==========================================
   COMPONENTS & UTILITIES
   ========================================== */

/* Section Title */
.screen-title {
    font-size: 1.4rem;
    font-weight: 800;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Screen Subtitle */
.screen-subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: -15px;
    margin-bottom: 20px;
}

/* Cards Design */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 16px;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

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

/* Metrics Grid */
.metrics-row {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.metric-card {
    flex: 1;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 14px;
}

.metric-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.metric-val {
    font-size: 1.25rem;
    font-weight: 700;
}

.color-income { color: var(--color-success); }
.color-expense { color: var(--color-danger); }
.color-bank { color: var(--color-accent); }

/* Quick Actions Grid */
.quick-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.quick-btn {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    color: var(--text-primary);
}

.quick-btn:hover {
    border-color: var(--color-accent);
    transform: translateY(-2px);
}

.quick-btn-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.quick-btn-icon.bg-indigo { background: rgba(59, 130, 246, 0.15); color: var(--color-accent); }
.quick-btn-icon.bg-purple { background: rgba(168, 85, 247, 0.15); color: var(--color-purple); }
.quick-btn-icon.bg-emerald { background: rgba(16, 185, 129, 0.15); color: var(--color-success); }
.quick-btn-icon.bg-amber { background: rgba(245, 158, 11, 0.15); color: var(--color-warning); }

.quick-btn span {
    font-size: 0.8rem;
    font-weight: 600;
}

/* ==========================================
   TRANSACTIONS MODULE
   ========================================== */

.tabs-header-sub {
    display: flex;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 4px;
    margin-bottom: 16px;
}

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

.tab-btn-sub.active {
    background: var(--bg-surface-elevated);
    color: var(--text-primary);
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.2);
}

.search-box {
    position: relative;
    margin-bottom: 16px;
}

.search-box input {
    width: 100%;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 10px 12px 10px 38px;
    color: var(--text-primary);
    font-size: 0.85rem;
    outline: none;
}

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

.search-box svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 8px;
    text-transform: uppercase;
}

/* Transaction List Item */
.tx-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.tx-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 12px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.tx-item:hover {
    border-color: var(--border-color-light);
    transform: translateX(2px);
}

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

.tx-icon-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.tx-icon-circle.bg-success { background: rgba(16, 185, 129, 0.12); color: var(--color-success); }
.tx-icon-circle.bg-danger { background: rgba(244, 63, 94, 0.12); color: var(--color-danger); }
.tx-icon-circle.bg-pending { background: rgba(245, 158, 11, 0.12); color: var(--color-warning); }

.tx-details {
    display: flex;
    flex-direction: column;
    max-width: 180px;
}

.tx-title {
    font-size: 0.85rem;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tx-meta {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.tx-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.tx-amount {
    font-size: 0.9rem;
    font-weight: 700;
}

.tx-status-badge {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    margin-top: 4px;
    text-transform: uppercase;
}

.badge-linked {
    background: rgba(16, 185, 129, 0.15);
    color: var(--color-success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-missing {
    background: rgba(244, 63, 94, 0.15);
    color: var(--color-danger);
    border: 1px solid rgba(244, 63, 94, 0.2);
}

.badge-waiting {
    background: rgba(245, 158, 11, 0.15);
    color: var(--color-warning);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

/* ==========================================
   AGENDA MODULE
   ========================================== */

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

.agenda-timeline {
    position: relative;
    padding-left: 20px;
    border-left: 2px solid var(--border-color);
}

.agenda-item {
    position: relative;
    margin-bottom: 20px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px;
    transition: all 0.2s ease;
}

.agenda-item.overdue {
    border-color: rgba(244, 63, 94, 0.4);
    background: linear-gradient(90deg, rgba(244, 63, 94, 0.05) 0%, var(--bg-surface) 100%);
}

.agenda-dot {
    position: absolute;
    left: -27px;
    top: 18px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid var(--bg-phone-body);
    background: var(--text-muted);
}

.agenda-dot.bg-tax { background: var(--color-warning); }
.agenda-dot.bg-bank { background: var(--color-accent); }
.agenda-dot.bg-notary { background: var(--color-purple); }
.agenda-dot.bg-invoice { background: var(--color-danger); }
.agenda-dot.bg-other { background: var(--text-muted); }

.agenda-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 4px;
}

.agenda-item-title {
    font-size: 0.85rem;
    font-weight: 700;
}

.agenda-date-badge {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-surface-elevated);
    padding: 2px 6px;
    border-radius: 4px;
}

.agenda-desc {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.agenda-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.agenda-status-btn {
    background: transparent;
    border: none;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--color-accent);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
}

.agenda-status-btn.done {
    color: var(--color-success);
}

.agenda-category-tag {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
}

/* ==========================================
   TAX ASSISTANT (LIASSE FISCALE)
   ========================================== */

.tax-guide-intro {
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.15);
    border-radius: 12px;
    padding: 12px;
    font-size: 0.8rem;
    line-height: 1.4;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.tax-guide-intro strong {
    color: var(--text-primary);
}

/* Visual Tax Form Styling */
.tax-form-facsimile {
    background: #fdfdfd; /* Clear light background to mimic official paper */
    border: 2px solid #b8c6d9;
    border-radius: 8px;
    padding: 12px;
    color: #1e293b;
    margin-bottom: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.tax-form-header {
    border-bottom: 2px solid #1e293b;
    padding-bottom: 8px;
    margin-bottom: 12px;
    text-align: center;
}

.tax-form-title {
    font-size: 0.8rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tax-form-subtitle {
    font-size: 0.65rem;
    color: #475569;
    font-weight: 500;
}

.tax-form-rows {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tax-form-row {
    display: flex;
    align-items: center;
    border-bottom: 1px dashed #cbd5e1;
    padding-bottom: 6px;
    transition: background-color 0.2s ease;
}

.tax-form-row.highlight {
    background-color: #fef08a; /* Soft highlighter yellow */
    animation: pulseHighlight 2.5s infinite;
}

.tax-form-label-col {
    flex-grow: 1;
    font-size: 0.72rem;
    font-weight: 500;
    line-height: 1.2;
}

.tax-form-case-box {
    display: flex;
    align-items: center;
    gap: 4px;
}

.tax-case-number {
    font-size: 0.65rem;
    font-weight: 800;
    background: #e2e8f0;
    color: #334155;
    padding: 2px 4px;
    border-radius: 2px;
    min-width: 24px;
    text-align: center;
    border: 1px solid #94a3b8;
}

.tax-case-value {
    width: 60px;
    background: #ffffff;
    border: 1px solid #1e293b;
    font-size: 0.75rem;
    font-weight: 800;
    text-align: right;
    padding: 2px 4px;
    color: #0f172a;
}

.tax-form-footer {
    margin-top: 12px;
    border-top: 2px solid #1e293b;
    padding-top: 8px;
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    font-weight: 800;
}

/* ==========================================
   CHAT PREMIUM & SUBSCRIPTION
   ========================================== */

.chat-container {
    display: flex;
    flex-direction: column;
    height: 480px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    position: relative;
    overflow: hidden;
}

/* Premium Wall Overlay */
.premium-wall-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 10;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 30px;
    text-align: center;
}

.premium-card {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color-light);
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
    width: 100%;
}

.premium-crown {
    font-size: 2.2rem;
    margin-bottom: 12px;
    animation: bounce 2s infinite;
}

.premium-title {
    font-size: 1.15rem;
    font-weight: 800;
    margin-bottom: 8px;
    background: var(--gradient-gold);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.premium-subtitle {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.premium-features-list {
    text-align: left;
    font-size: 0.78rem;
    color: var(--text-primary);
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.premium-features-list li {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.premium-features-list li::before {
    content: "✓";
    color: var(--color-success);
    font-weight: bold;
}

.btn-subscribe {
    width: 100%;
    background: var(--gradient-gold);
    color: #ffffff;
    border: none;
    padding: 12px;
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(217, 119, 6, 0.4);
    transition: all 0.2s ease;
}

.btn-subscribe:hover {
    transform: scale(1.02);
    box-shadow: 0 6px 20px rgba(217, 119, 6, 0.5);
}

.premium-footnote {
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-top: 10px;
}

/* Chat Messages View */
.chat-messages {
    flex-grow: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-bubble {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 0.82rem;
    line-height: 1.4;
}

.chat-bubble.expert {
    align-self: flex-start;
    background: var(--bg-surface-elevated);
    border-bottom-left-radius: 4px;
    border: 1px solid var(--border-color);
}

.chat-bubble.user {
    align-self: flex-end;
    background: var(--color-accent);
    color: white;
    border-bottom-right-radius: 4px;
}

.expert-avatar-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.72rem;
    color: var(--text-secondary);
    margin-bottom: 2px;
}

.expert-avatar {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--color-purple);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    font-weight: bold;
}

.chat-bubble-time {
    font-size: 0.6rem;
    color: var(--text-muted);
    margin-top: 4px;
    text-align: right;
}

.chat-input-bar {
    display: flex;
    gap: 8px;
    padding: 12px;
    background: var(--bg-surface-elevated);
    border-top: 1px solid var(--border-color);
}

.chat-input-bar input {
    flex-grow: 1;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 8px 16px;
    color: var(--text-primary);
    font-size: 0.82rem;
    outline: none;
}

.chat-input-bar input:focus {
    border-color: var(--color-accent);
}

.btn-chat-send {
    background: var(--color-accent);
    border: none;
    color: white;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 8px 12px;
    align-items: center;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: typingBounce 1s infinite alternate;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

/* ==========================================
   ACCOUNTANT PORTAL (PORTAIL COMPTABLE)
   ========================================== */

.accountant-verification-card {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.08) 0%, rgba(30, 41, 59, 0.5) 100%);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.verification-progress-bar {
    background: var(--border-color);
    height: 6px;
    border-radius: 3px;
    overflow: hidden;
    margin: 10px 0;
}

.verification-progress-fill {
    background: var(--color-success);
    height: 100%;
    width: 0%;
    transition: width 0.5s ease;
}

.accountant-row-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.btn-share {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-share:hover {
    border-color: var(--text-secondary);
}

.export-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 15px;
}

.export-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 10px 14px;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.export-item:hover {
    border-color: var(--color-accent);
}

.export-item-left {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.8rem;
    font-weight: 600;
}

.export-item-desc {
    font-size: 0.65rem;
    color: var(--text-muted);
}

.export-item-right {
    color: var(--color-accent);
}

/* Toggle Switch View for Accountant mode */
.mode-toggle-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.switch-label {
    font-size: 0.82rem;
    font-weight: 600;
}

.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

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

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

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

input:checked + .slider {
    background-color: var(--color-success);
}

input:checked + .slider:before {
    transform: translateX(20px);
}

/* ==========================================
   MODALS AND INTERACTIVES
   ========================================== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(9, 13, 22, 0.7);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    width: 90%;
    max-width: 375px;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.active .modal-card {
    transform: scale(1);
}

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

.modal-header h2 {
    font-size: 1.05rem;
    font-weight: 800;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.1rem;
    cursor: pointer;
}

.modal-body {
    padding: 20px;
    max-height: 480px;
    overflow-y: auto;
}

/* Forms */
.form-group {
    margin-bottom: 14px;
}

.form-row {
    display: flex;
    gap: 12px;
}

.col-6 {
    flex: 1;
}

label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

input[type="text"],
input[type="number"],
input[type="date"],
select,
textarea {
    width: 100%;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 10px 12px;
    color: var(--text-primary);
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.2s ease;
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
select:focus,
textarea:focus {
    border-color: var(--color-accent);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.btn-primary {
    background: var(--color-accent);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 10px 18px;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.btn-primary:hover {
    background-color: var(--color-accent-hover);
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    border-radius: 10px;
    padding: 10px 18px;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
}

.btn-secondary:hover {
    color: var(--text-primary);
    border-color: var(--border-color-light);
}

/* DRAG & DROP SOCKS */
.drag-drop-area {
    border: 2px dashed var(--border-color);
    border-radius: 16px;
    padding: 30px 20px;
    text-align: center;
    cursor: pointer;
    background: rgba(30, 41, 59, 0.3);
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.drag-drop-area:hover,
.drag-drop-area.dragover {
    border-color: var(--color-accent);
    background: rgba(59, 130, 246, 0.05);
}

.drag-icon {
    color: var(--text-muted);
}

.drag-title {
    font-size: 0.85rem;
    font-weight: 700;
}

.drag-subtitle {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.btn-upload-fake {
    background: var(--color-accent);
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 6px 14px;
    border-radius: 6px;
    margin-top: 6px;
}

.btn-upload-fake.bg-bank {
    background: var(--color-accent);
}

/* DOCUMENT CHOICE DIALOG */
.doc-choice-body {
    padding-top: 10px;
}

.doc-choice-subtitle {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.doc-choice-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.doc-choice-btn {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 14px;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s ease;
    width: 100%;
    color: var(--text-primary);
}

.doc-choice-btn:hover {
    border-color: var(--border-color-light);
    transform: translateY(-2px);
}

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

.doc-choice-icon.color-expense { background: rgba(244, 63, 94, 0.15); color: var(--color-danger); }
.doc-choice-icon.color-bank { background: rgba(59, 130, 246, 0.15); color: var(--color-accent); }

.doc-choice-text {
    display: flex;
    flex-direction: column;
}

.doc-choice-text strong {
    font-size: 0.85rem;
    font-weight: 700;
}

.doc-choice-text span {
    font-size: 0.72rem;
    color: var(--text-secondary);
}

/* SCANNING ANIMATIONS */
.ocr-scanning-container {
    padding: 40px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    position: relative;
    overflow: hidden;
}

.scanner-bar {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--color-accent);
    box-shadow: 0 0 10px 2px var(--color-accent);
    animation: scanAnimation 2s infinite ease-in-out;
}

.document-preview-skeleton {
    width: 140px;
    height: 180px;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.skeleton-header {
    height: 12px;
    background: var(--border-color);
    border-radius: 4px;
    width: 60%;
}

.skeleton-line {
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    width: 100%;
    animation: pulseSkeleton 1.5s infinite ease-in-out;
}

.skeleton-line.delay-1 { animation-delay: 0.2s; }
.skeleton-line.delay-2 { animation-delay: 0.4s; }

.ocr-status-text {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-align: center;
    animation: pulseText 1.5s infinite ease-in-out;
}

.result-title {
    font-size: 0.95rem;
    font-weight: 800;
    margin-bottom: 12px;
}

.doc-mini-preview-card {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 12px;
    margin-top: 10px;
}

.doc-mini-preview-card .file-icon {
    font-size: 1.2rem;
}

.doc-mini-preview-card .file-details {
    display: flex;
    flex-direction: column;
}

.doc-mini-preview-card .file-name {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-primary);
}

.doc-mini-preview-card .file-size {
    font-size: 0.65rem;
    color: var(--text-muted);
}

/* BANK SYNCS SPECS */
.ocr-scanning-container.bank-scanning {
    height: 220px;
    justify-content: center;
}

.pulse-ring {
    position: absolute;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: rgba(59, 130, 246, 0.15);
    animation: pulseRing 1.8s infinite cubic-bezier(0.215, 0.610, 0.355, 1);
}

.scanner-chart-skeleton {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    height: 100px;
    z-index: 5;
}

.chart-bar {
    width: 16px;
    background: var(--color-accent);
    border-radius: 4px;
    animation: pulseSkeleton 1.2s infinite ease-in-out alternate;
}

.chart-bar.h-40 { height: 40px; animation-delay: 0.1s; }
.chart-bar.h-60 { height: 60px; animation-delay: 0.3s; }
.chart-bar.h-80 { height: 80px; animation-delay: 0.2s; }
.chart-bar.h-100 { height: 100px; animation-delay: 0.4s; }

.bank-result-summary {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.bank-transactions-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 280px;
    overflow-y: auto;
}

.bank-extracted-row {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 10px;
}

.bank-row-top {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.bank-row-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.bank-row-date {
    font-size: 0.68rem;
    color: var(--text-muted);
}

.bank-row-match {
    font-size: 0.7rem;
    font-weight: 600;
}

.match-suggested {
    color: var(--color-success);
    cursor: pointer;
    text-decoration: underline;
}

.match-none {
    color: var(--color-warning);
}

/* ==========================================
   NOTIFICATION DRAWER
   ========================================== */

.notification-drawer {
    position: absolute;
    top: 0;
    right: -100%;
    width: 100%;
    height: 100%;
    background: var(--bg-phone-body);
    z-index: 500;
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.notification-drawer.active {
    right: 0;
}

.drawer-header {
    padding: 35px 20px 15px 20px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.drawer-header h3 {
    font-size: 1.05rem;
    font-weight: 800;
}

.btn-close-drawer {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.1rem;
    cursor: pointer;
}

.drawer-content {
    flex-grow: 1;
    overflow-y: auto;
    padding: 20px;
}

.notif-item {
    display: flex;
    gap: 12px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 12px;
    position: relative;
    cursor: pointer;
}

.notif-item.unread::before {
    content: "";
    position: absolute;
    top: 14px;
    right: 14px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-accent);
}

.notif-icon {
    font-size: 1.3rem;
}

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

.notif-title {
    font-size: 0.8rem;
    font-weight: 700;
}

.notif-desc {
    font-size: 0.72rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.notif-time {
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ==========================================
   TOAST NOTIFICATION
   ========================================== */

.toast-notification {
    position: absolute;
    top: -80px;
    left: 20px;
    right: 20px;
    background: rgba(30, 41, 59, 0.95);
    border: 1px solid var(--border-color-light);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 14px;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 1000;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
    transition: top 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast-notification.active {
    top: 45px;
}

.toast-icon {
    font-size: 1.3rem;
}

.toast-body {
    display: flex;
    flex-direction: column;
}

.toast-title {
    font-size: 0.8rem;
    font-weight: 700;
}

.toast-desc {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

/* ==========================================
   ANIMATIONS KEYFRAMES
   ========================================== */

@keyframes pulseGold {
    0% { box-shadow: 0 0 0 0 rgba(251, 191, 36, 0.4); }
    70% { box-shadow: 0 0 0 6px rgba(251, 191, 36, 0); }
    100% { box-shadow: 0 0 0 0 rgba(251, 191, 36, 0); }
}

@keyframes scanAnimation {
    0% { top: 0; }
    50% { top: 100%; }
    100% { top: 0; }
}

@keyframes pulseSkeleton {
    0% { opacity: 0.4; }
    50% { opacity: 0.8; }
    100% { opacity: 0.4; }
}

@keyframes pulseText {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

@keyframes pulseHighlight {
    0% { background-color: rgba(254, 240, 138, 0.5); }
    50% { background-color: rgba(254, 240, 138, 0.95); }
    100% { background-color: rgba(254, 240, 138, 0.5); }
}

@keyframes pulseRing {
    0% { transform: scale(0.35); opacity: 0.8; }
    80%, 100% { transform: scale(1.2); opacity: 0; }
}

@keyframes typingBounce {
    0% { transform: translateY(0); }
    100% { transform: translateY(-6px); }
}

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

/* ==========================================
   RESPONSIVE DESIGN (Full Screen on Mobile)
   ========================================== */

@media (max-width: 500px) {
    body {
        background-color: var(--bg-phone-body);
    }
    
    .app-wrapper {
        padding: 0;
    }
    
    .phone-frame {
        width: 100vw;
        height: 100vh;
        border-radius: 0;
        padding: 0;
        box-shadow: none;
    }
    
    .phone-screen {
        border-radius: 0;
    }
    
    .phone-notch {
        display: none;
    }
    
    .app-header {
        padding-top: 15px; /* Less top padding since notch is hidden on real mobiles */
    }
    
    .toast-notification.active {
        top: 20px;
    }
}

/* ==========================================
   MODE WEB : l'app remplit la fenêtre (desktop/tablette)
   Au-delà de 500px, on abandonne le cadre téléphone : l'application
   occupe toute la page et s'adapte à la taille de l'écran. Le contenu
   mobile-first est centré et plafonné en largeur pour rester lisible.
   ========================================== */
@media (min-width: 501px) {
    body {
        background-color: var(--bg-phone-body);
    }

    .app-wrapper {
        padding: 0;
        align-items: stretch;
        justify-content: center;
    }

    .phone-frame {
        width: 100%;
        max-width: 900px;      /* colonne confortable sur très grand écran */
        height: 100vh;
        border-radius: 0;
        padding: 0;
        box-shadow: 0 0 40px rgba(0, 0, 0, 0.12);
        background: var(--bg-phone-body);
    }

    .phone-screen {
        border-radius: 0;
    }

    .phone-notch {
        display: none;
    }

    .app-header {
        padding-top: 15px;     /* plus de notch à dégager */
    }
}

/* ==========================================
   PHASE 8: LOGIN, FACEID SCANNER & ANIMATIONS
   ========================================== */

.login-screen-container {
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.98); }
    to { opacity: 1; transform: scale(1); }
}

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

@keyframes rotate-scanner-rev {
    from { transform: rotate(360deg); }
    to { transform: rotate(0deg); }
}

@keyframes laser-sweep {
    0% { top: 0%; }
    50% { top: 100%; }
    100% { top: 0%; }
}

@keyframes pulse-scanner {
    0% { transform: scale(1); stroke-width: 1px; stroke: rgba(59, 130, 246, 0.4); }
    50% { transform: scale(1.05); stroke-width: 1.5px; stroke: rgba(59, 130, 246, 0.8); }
    100% { transform: scale(1); stroke-width: 1px; stroke: rgba(59, 130, 246, 0.4); }
}

.face-scan-overlay {
    animation: slideInUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideInUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.login-screen-container input:focus {
    border-color: var(--color-accent) !important;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

/* ==========================================
   GLOBAL SEARCH OVERLAY
   ========================================== */

.search-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-phone-body);
    z-index: 3000;
    display: flex;
    flex-direction: column;
    animation: searchSlideIn 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

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

.search-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

/* --- Input Row --- */
.search-input-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 14px 10px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    background: var(--bg-surface);
}

.search-input-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.search-input-icon {
    position: absolute;
    left: 10px;
    color: var(--text-muted);
    pointer-events: none;
    flex-shrink: 0;
}

.search-input {
    width: 100%;
    background: var(--bg-phone-body);
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    padding: 9px 36px 9px 34px;
    font-size: 0.88rem;
    font-family: var(--font-primary);
    font-weight: 500;
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-input:focus {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.search-input::placeholder {
    color: var(--text-muted);
    font-size: 0.82rem;
}

.search-clear-btn {
    position: absolute;
    right: 8px;
    background: var(--bg-surface-elevated);
    border: none;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
}

.search-clear-btn:hover {
    background: var(--color-danger);
    color: #fff;
}

.search-cancel-btn {
    background: transparent;
    border: none;
    color: var(--color-accent);
    font-family: var(--font-primary);
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    padding: 4px 2px;
    white-space: nowrap;
    flex-shrink: 0;
    transition: opacity 0.15s;
}

.search-cancel-btn:hover { opacity: 0.7; }

/* --- Filter Chips --- */
.search-filters {
    display: flex;
    gap: 6px;
    padding: 10px 14px;
    overflow-x: auto;
    flex-shrink: 0;
    scrollbar-width: none;
    -ms-overflow-style: none;
    border-bottom: 1px solid var(--border-color);
}

.search-filters::-webkit-scrollbar { display: none; }

.search-chip {
    background: var(--bg-surface);
    border: 1.5px solid var(--border-color);
    border-radius: 20px;
    padding: 5px 12px;
    font-size: 0.72rem;
    font-family: var(--font-primary);
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.18s ease;
    flex-shrink: 0;
}

.search-chip:hover {
    border-color: var(--color-accent);
    color: var(--color-accent);
}

.search-chip.active {
    background: rgba(59, 130, 246, 0.15);
    border-color: var(--color-accent);
    color: var(--color-accent);
}

/* --- Results Container --- */
.search-results {
    flex: 1;
    overflow-y: auto;
    padding: 0 0 80px;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

.search-results::-webkit-scrollbar { width: 4px; }
.search-results::-webkit-scrollbar-track { background: transparent; }
.search-results::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 2px; }

/* --- Result Groups --- */
.search-group {
    margin-top: 6px;
    animation: fadeInResult 0.2s ease;
}

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

.search-group-label {
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    padding: 10px 14px 4px;
}

/* --- Individual Result Items --- */
.search-result-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 11px 14px;
    border-bottom: 1px solid rgba(51, 65, 85, 0.5);
    cursor: pointer;
    transition: background 0.15s;
    position: relative;
}

.search-result-item:hover,
.search-result-item:active {
    background: rgba(59, 130, 246, 0.06);
}

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

.search-result-icon {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
    margin-top: 1px;
}

.search-result-icon.type-tx-in   { background: rgba(16, 185, 129, 0.15); }
.search-result-icon.type-tx-out  { background: rgba(244, 63, 94, 0.15); }
.search-result-icon.type-doc     { background: rgba(168, 85, 247, 0.15); }
.search-result-icon.type-agenda  { background: rgba(245, 158, 11, 0.15); }
.search-result-icon.type-societe { background: rgba(59, 130, 246, 0.15); }
.search-result-icon.type-chat    { background: rgba(6, 182, 212, 0.15); }

.search-result-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.search-result-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-subtitle {
    font-size: 0.72rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-meta {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 1px;
}

.search-result-badge {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    flex-shrink: 0;
    align-self: center;
}

.search-result-badge.income  { background: rgba(16, 185, 129, 0.15); color: var(--color-success); }
.search-result-badge.expense { background: rgba(244, 63, 94, 0.15); color: var(--color-danger); }
.search-result-badge.ok      { background: rgba(16, 185, 129, 0.15); color: var(--color-success); }
.search-result-badge.pending { background: rgba(245, 158, 11, 0.15); color: var(--color-warning); }

/* Highlighted match text */
.search-highlight {
    background: rgba(59, 130, 246, 0.25);
    color: #93c5fd;
    border-radius: 2px;
    padding: 0 1px;
    font-weight: 700;
}

/* --- Empty / No-results States --- */
.search-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 50px 20px 20px;
    gap: 8px;
    text-align: center;
}

.search-empty-icon {
    font-size: 2.4rem;
    margin-bottom: 4px;
    opacity: 0.6;
}

.search-empty-state p {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-primary);
}

.search-empty-state span {
    font-size: 0.76rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.search-no-results {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 20px;
    gap: 8px;
    text-align: center;
}

.search-no-results .no-results-icon {
    font-size: 2rem;
    opacity: 0.5;
}

.search-no-results p {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.search-no-results span {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* --- Stats bar at top of results --- */
.search-stats-bar {
    padding: 8px 14px 4px;
    font-size: 0.68rem;
    color: var(--text-muted);
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
}


/* ==========================================
   PRINT MEDIA STYLE (PDF EXPORTS)
   ========================================== */

/* Hide print container on screen */
@media screen {
    #printReportContainer {
        display: none !important;
    }
}

@media print {
    /* === RESET ALL APP CHROME === */
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        color-adjust: exact !important;
    }

    html, body {
        background: #ffffff !important;
        color: #1e293b !important;
        font-family: 'Outfit', 'Inter', system-ui, -apple-system, sans-serif !important;
        font-size: 10pt !important;
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        height: auto !important;
        overflow: visible !important;
    }

    /* Hide EVERYTHING except the print container */
    body > *:not(#printReportContainer) {
        display: none !important;
    }

    /* Also hide any modals appended to body */
    .modal-overlay,
    .toast-notification,
    #faceScanOverlay,
    #loginScreen,
    .notification-drawer {
        display: none !important;
    }

    /* === PRINT CONTAINER === */
    #printReportContainer {
        display: block !important;
        position: static !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 12mm 15mm !important;
        box-sizing: border-box !important;
        background: #ffffff !important;
        font-size: 10pt !important;
        line-height: 1.5 !important;
        color: #1e293b !important;
    }

    /* === HEADER === */
    .print-header {
        border-bottom: 3px solid #1e40af;
        padding-bottom: 12px;
        margin-bottom: 18px;
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        flex-wrap: wrap;
        gap: 8px;
    }

    .print-header h1 {
        font-size: 20pt;
        color: #0f172a;
        margin: 0 0 4px 0;
        font-weight: 800;
        letter-spacing: -0.5px;
        line-height: 1.1;
    }

    .print-header .meta-row {
        display: flex;
        flex-wrap: wrap;
        gap: 8px 20px;
        font-size: 8.5pt;
        color: #475569;
        margin-top: 6px;
    }

    .print-header .meta-row span {
        white-space: nowrap;
    }

    .print-logo {
        text-align: right;
        font-size: 8.5pt;
        color: #94a3b8;
    }

    /* === SECTIONS === */
    .print-section {
        margin-bottom: 18px;
        page-break-inside: avoid;
        break-inside: avoid;
    }

    .print-section h2 {
        font-size: 11.5pt;
        color: #1e293b;
        border-bottom: 1.5px solid #cbd5e1;
        padding-bottom: 5px;
        margin: 0 0 10px 0;
        font-weight: 700;
        letter-spacing: -0.2px;
    }

    .print-section p {
        margin: 0 0 8px 0;
        font-size: 8.5pt;
        color: #475569;
        line-height: 1.5;
    }

    /* === KPI GRID === */
    .print-grid {
        display: table;
        width: 100%;
        border-collapse: separate;
        border-spacing: 8px;
        margin-bottom: 12px;
        margin-left: -8px;
    }

    .print-grid-row {
        display: table-row;
    }

    .print-card {
        display: table-cell;
        border: 1.5px solid #cbd5e1;
        border-radius: 6px;
        padding: 9px 12px;
        background: #f8fafc !important;
        vertical-align: top;
        width: 33%;
    }

    .print-card-title {
        font-size: 7.5pt;
        color: #64748b;
        text-transform: uppercase;
        font-weight: 700;
        margin-bottom: 3px;
        letter-spacing: 0.3px;
    }

    .print-card-value {
        font-size: 14pt;
        font-weight: 800;
        line-height: 1.1;
    }

    /* === TABLES === */
    .print-table {
        width: 100%;
        border-collapse: collapse;
        margin-top: 8px;
        margin-bottom: 14px;
        font-size: 8pt;
        page-break-inside: auto;
    }

    .print-table thead {
        display: table-header-group;
    }

    .print-table tr {
        page-break-inside: avoid;
        break-inside: avoid;
    }

    .print-table th {
        background: #1e40af !important;
        color: #ffffff !important;
        font-weight: 700;
        padding: 6px 8px;
        text-align: left;
        font-size: 7.5pt;
        letter-spacing: 0.2px;
        border: 1px solid #1e40af;
    }

    .print-table td {
        border: 1px solid #e2e8f0;
        padding: 5px 8px;
        text-align: left;
        vertical-align: top;
        font-size: 7.8pt;
        color: #1e293b;
    }

    .print-table tr:nth-child(even) td {
        background: #f8fafc !important;
    }

    .print-table tr:nth-child(odd) td {
        background: #ffffff !important;
    }

    /* === BADGES === */
    .badge-print {
        display: inline-block;
        padding: 2px 6px;
        font-size: 7pt;
        font-weight: 700;
        border-radius: 3px;
        line-height: 1.4;
        white-space: nowrap;
    }

    .badge-print.success {
        background: #dcfce7 !important;
        color: #166534 !important;
        border: 1px solid #86efac !important;
    }

    .badge-print.warning {
        background: #fef9c3 !important;
        color: #854d0e !important;
        border: 1px solid #fde047 !important;
    }

    .badge-print.danger {
        background: #fee2e2 !important;
        color: #991b1b !important;
        border: 1px solid #fca5a5 !important;
    }

    /* === RECOMMENDATION BOXES === */
    .recommendation-box {
        background: #f0fdf4 !important;
        border-left: 4px solid #16a34a !important;
        border-top: 1px solid #bbf7d0 !important;
        border-right: 1px solid #bbf7d0 !important;
        border-bottom: 1px solid #bbf7d0 !important;
        padding: 10px 12px;
        border-radius: 4px;
        margin-bottom: 12px;
        font-size: 8.5pt;
        line-height: 1.55;
        color: #14532d !important;
        page-break-inside: avoid;
        break-inside: avoid;
    }

    .recommendation-box h3 {
        margin: 0 0 6px 0;
        font-size: 10pt;
        font-weight: 700;
        color: #14532d !important;
    }

    .recommendation-box ul {
        margin: 4px 0 0 0;
        padding-left: 18px;
    }

    .recommendation-box li {
        margin-bottom: 4px;
        font-size: 8.5pt;
    }

    /* === SURVIVAL GUIDE === */
    .print-survival-box {
        border: 1.5px solid #cbd5e1;
        border-radius: 5px;
        padding: 12px;
        background: #f8fafc !important;
        page-break-inside: avoid;
        break-inside: avoid;
    }

    .survival-step {
        display: flex;
        gap: 8px;
        margin-bottom: 8px;
        font-size: 8.5pt;
        line-height: 1.5;
        align-items: flex-start;
    }

    .survival-step:last-child {
        margin-bottom: 0;
    }

    .survival-step strong {
        color: #0f172a !important;
        white-space: nowrap;
    }

    /* === PAGE BREAKS === */
    .page-break {
        display: block;
        page-break-before: always;
        break-before: page;
        height: 0;
        margin: 0;
        padding: 0;
    }

    /* === FOOTER === */
    .print-footer {
        border-top: 1px solid #e2e8f0;
        margin-top: 20px;
        padding-top: 8px;
        font-size: 7.5pt;
        color: #94a3b8;
        display: flex;
        justify-content: space-between;
}

/* Hide device switcher on real mobile screens */
@media (max-width: 800px) {
    .device-switcher {
        display: none !important;
    }
}

/* ==========================================
   DEVICE SWITCHER VIEWPORTS (IPAD & WEB)
   ========================================== */

/* Active Button styling inside the switcher */
.device-switcher button.active {
    background: var(--color-accent) !important;
    color: #ffffff !important;
}

/* ============================================
   RESPONSIVE VIEWS — TABLET / WEB
   ============================================ */

/* ---- TABLET (iPad) ---- */
body.view-tablet {
    overflow: hidden !important;
    height: 100vh !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
    align-items: center !important;
    padding-top: 56px !important;
    box-sizing: border-box !important;
}
body.view-tablet .app-wrapper {
    width: 100% !important;
    flex: 1 !important;
    min-height: 0 !important;
    max-width: 900px !important;
    display: flex !important;
    justify-content: center !important;
    align-items: stretch !important;
    padding: 16px !important;
    box-sizing: border-box !important;
}
body.view-tablet .phone-frame {
    width: 768px !important;
    max-width: 100% !important;
    flex: 1 !important;
    min-height: 0 !important;
    background: #1c1917 !important;
    border-radius: 28px !important;
    padding: 12px !important;
    box-shadow: 0 30px 60px -15px rgba(0,0,0,0.8), 0 0 0 4px #44403c !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
}
body.view-tablet .phone-notch {
    display: none !important;
}
body.view-tablet .phone-screen {
    width: 100% !important;
    flex: 1 !important;
    min-height: 0 !important;
    border-radius: 18px !important;
    overflow: hidden !important;
    position: relative !important;
    display: flex !important;
    flex-direction: column !important;
}
/* Login / FaceID overlay panels fill the screen */
body.view-tablet .phone-screen > [style*="position: absolute"],
body.view-tablet .login-screen-container,
body.view-tablet .face-scan-overlay {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    box-sizing: border-box !important;
}
/* App header: reduce top padding since no notch */
body.view-tablet .app-header {
    padding-top: 18px !important;
    flex-shrink: 0 !important;
}
/* Main content fills remaining space and scrolls */
body.view-tablet .app-content {
    flex: 1 !important;
    min-height: 0 !important;
    overflow-y: auto !important;
}
/* Bottom nav stays at bottom */
body.view-tablet .app-nav {
    flex-shrink: 0 !important;
}

/* ---- WEB (Full Width) ---- */
body.view-web {
    overflow: hidden !important;
    height: 100vh !important;
    display: flex !important;
    flex-direction: column !important;
    padding-top: 52px !important;
    box-sizing: border-box !important;
}
body.view-web .app-wrapper {
    width: 100% !important;
    flex: 1 !important;
    min-height: 0 !important;
    display: flex !important;
    justify-content: stretch !important;
    align-items: stretch !important;
    padding: 0 !important;
    box-sizing: border-box !important;
}
body.view-web .phone-frame {
    width: 100% !important;
    flex: 1 !important;
    min-height: 0 !important;
    border-radius: 0 !important;
    padding: 0 !important;
    background: var(--bg-phone-body) !important;
    box-shadow: none !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
}
body.view-web .phone-notch {
    display: none !important;
}
body.view-web .phone-screen {
    width: 100% !important;
    flex: 1 !important;
    min-height: 0 !important;
    border-radius: 0 !important;
    overflow: hidden !important;
    position: relative !important;
    display: flex !important;
    flex-direction: column !important;
}
/* Login / FaceID overlay panels fill the screen */
body.view-web .phone-screen > [style*="position: absolute"],
body.view-web .login-screen-container,
body.view-web .face-scan-overlay {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    box-sizing: border-box !important;
}
/* App header: reduce top padding since no notch */
body.view-web .app-header {
    padding-top: 18px !important;
    flex-shrink: 0 !important;
}
/* Main content fills remaining space and scrolls */
body.view-web .app-content {
    flex: 1 !important;
    min-height: 0 !important;
    overflow-y: auto !important;
}
/* Bottom nav stays at bottom */
body.view-web .app-nav {
    flex-shrink: 0 !important;
}

/* ---- PHONE (default) ---- */
body.view-phone .phone-frame {
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}
