/* ==========================================
   YOYO - Chat-First Interface v3
   Mobile-first, 3 modes (PRO/PERSO/PROJET)
   ========================================== */

/* ==================== VARIABLES ==================== */
:root {
    --bg-primary: #121212;
    --bg-secondary: #1a1a1a;
    --bg-card: #1e1e1e;
    --bg-card-hover: #252525;
    --bg-input: #2a2a2a;
    --border: #333333;
    --border-light: #444444;

    --accent-green: #4caf50;
    --accent-gold: #d4a843;
    --accent-red: #e05544;
    --accent-blue: #5b9bd5;
    --accent-purple: #9b6bb5;
    --accent-warm: #c87a3a;
    --accent-green-dim: rgba(76, 175, 80, 0.15);
    --accent-gold-dim: rgba(212, 168, 67, 0.15);
    --accent-red-dim: rgba(224, 85, 68, 0.12);

    --text-primary: #e8e0d4;
    --text-secondary: #b0a898;
    --text-dim: #7a7068;

    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --radius: 14px;
    --radius-sm: 10px;
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
    --shadow-hover: 0 4px 24px rgba(212, 168, 67, 0.15);

    --mode-accent: #5b9bd5;
    --mode-accent-dim: rgba(91, 155, 213, 0.15);
    --mode-accent-gradient: linear-gradient(135deg, #5b9bd5, #4080b8);
    --mode-border-top: #5b9bd5;

    --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==================== MODE THEMES ==================== */

/* PRO = Dark Tech (orange energy) */
body.mode-pro {
    --bg-primary: #0c1018;
    --bg-secondary: #111724;
    --bg-card: #161c2a;
    --bg-card-hover: #1e2640;
    --bg-input: #1a2235;
    --border: #253045;
    --border-light: #304060;
    --text-primary: #dce4f0;
    --text-secondary: #8a9cc0;
    --text-dim: #506080;
    --accent-gold: #ff9a44;
    --accent-green: #4caf50;
    --accent-red: #e05544;
    --accent-warm: #e07030;
    --accent-gold-dim: rgba(255, 154, 68, 0.12);
    --accent-green-dim: rgba(76, 175, 80, 0.12);
    --accent-red-dim: rgba(224, 85, 68, 0.1);
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
    --shadow-hover: 0 4px 24px rgba(255, 154, 68, 0.2);
    --mode-accent: #ff9a44;
    --mode-accent-dim: rgba(255, 154, 68, 0.12);
    --mode-accent-gradient: linear-gradient(135deg, #ff9a44, #e07030);
    --mode-border-top: #ff9a44;
    --logo-watermark-opacity: 0.07;
}

/* PERSO = Zen Mode (clair, chaud, apaisant) */
body.mode-perso {
    --bg-primary: #f4f0e8;
    --bg-secondary: #efe9df;
    --bg-card: #fefcf7;
    --bg-card-hover: #f8f4ec;
    --bg-input: #efe9e0;
    --border: #ddd5c8;
    --border-light: #e8e0d4;
    --text-primary: #3a3430;
    --text-secondary: #6a6058;
    --text-dim: #9a8e82;
    --accent-gold: #5a9a5a;
    --accent-green: #5a9a5a;
    --accent-red: #c45a4a;
    --accent-warm: #388e3c;
    --accent-gold-dim: rgba(90, 154, 90, 0.12);
    --accent-green-dim: rgba(90, 154, 90, 0.12);
    --accent-red-dim: rgba(196, 90, 74, 0.1);
    --shadow: 0 2px 12px rgba(120, 100, 80, 0.1);
    --shadow-hover: 0 4px 20px rgba(90, 154, 90, 0.15);
    --mode-accent: #5a9a5a;
    --mode-accent-dim: rgba(90, 154, 90, 0.1);
    --mode-accent-gradient: linear-gradient(135deg, #6aaa6a, #4a8a4a);
    --mode-border-top: #5a9a5a;
    --logo-watermark-opacity: 0.04;
}

/* PROJET = Luxe Business (noir profond, or vif) */
body.mode-projet {
    --bg-primary: #070605;
    --bg-secondary: #0e0c0a;
    --bg-card: #13110e;
    --bg-card-hover: #1e1a16;
    --bg-input: #1a1610;
    --border: #3a3020;
    --border-light: #4a4030;
    --text-primary: #f0e8d8;
    --text-secondary: #b8a890;
    --text-dim: #7a6e5e;
    --accent-gold: #e8b84d;
    --accent-green: #a8c040;
    --accent-red: #d45040;
    --accent-warm: #d09830;
    --accent-gold-dim: rgba(232, 184, 77, 0.14);
    --accent-green-dim: rgba(168, 192, 64, 0.12);
    --accent-red-dim: rgba(212, 80, 64, 0.1);
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.6);
    --shadow-hover: 0 4px 24px rgba(232, 184, 77, 0.25);
    --mode-accent: #e8b84d;
    --mode-accent-dim: rgba(232, 184, 77, 0.14);
    --mode-accent-gradient: linear-gradient(135deg, #e8b84d, #d09830);
    --mode-border-top: #e8b84d;
    --logo-watermark-opacity: 0.08;
}

/* ==================== ZEN MODE SPECIFICS ==================== */
body.mode-perso .logo h1 { color: #5a9a5a; }
body.mode-perso .logo-icon { box-shadow: 0 2px 8px rgba(90, 154, 90, 0.2); }
body.mode-perso .card { box-shadow: 0 1px 6px rgba(120, 100, 80, 0.08); }
body.mode-perso .next-prayer-card { box-shadow: 0 4px 16px rgba(90, 154, 90, 0.2); }
body.mode-perso .expanded-panel-header h2 { color: #5a9a5a; }
body.mode-perso .proactive-banner { background: linear-gradient(135deg, rgba(90, 154, 90, 0.1), rgba(90, 154, 90, 0.05)); border-color: #5a9a5a; }
body.mode-perso .proactive-label { color: #5a9a5a; }
body.mode-perso .proactive-opt:hover { background: #5a9a5a; }
body.mode-perso .section-header h2 { color: #5a9a5a; }
body.mode-perso ::-webkit-scrollbar-thumb { background: rgba(90, 154, 90, 0.4); }
body.mode-perso .chat-message.user { background: linear-gradient(135deg, #6aaa6a, #4a8a4a); color: #fff; }

/* ==================== LUXE MODE SPECIFICS ==================== */
body.mode-projet .logo h1 { color: #e8b84d; text-shadow: 0 0 20px rgba(232, 184, 77, 0.2); }
body.mode-projet .logo-icon { box-shadow: 0 0 12px rgba(232, 184, 77, 0.35); }
body.mode-projet .card-accent { border-top: 3px solid transparent; }
body.mode-projet .card:hover { border-color: rgba(232, 184, 77, 0.35); }
body.mode-projet .kpi-card { border-top: 3px solid transparent; }
body.mode-projet .expanded-panel-header { border-bottom-color: rgba(232, 184, 77, 0.3); }
body.mode-projet .kpi-value { text-shadow: 0 0 12px rgba(232, 184, 77, 0.3); }
body.mode-projet .chat-input-bar { border-top-color: rgba(232, 184, 77, 0.6); box-shadow: 0 -2px 20px rgba(232, 184, 77, 0.1); }

/* ==================== PRO MODE SPECIFICS ==================== */
body.mode-pro .logo h1 { color: #ff9a44; }
body.mode-pro .expanded-panel-header h2 { color: #ff9a44; }
body.mode-pro .section-header h2 { color: #ff9a44; }
body.mode-pro .kpi-value { text-shadow: 0 0 10px rgba(255, 154, 68, 0.25); }
body.mode-pro .card-accent { border-top-color: transparent; }

/* ==================== RESET ==================== */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { overflow-x: hidden; max-width: 100vw; }

/* ==================== BODY: FLEXBOX LAYOUT ==================== */
body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ==================== HEADER ==================== */
.header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 6px 8px 8px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    border-top: 3px solid var(--mode-border-top);
    z-index: 100;
    min-height: 48px;
    transition: border-top-color 0.3s var(--ease-smooth);
}

.header-left { display: flex; align-items: center; flex-shrink: 0; margin-right: 6px; }

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

.logo-icon {
    width: 32px; height: 32px;
    background: var(--mode-accent-gradient);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 1rem; color: #121212;
    transition: background 0.3s var(--ease-smooth);
}

.logo h1 {
    font-size: 1.05rem; font-weight: 700;
    letter-spacing: -0.5px; color: var(--accent-gold);
}

.version { display: none; }

/* Header center: tabs */
.header-center {
    display: flex;
    gap: 3px;
    flex: 1;
    justify-content: center;
    min-width: 0;
}

.header-right { display: flex; align-items: center; flex-shrink: 0; margin-left: 6px; }

/* Mode tabs in header */
.mode-tab {
    padding: 8px 16px;
    border-radius: 22px;
    font-family: var(--font);
    font-size: 0.85rem;
    font-weight: 600;
    background: transparent;
    border: 1.5px solid transparent;
    color: var(--text-dim);
    cursor: pointer;
    transition: all 0.25s var(--ease-smooth);
    -webkit-tap-highlight-color: transparent;
    white-space: nowrap;
    min-height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mode-tab:hover { color: var(--text-secondary); }

.mode-tab.active {
    background: var(--mode-accent-dim);
    border-color: var(--mode-accent);
    color: var(--mode-accent);
}

.mode-tab[data-mode="pro"].active {
    background: rgba(255, 154, 68, 0.15);
    border-color: #ff9a44; color: #ff9a44;
}

.mode-tab[data-mode="perso"].active {
    background: rgba(90, 154, 90, 0.15);
    border-color: #5a9a5a; color: #5a9a5a;
}

.mode-tab[data-mode="projet"].active {
    background: rgba(232, 184, 77, 0.15);
    border-color: #e8b84d; color: #e8b84d;
}

/* Status indicators */
.status-indicators { display: flex; gap: 4px; flex-shrink: 0; }

.status-badge {
    display: flex; align-items: center; justify-content: center; gap: 3px;
    padding: 0; border-radius: 50%;
    width: 28px; height: 28px;
    font-size: 0.65rem; font-weight: 700;
    background: var(--bg-input); border: 1px solid var(--border);
    color: var(--text-dim); cursor: default;
    transition: all 0.3s var(--ease-smooth);
}

.status-light {
    display: none;
}

.status-badge.online { color: #4caf50; border-color: #4caf50; background: rgba(76, 175, 80, 0.1); }
.status-badge.online .status-light { background: #4caf50; box-shadow: 0 0 8px rgba(76, 175, 80, 0.6); animation: pulseGreen 2s ease-in-out infinite; }

@keyframes pulseGreen {
    0%, 100% { box-shadow: 0 0 6px rgba(76, 175, 80, 0.5); }
    50% { box-shadow: 0 0 12px rgba(76, 175, 80, 0.7); }
}

.status-badge.offline { color: #e05544; border-color: #e05544; background: rgba(224, 85, 68, 0.1); }
.status-badge.offline .status-light { background: #e05544; }
.status-initial { display: inline; }
.status-label { display: none; }

/* ==================== WIDGET PANEL (slide-down overlay) ==================== */
.widget-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 50;
    opacity: 0;
    transition: opacity 0.35s var(--ease-smooth);
}

.widget-backdrop.visible {
    display: block;
    opacity: 1;
}

.widget-panel {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 60;
    background: var(--bg-primary);
    transform: translateY(-100%);
    transition: transform 0.35s var(--ease-smooth);
    max-height: 100dvh;
    display: flex;
    flex-direction: column;
    will-change: transform;
}

.widget-panel.open {
    transform: translateY(0);
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    min-height: 50px;
    flex-shrink: 0;
}

.panel-header h2 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--mode-accent);
}

.panel-close-btn {
    width: 40px; height: 40px;
    background: none; border: none;
    font-size: 1.3rem; color: var(--text-dim);
    cursor: pointer; display: flex;
    align-items: center; justify-content: center;
    border-radius: 10px;
    transition: all 0.2s var(--ease-smooth);
}

.panel-close-btn:hover {
    background: var(--accent-red-dim);
    color: var(--accent-red);
}

.panel-scroll {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 12px;
    padding-bottom: 80px;
}

/* Mode containers inside widget panel */
.mode-container { display: none; }
.mode-container.active { display: block; }

/* ==================== CHAT AREA (main experience) ==================== */
.chat-area {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
    padding-bottom: 130px;
    background:
        radial-gradient(ellipse at 50% 0%, var(--mode-accent-dim) 0%, transparent 50%),
        var(--bg-primary);
    position: relative;
}

.chat-area::after {
    content: '';
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 280px;
    height: 280px;
    background: url('/static/img/logo.svg') no-repeat center center;
    background-size: contain;
    opacity: var(--logo-watermark-opacity, 0.07);
    pointer-events: none;
    z-index: 0;
}

/* Chat welcome screen */
.chat-welcome {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.5rem;
    text-align: center;
    gap: 1.5rem;
    animation: fadeInWelcome 0.5s var(--ease-smooth);
}

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

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

.welcome-icon {
    width: 72px; height: 72px;
    background: var(--mode-accent-gradient);
    border-radius: 22px;
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 1.8rem; color: #121212;
    box-shadow: 0 4px 24px var(--mode-accent-dim);
}

.welcome-text {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-primary);
}

.welcome-sub {
    font-size: 0.85rem;
    color: var(--text-secondary);
    max-width: 300px;
}

.welcome-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    max-width: 400px;
}

.suggestion-chip {
    padding: 10px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 22px;
    font-family: var(--font);
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.25s var(--ease-smooth);
}

.suggestion-chip:hover {
    border-color: var(--mode-accent);
    color: var(--mode-accent);
    background: var(--mode-accent-dim);
}

/* Chat messages container */
.chat-messages {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1rem;
    max-width: 768px;
    width: 100%;
    margin: 0 auto;
    gap: 10px;
    overflow-x: hidden;
}

/* Chat message bubbles */
.chat-message {
    max-width: 85%;
    min-width: 0;
    padding: 10px 14px;
    border-radius: 18px;
    line-height: 1.6;
    font-size: 0.88rem;
    animation: fadeInMsg 0.3s var(--ease-smooth);
    word-wrap: break-word;
    overflow-wrap: break-word;
}

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

.chat-message.user {
    align-self: flex-end;
    margin-left: auto;
    background: var(--mode-accent-gradient);
    color: #121212;
    border-bottom-right-radius: 4px;
}

.chat-message.assistant {
    align-self: flex-start;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
}

.chat-message .msg-model {
    display: block; font-size: 0.6rem;
    margin-top: 4px; opacity: 0.5;
}

/* Tool use notification bubble */
.chat-message.tool-use {
    align-self: center;
    max-width: 90%;
    background: var(--mode-accent-dim);
    border: 1px solid var(--mode-accent);
    border-radius: 10px;
    color: var(--mode-accent);
    font-size: 0.78rem;
    font-weight: 500;
    padding: 6px 14px;
    text-align: center;
}

.chat-message.tool-use .tool-icon { margin-right: 6px; }

/* Proactive question as chat bubble */
.chat-message.proactive {
    align-self: flex-start;
    background: linear-gradient(135deg, var(--mode-accent-dim), transparent);
    border: 1px solid var(--mode-accent);
    border-bottom-left-radius: 4px;
}

.proactive-label-inline {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--mode-accent);
    margin-bottom: 4px;
}

.proactive-options-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.proactive-opt-inline {
    padding: 5px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 16px;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s var(--ease-smooth);
}

.proactive-opt-inline:hover {
    background: var(--mode-accent);
    color: #121212;
    border-color: var(--mode-accent);
}

/* ==================== CHAT INPUT BAR ==================== */
.chat-input-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border-top: 1px solid var(--accent-gold);
    z-index: 90;
    padding: 8px 12px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
}

.chat-input-bar-top {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}

.model-switch { display: flex; gap: 3px; }

.model-btn {
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-dim);
    padding: 8px 16px;
    border-radius: 22px;
    font-family: var(--font);
    font-size: 0.9rem; font-weight: 500;
    cursor: pointer;
    transition: all 0.25s var(--ease-smooth);
    min-height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.model-btn.active {
    background: var(--accent-gold-dim);
    color: var(--accent-gold);
    border-color: var(--accent-gold);
}

.context-badge {
    font-size: 0.85rem; padding: 6px 14px;
    border-radius: 22px; font-weight: 600;
    text-transform: uppercase;
    transition: all 0.3s var(--ease-smooth);
    border: 1px solid transparent;
    min-height: 34px;
    display: flex;
    align-items: center;
}

.context-badge.ctx-pro { background: rgba(106, 173, 255, 0.15); color: #6aadff; border-color: #6aadff; }
.context-badge.ctx-perso { background: rgba(90, 154, 90, 0.15); color: #5a9a5a; border-color: #5a9a5a; }
.context-badge.ctx-projet { background: rgba(232, 184, 77, 0.15); color: #e8b84d; border-color: #e8b84d; }

/* Reset chat button */
.btn-reset-chat {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-dim);
    font-size: 1.15rem;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    margin-left: auto;
    transition: all 0.25s var(--ease-smooth);
}

.btn-reset-chat:hover {
    background: var(--accent-red-dim);
    border-color: var(--accent-red);
    color: var(--accent-red);
}

.chat-input-row {
    display: flex;
    align-items: flex-end;
    gap: 6px;
}

.btn-micro {
    width: 52px; height: 52px;
    border-radius: 50%;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-dim);
    font-size: 1.3rem;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    transition: all 0.25s var(--ease-smooth);
}

.btn-micro.listening {
    background: var(--accent-red-dim);
    border-color: var(--accent-red);
    color: var(--accent-red);
    animation: pulseMic 1.5s ease-in-out infinite;
}

@keyframes pulseMic {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.btn-micro.hidden { display: none; }

/* Textarea auto-resize */
#chatInput {
    flex: 1;
    min-height: 52px;
    max-height: 120px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 10px 16px;
    border-radius: 22px;
    font-family: var(--font);
    font-size: 16px;
    outline: none;
    resize: none;
    line-height: 1.4;
    overflow-y: auto;
    transition: border-color 0.25s var(--ease-smooth);
}

#chatInput:focus { border-color: var(--accent-gold); }

#chatInput::placeholder {
    color: var(--text-dim);
}

.btn-send {
    width: 52px; height: 52px;
    border-radius: 50%;
    background: var(--mode-accent-gradient);
    border: none; color: #121212;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    transition: opacity 0.2s var(--ease-smooth);
}

.btn-send svg {
    width: 26px; height: 26px;
    margin-left: 2px;
}

.btn-send:active { opacity: 0.8; }

/* ==================== CARDS (widget panel) ==================== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 0; border-right: 0;
    border-radius: 0;
    margin: 0 -12px 8px;
    overflow: hidden;
    box-shadow: none;
    transition: border-color 0.25s var(--ease-smooth);
}

.card-accent { border-top: 3px solid transparent; }

.card-header {
    display: flex; align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-input);
    min-height: 44px;
}

.card-header h2 {
    font-size: 0.75rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.8px;
    color: var(--text-dim);
}

.card-body {
    padding: 12px 16px;
    font-size: 0.88rem;
    line-height: 1.6;
}

.card-collapsible .card-body { display: none; }
.card-collapsible.open .card-body { display: block; }

.card-header .collapse-toggle {
    background: none; border: none;
    color: var(--text-dim); font-size: 1rem;
    cursor: pointer; padding: 4px;
    min-width: 44px; min-height: 44px;
    display: flex; align-items: center; justify-content: center;
    transition: transform 0.25s var(--ease-smooth);
}

.card-collapsible.open .collapse-toggle { transform: rotate(180deg); }

/* ==================== KPI GRID ==================== */
.kpi-grid {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 8px; margin: 0 -12px; padding: 0 12px 8px;
}

.kpi-card {
    background: var(--bg-card);
    border: 1px solid transparent;
    border-top: 3px solid transparent;
    border-radius: 10px; padding: 12px;
    text-align: center;
    transition: border-color 0.25s var(--ease-smooth);
}

.kpi-value {
    font-size: 1.4rem; font-weight: 700;
    color: var(--accent-gold);
}

.kpi-label {
    font-size: 0.7rem; color: var(--text-dim);
    text-transform: uppercase; letter-spacing: 0.3px;
    margin-top: 2px;
}

/* ==================== URGENCY BANNER ==================== */
.urgency-banner {
    background: var(--accent-red-dim);
    border: 1px solid var(--accent-red);
    border-radius: 10px; padding: 10px 16px;
    margin: 0 -12px 8px; display: none;
}

.urgency-banner.visible { display: flex; align-items: center; gap: 8px; }
.urgency-banner .urgency-icon { font-size: 1.2rem; color: var(--accent-red); }
.urgency-banner .urgency-text { font-size: 0.85rem; font-weight: 600; color: var(--accent-red); }

/* ==================== TASK LIST ==================== */
.task-inline-add {
    display: flex; gap: 6px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0;
    background: var(--bg-card); z-index: 5;
}

.task-inline-add input {
    flex: 1; background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    font-family: var(--font); font-size: 15px;
    outline: none;
}

.task-inline-add input:focus { border-color: var(--mode-accent); }

.task-inline-add button {
    width: 44px; height: 44px;
    background: var(--mode-accent-gradient);
    border: none; border-radius: var(--radius-sm);
    color: #121212; font-size: 1.4rem; font-weight: 700;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: opacity 0.2s;
}

.task-item {
    display: flex; align-items: center;
    gap: 10px; padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 15px; position: relative;
    overflow: hidden;
}

.task-item .task-check {
    width: 24px; height: 24px;
    border: 2px solid var(--border);
    border-radius: 6px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; background: transparent;
    color: transparent; font-size: 0.8rem;
    transition: all 0.2s;
}

.task-item .task-check:hover {
    border-color: var(--accent-green);
    color: var(--accent-green);
    background: var(--accent-green-dim);
}

.task-title { flex: 1; min-width: 0; word-wrap: break-word; overflow-wrap: break-word; }

.task-priority {
    font-size: 0.65rem; font-weight: 700;
    padding: 2px 6px; border-radius: 6px;
    text-transform: uppercase; white-space: nowrap;
}

.task-priority.urgent { background: var(--accent-red-dim); color: var(--accent-red); }
.task-priority.normal { background: var(--accent-gold-dim); color: var(--accent-gold); }
.task-priority.low { background: var(--accent-green-dim); color: var(--accent-green); }

.task-delete {
    background: none; border: none;
    color: var(--text-dim); font-size: 1rem;
    cursor: pointer; padding: 4px;
    min-width: 44px; min-height: 44px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 8px; transition: all 0.2s;
}

.task-delete:hover { background: var(--accent-red-dim); color: var(--accent-red); }

/* ==================== PRAYER SECTION ==================== */
.next-prayer-card {
    background: var(--mode-accent-gradient);
    border-radius: 14px; padding: 20px;
    text-align: center; color: #121212;
    margin: 0 -12px 8px;
}

.next-prayer-card .prayer-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 1px; opacity: 0.7; }
.next-prayer-card .prayer-name { font-size: 1.6rem; font-weight: 700; margin: 4px 0; }
.next-prayer-card .prayer-time { font-size: 1.1rem; opacity: 0.9; }
.next-prayer-card .prayer-countdown { font-size: 0.85rem; opacity: 0.6; margin-top: 4px; }

.prayer-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }

.prayer-time-card {
    text-align: center; padding: 10px 4px;
    background: var(--bg-input); border: 1px solid var(--border);
    border-radius: var(--radius-sm); transition: all 0.25s var(--ease-smooth);
}

.prayer-time-card.active-prayer { border-color: var(--mode-accent); background: var(--mode-accent-dim); }
.prayer-time-card .prayer-name { font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-dim); margin-bottom: 2px; }
.prayer-time-card .prayer-hour { font-size: 1.1rem; font-weight: 700; color: var(--text-primary); }
.prayer-time-card.active-prayer .prayer-name { color: var(--mode-accent); }

/* ==================== OBJECTIVES ==================== */
.objective-item { padding: 14px 16px; border-bottom: 1px solid var(--border); }
.objective-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.objective-title { font-size: 0.9rem; font-weight: 600; flex: 1; }
.objective-pct { font-size: 0.85rem; font-weight: 700; color: var(--accent-gold); margin-left: 8px; }
.objective-bar { width: 100%; height: 10px; background: var(--bg-input); border-radius: 5px; overflow: hidden; cursor: pointer; }
.objective-bar-fill { height: 100%; background: var(--mode-accent-gradient); border-radius: 5px; transition: width 0.3s var(--ease-smooth); }
.objective-meta { display: flex; justify-content: space-between; margin-top: 4px; font-size: 0.7rem; color: var(--text-dim); }
.objective-actions { display: flex; gap: 4px; margin-top: 6px; }
.objective-actions button { background: none; border: 1px solid var(--border); border-radius: 6px; padding: 4px 10px; font-size: 0.7rem; color: var(--text-dim); cursor: pointer; font-family: var(--font); min-height: 32px; }
.objective-actions button:hover { border-color: var(--accent-gold); color: var(--accent-gold); }

/* ==================== IDEAS ==================== */
.idea-item { padding: 12px 16px; border-bottom: 1px solid var(--border); position: relative; }
.idea-title { font-size: 0.9rem; font-weight: 600; margin-bottom: 2px; }
.idea-preview { font-size: 0.82rem; color: var(--text-secondary); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.idea-tags { font-size: 0.7rem; color: var(--accent-gold); margin-top: 4px; }
.idea-actions { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); display: flex; gap: 4px; }
.idea-actions button { background: none; border: none; color: var(--text-dim); cursor: pointer; padding: 4px; min-width: 36px; min-height: 36px; display: flex; align-items: center; justify-content: center; border-radius: 8px; font-size: 0.9rem; }
.idea-actions button:hover { background: var(--accent-red-dim); color: var(--accent-red); }

/* ==================== EMAIL LIST ==================== */
.email-item { padding: 10px 16px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background 0.2s; }
.email-item:active { background: var(--bg-card-hover); }
.email-item.email-unread { border-left: 3px solid var(--accent-gold); }
.email-from { font-weight: 600; font-size: 0.85rem; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.email-subject { font-size: 0.8rem; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.email-date { font-size: 0.65rem; color: var(--text-dim); float: right; margin-top: 2px; }
.email-meta { font-size: 0.8rem; color: var(--text-secondary); padding-bottom: 0.8rem; margin-bottom: 0.8rem; border-bottom: 1px solid var(--border); line-height: 1.6; }
.email-summary-text { font-size: 0.88rem; line-height: 1.7; color: var(--text-primary); }

/* ==================== SUPPLIER CARDS ==================== */
.suppliers-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 12px 16px; }
.supplier-card { display: flex; flex-direction: column; padding: 10px; background: var(--bg-input); border: 1px solid var(--border); border-left: 3px solid var(--accent-gold); border-radius: var(--radius-sm); cursor: pointer; transition: all 0.2s; }
.supplier-card:active { border-color: var(--accent-gold); }
.supplier-show-more { padding: 10px; text-align: center; font-size: 0.8rem; font-weight: 600; color: var(--mode-accent); background: var(--bg-input); border: 1px dashed var(--border); border-radius: var(--radius-sm); cursor: pointer; transition: all 0.2s; grid-column: 1 / -1; }
.supplier-show-more:hover { background: var(--bg-card); border-color: var(--mode-accent); }
.supplier-name { font-weight: 600; font-size: 0.82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.supplier-info { font-size: 0.7rem; color: var(--text-dim); }
.amount-ttc { color: var(--accent-green); font-weight: 600; font-size: 0.82rem; margin-top: 2px; }

/* ==================== EXPANDED PANEL ==================== */
.expanded-panel {
    position: fixed; inset: 0; z-index: 1000;
    background: var(--bg-primary);
    transform: translateY(100%);
    transition: transform 0.25s var(--ease-smooth);
    will-change: transform;
    display: flex; flex-direction: column;
}

.expanded-panel.open { transform: translateY(0); }

.expanded-panel-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px; background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 10; min-height: 56px;
}

.expanded-panel-header h2 { font-size: 1rem; font-weight: 600; color: var(--accent-gold); }

.expanded-panel-close {
    width: 48px; height: 48px;
    background: none; border: none;
    font-size: 1.5rem; color: var(--text-dim);
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    border-radius: 12px;
}

.expanded-panel-close:hover { background: var(--accent-red-dim); color: var(--accent-red); }

.expanded-panel-content {
    flex: 1; overflow-y: auto;
    -webkit-overflow-scrolling: touch; padding: 12px;
}

/* ==================== INVOICES TABLE ==================== */
.invoice-table { width: 100%; border-collapse: collapse; }
.invoice-table th { text-align: left; padding: 8px 6px; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.5px; color: var(--accent-gold); border-bottom: 2px solid var(--border); }
.invoice-table td { padding: 8px 6px; font-size: 0.82rem; border-bottom: 1px solid var(--border); }
.invoice-table tr:active td { background: var(--bg-card-hover); }

.invoice-detail-grid { display: grid; grid-template-columns: 1fr; gap: 0; }
.invoice-detail-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); }
.invoice-detail-label { font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; color: var(--text-dim); }
.invoice-detail-value { font-size: 0.88rem; font-weight: 500; color: var(--text-primary); text-align: right; }

.period-switch { display: flex; gap: 0; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.period-btn { padding: 6px 12px; font-size: 0.75rem; font-weight: 600; background: var(--bg-input); color: var(--text-dim); border: none; cursor: pointer; transition: all 0.2s; border-right: 1px solid var(--border); }
.period-btn:last-child { border-right: none; }
.period-btn.active { background: var(--accent-gold); color: #121212; }

/* ==================== DOUAA & PEACE ==================== */
.douaa-card { padding: 4px 0; }
.douaa-arabic { font-size: 1.2rem; line-height: 2; text-align: right; direction: rtl; color: var(--accent-gold); margin-bottom: 8px; font-family: 'Traditional Arabic', 'Amiri', serif; }
.douaa-translation { font-size: 0.82rem; color: var(--text-secondary); font-style: italic; padding-top: 8px; border-top: 1px solid var(--border); }
.douaa-source { font-size: 0.68rem; color: var(--text-dim); margin-top: 4px; }
.peace-quote { font-size: 0.95rem; line-height: 1.8; color: var(--accent-gold); text-align: center; padding: 8px 0; }
.peace-author { font-size: 0.78rem; color: var(--text-dim); text-align: center; margin-top: 4px; }

/* ==================== WELLNESS ==================== */
.wellness-card { text-align: center; padding: 16px; }
.wellness-card .wellness-icon { font-size: 2rem; margin-bottom: 8px; }
.wellness-card p { font-size: 0.88rem; color: var(--text-secondary); line-height: 1.6; }

/* ==================== PROACTIVE LEARNING (legacy for widget panel) ==================== */
.proactive-banner { background: linear-gradient(135deg, rgba(212, 168, 67, 0.12), rgba(212, 168, 67, 0.06)); border: 1px solid var(--accent-gold); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 8px; position: relative; }
.proactive-close { position: absolute; top: 8px; right: 8px; cursor: pointer; color: var(--text-dim); font-size: 0.9rem; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: 50%; }
.proactive-close:hover { background: var(--accent-red-dim); color: var(--accent-red); }
.proactive-label { font-size: 0.65rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--accent-gold); margin-bottom: 4px; }
.proactive-text { font-size: 0.92rem; font-weight: 500; color: var(--text-primary); margin-bottom: 8px; padding-right: 24px; }
.proactive-options { display: flex; flex-wrap: wrap; gap: 6px; }
.proactive-opt { padding: 6px 12px; background: var(--bg-input); border: 1px solid var(--border); border-radius: 20px; font-size: 0.78rem; font-weight: 500; color: var(--text-primary); cursor: pointer; transition: all 0.2s; min-height: 36px; display: flex; align-items: center; }
.proactive-opt:hover { background: var(--accent-gold); color: #121212; border-color: var(--accent-gold); }
.proactive-free-input { display: flex; gap: 6px; width: 100%; }
.proactive-free-input input { flex: 1; padding: 6px 10px; background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text-primary); font-size: 0.82rem; outline: none; }
.proactive-free-input button { padding: 6px 12px; background: var(--accent-gold); border: none; border-radius: var(--radius-sm); color: #121212; cursor: pointer; font-size: 0.82rem; min-height: 36px; }
.proactive-thanks { text-align: center; color: var(--accent-green); font-weight: 600; padding: 8px; }

/* ==================== SYNC BANNER ==================== */
.sync-banner { padding: 10px 16px; border-radius: var(--radius-sm); margin-bottom: 8px; font-size: 0.82rem; line-height: 1.5; }
.sync-banner.sync-loading { background: var(--accent-gold-dim); border: 1px solid var(--accent-gold); color: var(--accent-gold); }
.sync-banner.sync-success { background: var(--accent-green-dim); border: 1px solid var(--accent-green); color: var(--accent-green); }
.sync-banner.sync-error { background: var(--accent-red-dim); border: 1px solid var(--accent-red); color: var(--accent-red); }

/* ==================== BUTTONS ==================== */
.btn-refresh { background: transparent; border: 1px solid var(--border); color: var(--text-dim); width: 36px; height: 36px; border-radius: 50%; cursor: pointer; font-size: 1rem; display: flex; align-items: center; justify-content: center; transition: all 0.25s var(--ease-smooth); }
.btn-refresh:hover { background: var(--accent-gold-dim); color: var(--accent-gold); border-color: var(--accent-gold); }
.btn-small { background: transparent; border: 1px solid var(--border); color: var(--text-secondary); padding: 6px 12px; border-radius: var(--radius-sm); cursor: pointer; font-size: 0.75rem; font-family: var(--font); transition: all 0.25s var(--ease-smooth); min-height: 36px; }
.btn-small:hover { background: var(--accent-gold-dim); color: var(--accent-gold); border-color: var(--accent-gold); }
.btn-sync { background: linear-gradient(135deg, var(--accent-gold), var(--accent-warm)); color: #121212; border: none; padding: 8px 14px; border-radius: var(--radius-sm); font-weight: 600; font-size: 0.78rem; cursor: pointer; transition: all 0.25s var(--ease-smooth); min-height: 36px; }
.btn-sync:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-upload { cursor: pointer; display: inline-flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--accent-gold), var(--accent-warm)); border: none; color: #121212; padding: 8px 14px; border-radius: var(--radius-sm); font-family: var(--font); font-weight: 600; font-size: 0.78rem; min-height: 36px; }
.invoice-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; flex-wrap: wrap; gap: 6px; padding: 0 4px; }
.section-header h2 { font-size: 1rem; color: var(--accent-gold); }

/* ==================== SECTION TITLES ==================== */
.section-title {
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--mode-accent);
    padding: 12px 4px 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-source {
    font-size: 0.65rem;
    font-weight: 500;
    color: var(--text-dim);
    text-transform: none;
    letter-spacing: 0;
}

/* ==================== REVENUE BREAKDOWN ==================== */
.revenue-total {
    font-size: 0.9rem;
    color: var(--text-primary);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.revenue-total strong {
    color: var(--mode-accent);
    font-size: 1rem;
}

.revenue-breakdown {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.revenue-row {
    display: grid;
    grid-template-columns: 70px 1fr 70px 42px;
    align-items: center;
    gap: 8px;
}

.revenue-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.revenue-bar-track {
    height: 12px;
    background: var(--bg-input);
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}

.revenue-bar {
    height: 100%;
    border-radius: 6px;
    transition: width 0.5s var(--ease-smooth);
    min-width: 2px;
}

.revenue-bar-card {
    background: linear-gradient(135deg, #4caf50, #66bb6a);
}

.revenue-bar-cash {
    background: linear-gradient(135deg, #ffc107, #ffca28);
}

.revenue-bar-transfer {
    background: linear-gradient(135deg, #5b9bd5, #64b5f6);
}

.revenue-amount {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-primary);
    text-align: right;
}

.revenue-pct {
    font-size: 0.7rem;
    color: var(--text-dim);
    text-align: right;
}

/* ==================== UNPAID INVOICES ==================== */
.unpaid-summary {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.unpaid-summary strong {
    color: var(--accent-red);
}

.unpaid-empty {
    text-align: center;
    color: var(--accent-green);
    font-weight: 600;
    font-size: 0.85rem;
    padding: 12px 0;
}

.unpaid-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.unpaid-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    border-left: 3px solid var(--accent-red);
    padding-left: 12px;
}

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

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

.unpaid-meta {
    font-size: 0.7rem;
    color: var(--text-dim);
    margin-top: 2px;
}

.unpaid-amount {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--accent-red);
}

/* ==================== TAB SWITCH ==================== */
.tab-switch {
    display: flex;
    background: var(--bg-input);
    border-bottom: 1px solid var(--border);
    padding: 0;
}

.tab-btn {
    flex: 1;
    padding: 10px 16px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    font-family: var(--font);
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-dim);
    cursor: pointer;
    transition: all 0.25s var(--ease-smooth);
    min-height: 40px;
}

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

.tab-btn.active {
    color: var(--mode-accent);
    border-bottom-color: var(--mode-accent);
}

.depenses-tab-content {
    display: none;
}

.depenses-tab-content.active {
    display: block;
}

/* ==================== KPI UNPAID CARD ==================== */
.kpi-card-unpaid .kpi-value {
    color: var(--text-primary);
}

.kpi-card-unpaid.has-unpaid .kpi-value {
    color: var(--accent-red);
}

.kpi-sub {
    font-size: 0.65rem;
    color: var(--accent-red);
    font-weight: 600;
    margin-top: 1px;
}

/* ==================== LOADING ==================== */
.loading { color: var(--text-dim); font-style: italic; font-size: 0.82rem; padding: 8px 0; }

.typing-indicator { display: inline-flex; gap: 4px; padding: 4px 0; }
.typing-indicator span { width: 6px; height: 6px; background: var(--accent-gold); border-radius: 50%; animation: typing 1.4s infinite; }
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
    30% { opacity: 1; transform: translateY(-4px); }
}

/* ==================== MODAL ==================== */
.modal { display: none; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(4px); z-index: 200; align-items: center; justify-content: center; }
.modal.active { display: flex; }
.modal-content { background: var(--bg-card); border: 1px solid var(--accent-gold); border-radius: var(--radius); padding: 24px; max-width: calc(100vw - 32px); text-align: center; }
.modal-icon { font-size: 2.5rem; margin-bottom: 12px; color: var(--accent-gold); }
.modal-content p { margin-bottom: 16px; line-height: 1.7; color: var(--text-secondary); }
.modal-content button { background: linear-gradient(135deg, var(--accent-gold), var(--accent-warm)); border: none; color: #121212; padding: 10px 24px; border-radius: var(--radius-sm); font-family: var(--font); font-weight: 600; cursor: pointer; min-height: 44px; }

/* ==================== SCROLLBAR ==================== */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--accent-gold); border-radius: 2px; opacity: 0.5; }

/* ==================== REDUCED MOTION ==================== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
    .expanded-panel, .widget-panel { transition: none; }
}

/* ==================== RESPONSIVE: large phones (>480px) ==================== */
@media (min-width: 480px) {
    .header { padding: 10px 16px; }

    .card {
        margin: 0 0 10px;
        border-left: 1px solid var(--border);
        border-right: 1px solid var(--border);
        border-radius: var(--radius-sm);
    }

    .kpi-grid { margin: 0; padding: 0 0 10px; }
    .urgency-banner, .next-prayer-card { margin: 0 0 10px; }
    .suppliers-grid { padding: 12px; }

    .panel-scroll { padding: 16px; }
}

/* ==================== RESPONSIVE: tablets (>768px) ==================== */
@media (min-width: 768px) {
    .header { padding: 12px 24px; }

    .status-label { display: inline; }
    .status-initial { display: none; }
    .status-badge { padding: 4px 10px; font-size: 0.7rem; }

    .mode-tab { padding: 6px 18px; font-size: 0.8rem; }

    .chat-messages { padding: 1.5rem; }

    .widget-panel {
        max-height: 85dvh;
        border-radius: 0 0 16px 16px;
    }

    .card {
        border-radius: var(--radius);
        margin-bottom: 12px;
        box-shadow: var(--shadow);
    }

    .kpi-grid { grid-template-columns: repeat(5, 1fr); gap: 12px; }
    .kpi-value { font-size: 1.6rem; }
    .kpi-card { padding: 16px; }
    .prayer-grid { grid-template-columns: repeat(6, 1fr); gap: 8px; }
    .suppliers-grid { grid-template-columns: repeat(3, 1fr); }
    .invoice-detail-grid { grid-template-columns: 1fr 1fr; gap: 0 24px; }

    .chat-input-bar { padding: 8px 24px; padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px)); left: 0; right: 0; }
    .model-btn { font-size: 12px; padding: 3px 12px; }

    .expanded-panel { width: 60%; left: auto; right: 0; transform: translateX(100%); }
    .expanded-panel.open { transform: translateX(0); }
}

/* ==================== RESPONSIVE: desktop (>1024px) ==================== */
@media (min-width: 1024px) {
    .version { display: inline; font-size: 0.7rem; color: var(--text-dim); }
    .logo-icon { width: 40px; height: 40px; font-size: 1.2rem; border-radius: 12px; }
    .logo h1 { font-size: 1.1rem; }

    .chat-input-bar {
        max-width: 800px;
        left: 50%; transform: translateX(-50%);
        position: fixed;
        border-radius: var(--radius) var(--radius) 0 0;
        border-left: 1px solid var(--accent-gold);
        border-right: 1px solid var(--accent-gold);
    }

    .card:hover { box-shadow: var(--shadow-hover); border-color: var(--accent-gold); }
    .kpi-value { font-size: 1.8rem; }
    .objective-bar { height: 8px; }
}

/* ==========================================================================
   V3 ENHANCEMENTS : PRO peps, PERSO warmth, PROJET energy
   ========================================================================== */

/* ==================== PRO MODE: Orange energy peps ==================== */

/* KPI cards: clean bg + shimmer only */
body.mode-pro .kpi-card {
    background: linear-gradient(145deg, #161c2a, #1a2235);
    border: 1px solid transparent;
    border-top: 3px solid transparent;
    position: relative;
    overflow: hidden;
}

body.mode-pro .kpi-card::before {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 200%; height: 3px;
    background: linear-gradient(90deg, transparent, rgba(255, 154, 68, 0.9), transparent);
    animation: shimmerBorder 3s ease-in-out infinite;
}

@keyframes shimmerBorder {
    0% { transform: translateX(-50%); }
    100% { transform: translateX(50%); }
}

/* KPI values: orange gradient text */
body.mode-pro .kpi-value {
    background: linear-gradient(135deg, #ff8a30, #ffb870);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Cards: transparent border, shimmer only */
body.mode-pro .card-accent {
    border-top: 3px solid transparent;
    position: relative;
    overflow: hidden;
}

body.mode-pro .card-accent::before {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 200%; height: 3px;
    background: linear-gradient(90deg, transparent, rgba(255, 154, 68, 0.8), transparent);
    animation: shimmerBorder 4s ease-in-out infinite;
}

/* Header/input-bar: gradient + shimmer, no solid border */
body.mode-pro .header {
    background: linear-gradient(180deg, #111724, #161c2a);
    border-top: 3px solid transparent;
    position: relative;
    overflow: hidden;
}

body.mode-pro .header::before {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 200%; height: 3px;
    background: linear-gradient(90deg, transparent, rgba(255, 154, 68, 0.9), transparent);
    animation: shimmerBorder 3s ease-in-out infinite;
}

body.mode-pro .chat-input-bar {
    background: linear-gradient(180deg, #161c2a, #111724);
    border-top-color: transparent;
    box-shadow: 0 -2px 20px rgba(255, 154, 68, 0.08);
    position: fixed;
    overflow: hidden;
}

body.mode-pro .chat-input-bar::before {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 200%; height: 2px;
    background: linear-gradient(90deg, transparent, rgba(255, 154, 68, 0.9), transparent);
    animation: shimmerBorder 3.5s ease-in-out infinite;
}

/* Action buttons: box-shadow orange */
body.mode-pro .btn-sync,
body.mode-pro .btn-upload {
    background: linear-gradient(135deg, #ff8a30, #e07030);
    box-shadow: 0 2px 12px rgba(255, 138, 48, 0.3);
}

body.mode-pro .btn-send {
    background: linear-gradient(135deg, #ff9a44, #e07030);
    box-shadow: 0 2px 16px rgba(255, 154, 68, 0.4);
}

/* Amount TTC: orange gradient text (global for PRO) */
body.mode-pro .amount-ttc {
    background: linear-gradient(135deg, #ff8a30, #ffb870);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
}

/* Supplier card left-border orange */
body.mode-pro .supplier-card {
    border-left-color: #ff9a44;
}

/* Invoice table header: orange */
body.mode-pro .invoice-table th {
    color: #ff9a44;
}

/* Email unread border orange */
body.mode-pro .email-item.email-unread {
    border-left-color: #ff9a44;
}

/* Period switch active orange */
body.mode-pro .period-btn.active {
    background: linear-gradient(135deg, #ff9a44, #e07030);
    color: #121212;
}

/* Mode accent overrides for orange tabs */
body.mode-pro .model-btn.active {
    background: rgba(255, 154, 68, 0.15);
    color: #ff9a44;
    border-color: #ff9a44;
}

body.mode-pro .context-badge.ctx-pro {
    background: rgba(255, 154, 68, 0.15);
    color: #ff9a44;
    border-color: #ff9a44;
}

/* Revenue bars in PRO: card bar gets orange tint */
body.mode-pro .revenue-bar-card { background: linear-gradient(135deg, #4caf50, #66bb6a); }
body.mode-pro .revenue-bar-cash { background: linear-gradient(135deg, #ffc107, #ffca28); }
body.mode-pro .revenue-bar-transfer { background: linear-gradient(135deg, #5b9bd5, #64b5f6); }

body.mode-pro .revenue-total strong {
    background: linear-gradient(135deg, #ff8a30, #ffb870);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

body.mode-pro .section-title { color: #ff9a44; }

body.mode-pro .tab-btn.active {
    color: #ff9a44;
    border-bottom-color: #ff9a44;
}

body.mode-pro .unpaid-amount {
    color: #e05544;
}

/* Scrollbar orange in PRO */
body.mode-pro ::-webkit-scrollbar-thumb {
    background: rgba(255, 154, 68, 0.5);
}

/* Proactive banner orange */
body.mode-pro .proactive-banner {
    background: linear-gradient(135deg, rgba(255, 154, 68, 0.12), rgba(255, 154, 68, 0.05));
    border-color: #ff9a44;
}

body.mode-pro .proactive-label { color: #ff9a44; }

/* ==================== PERSO MODE: Warmer, less admin ==================== */

/* Cards: border-radius 16px, transparent borders + green shimmer */
body.mode-perso .card {
    border-radius: 16px;
    border: 1px solid transparent;
    background: linear-gradient(170deg, rgba(254, 252, 247, 0.6), rgba(248, 244, 236, 0.4));
    backdrop-filter: blur(4px);
}

body.mode-perso .card-accent {
    border-top: 3px solid transparent;
    position: relative;
    overflow: hidden;
}

body.mode-perso .card-accent::before {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 200%; height: 3px;
    background: linear-gradient(90deg, transparent, rgba(90, 154, 90, 0.7), transparent);
    animation: shimmerBorder 4s ease-in-out infinite;
}

/* KPI cards: transparent + green shimmer */
body.mode-perso .kpi-card {
    background: linear-gradient(145deg, rgba(254, 252, 247, 0.6), rgba(248, 244, 236, 0.4));
    border: 1px solid transparent;
    border-top: 3px solid transparent;
    border-radius: 16px;
    position: relative;
    overflow: hidden;
}

body.mode-perso .kpi-card::before {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 200%; height: 3px;
    background: linear-gradient(90deg, transparent, rgba(90, 154, 90, 0.8), transparent);
    animation: shimmerBorder 3s ease-in-out infinite;
}

/* KPI values: green gradient text */
body.mode-perso .kpi-value {
    background: linear-gradient(135deg, #4a8a4a, #6aaa6a);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Header/input-bar: cream gradient + green shimmer */
body.mode-perso .header {
    background: linear-gradient(180deg, #f4f0e8, #efe9df);
    border-top: 3px solid transparent;
    position: relative;
    overflow: hidden;
}

body.mode-perso .header::before {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 200%; height: 3px;
    background: linear-gradient(90deg, transparent, rgba(90, 154, 90, 0.8), transparent);
    animation: shimmerBorder 3s ease-in-out infinite;
}

body.mode-perso .chat-input-bar {
    background: linear-gradient(180deg, #efe9df, #f4f0e8);
    border-top-color: transparent;
    box-shadow: 0 -2px 20px rgba(90, 154, 90, 0.06);
    position: fixed;
    overflow: hidden;
}

body.mode-perso .chat-input-bar::before {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 200%; height: 2px;
    background: linear-gradient(90deg, transparent, rgba(90, 154, 90, 0.8), transparent);
    animation: shimmerBorder 3.5s ease-in-out infinite;
}

/* Wellness card: generous padding, soft green gradient */
body.mode-perso .wellness-card {
    padding: 24px 20px;
    background: linear-gradient(145deg, rgba(90, 154, 90, 0.06), rgba(90, 154, 90, 0.02));
    border-radius: 16px;
}

body.mode-perso .wellness-card p {
    font-size: 0.95rem;
    line-height: 1.8;
}

/* Prayer card: border-radius 18px */
body.mode-perso .next-prayer-card {
    border-radius: 18px;
}

/* Peace quotes: bigger, italic */
body.mode-perso .peace-quote {
    font-size: 1.1rem;
    font-style: italic;
    line-height: 2;
}

body.mode-perso .peace-author {
    font-size: 0.85rem;
}

/* ==================== PROJET MODE: More inspiring, gold energy ==================== */

/* Cards: transparent borders + gold shimmer */
body.mode-projet .card {
    background: linear-gradient(170deg, rgba(19, 17, 14, 0.6), rgba(26, 22, 16, 0.4));
    border: 1px solid transparent;
    backdrop-filter: blur(4px);
}

body.mode-projet .card-accent {
    border-top: 3px solid transparent;
    position: relative;
    overflow: hidden;
}

body.mode-projet .card-accent::before {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 200%; height: 3px;
    background: linear-gradient(90deg, transparent, rgba(232, 184, 77, 0.8), transparent);
    animation: shimmerBorder 4s ease-in-out infinite;
}

/* KPI cards: transparent + gold shimmer */
body.mode-projet .kpi-card {
    background: linear-gradient(145deg, rgba(19, 17, 14, 0.6), rgba(26, 22, 16, 0.4));
    border: 1px solid transparent;
    border-top: 3px solid transparent;
    position: relative;
    overflow: hidden;
}

body.mode-projet .kpi-card::before {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 200%; height: 3px;
    background: linear-gradient(90deg, transparent, rgba(232, 184, 77, 0.9), transparent);
    animation: shimmerBorder 3s ease-in-out infinite;
}

/* KPI values: gold gradient text */
body.mode-projet .kpi-value {
    background: linear-gradient(135deg, #e8b84d, #f0d080);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Objective bars: golden glow */
body.mode-projet .objective-bar-fill {
    box-shadow: 0 0 10px rgba(232, 184, 77, 0.4);
}

body.mode-projet .objective-bar {
    box-shadow: inset 0 0 6px rgba(232, 184, 77, 0.1);
}

/* Objective percentages: gradient text gold */
body.mode-projet .objective-pct {
    background: linear-gradient(135deg, #e8b84d, #f0d080);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 800;
}

/* Ideas: hover effect */
body.mode-projet .idea-item {
    transition: all 0.25s var(--ease-smooth);
}

body.mode-projet .idea-item:hover {
    background: rgba(232, 184, 77, 0.06);
    border-left: 3px solid rgba(232, 184, 77, 0.5);
    padding-left: 13px;
}

/* Header/input-bar: gradient noir + gold shimmer */
body.mode-projet .header {
    background: linear-gradient(180deg, #0e0c0a, #13110e);
    border-top: 3px solid transparent;
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 16px rgba(232, 184, 77, 0.08);
}

body.mode-projet .header::before {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 200%; height: 3px;
    background: linear-gradient(90deg, transparent, rgba(232, 184, 77, 0.9), transparent);
    animation: shimmerBorder 3s ease-in-out infinite;
}

body.mode-projet .chat-input-bar {
    background: linear-gradient(180deg, #13110e, #0e0c0a);
    border-top-color: transparent;
    box-shadow: 0 -2px 20px rgba(232, 184, 77, 0.1);
    position: fixed;
    overflow: hidden;
}

body.mode-projet .chat-input-bar::before {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 200%; height: 2px;
    background: linear-gradient(90deg, transparent, rgba(232, 184, 77, 0.9), transparent);
    animation: shimmerBorder 3.5s ease-in-out infinite;
}
