    /* ═══════════════════════════════════════
       Design Tokens & CSS Variables
    ════════════════════════════════════════ */
    :root {
        color-scheme: dark;
        --bg-color: #080c0a;
        --sidebar-bg: #0d1511;
        --card-bg: rgba(20, 32, 26, 0.65);
        --user-bubble: #172a20;
        --assistant-bubble: #111d17;

        --primary-accent: #1F4A37;
        --primary-light: #2d6b4f;
        --secondary-accent: #c6a252;
        --secondary-hover: #d8b463;

        --text-primary: #ffffff;
        --text-secondary: #a3b8ad;
        --text-muted: #6b8275;

        --border-color: rgba(255, 255, 255, 0.08);
        --sidebar-border: rgba(255, 255, 255, 0.06);

        --sidebar-width: 300px;
        --header-height: 64px;

        --font-family: 'Cairo', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
        --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
        --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
        --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.6);
        --glow: 0 0 20px rgba(31, 74, 55, 0.35);

        --radius-sm: 10px;
        --radius-md: 16px;
        --radius-lg: 22px;
        --radius-full: 9999px;

        /* Apple Design Motion Tokens */
        --spring-damped: cubic-bezier(0.16, 1, 0.3, 1);
        --spring-bounce: cubic-bezier(0.175, 0.885, 0.32, 1.25);
        --transition-fast: 0.12s var(--spring-damped);
        --transition-normal: 0.28s var(--spring-damped);
        --transition-slow: 0.42s var(--spring-damped);
    }

    body.light-mode {
        color-scheme: light;
        --bg-color: #f4f7f5;
        --sidebar-bg: #e8efe9;
        --card-bg: rgba(255, 255, 255, 0.85);
        --user-bubble: #e2ede6;
        --assistant-bubble: #ffffff;

        --text-primary: #122118;
        --text-secondary: #3b5446;
        --text-muted: #6d8879;

        --border-color: rgba(31, 74, 55, 0.12);
        --sidebar-border: rgba(31, 74, 55, 0.1);

        --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
        --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.08);
        --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.12);
        --glow: 0 0 20px rgba(31, 74, 55, 0.12);
    }

    /* ═══════════════════════════════════════
       Reset & Base Styles
    ════════════════════════════════════════ */
    *, *::before, *::after {
        box-sizing: border-box;
        margin: 0;
        padding: 0;
    }

    html, body {
        height: 100%;
        width: 100%;
        font-family: var(--font-family);
        background-color: var(--bg-color);
        color: var(--text-primary);
        overflow: hidden;
        direction: rtl;
        text-align: right;
        -webkit-font-smoothing: antialiased;
    }

    body {
        display: flex;
        position: relative;
    }

    /* Background Ambient Glows (Apple Vibrancy Mesh) */
    body::before {
        content: '';
        position: fixed;
        top: -15%;
        right: -10%;
        width: 55vw;
        height: 55vw;
        border-radius: 50%;
        background: radial-gradient(circle, rgba(31, 74, 55, 0.35) 0%, rgba(31, 74, 55, 0.05) 50%, rgba(0, 0, 0, 0) 75%);
        pointer-events: none;
        z-index: 0;
        filter: blur(40px);
    }
    body::after {
        content: '';
        position: fixed;
        bottom: -15%;
        left: -10%;
        width: 50vw;
        height: 50vw;
        border-radius: 50%;
        background: radial-gradient(circle, rgba(198, 162, 82, 0.18) 0%, rgba(198, 162, 82, 0.03) 50%, rgba(0, 0, 0, 0) 75%);
        pointer-events: none;
        z-index: 0;
        filter: blur(40px);
    }

    /* Scrollbar Styling */
    ::-webkit-scrollbar {
        width: 6px;
        height: 6px;
    }
    ::-webkit-scrollbar-track {
        background: transparent;
    }
    ::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.12);
        border-radius: var(--radius-full);
    }
    ::-webkit-scrollbar-thumb:hover {
        background: rgba(255, 255, 255, 0.25);
    }
    body.light-mode ::-webkit-scrollbar-thumb {
        background: rgba(31, 74, 55, 0.2);
    }

    /* ═══════════════════════════════════════
       Layout: Sidebar (Right side in RTL)
    ════════════════════════════════════════ */
    #appSidebar {
        width: var(--sidebar-width);
        height: 100dvh;
        background-color: var(--sidebar-bg);
        border-left: 1px solid var(--sidebar-border);
        display: flex;
        flex-direction: column;
        flex-shrink: 0;
        position: relative;
        z-index: 20;
        transition: width var(--transition-normal), transform var(--transition-normal);
        backdrop-filter: blur(12px);
    }

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

    .brand-container {
        display: flex;
        align-items: center;
        gap: 12px;
        text-decoration: none;
        color: var(--text-primary);
    }

    .sidebar-logo-wrap {
        width: 38px;
        height: 38px;
        border-radius: 10px;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0;
        box-shadow: 0 4px 12px rgba(31, 74, 55, 0.2);
        flex-shrink: 0;
        overflow: hidden;
    }

    .sidebar-logo-wrap img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        transform: scale(1.25);
        border-radius: 9px;
    }

    .brand-title {
        display: flex;
        flex-direction: column;
    }
    .brand-title h1 {
        font-size: 16px;
        font-weight: 800;
        letter-spacing: -0.2px;
        color: var(--text-primary);
        line-height: 1.2;
    }
    .brand-title span {
        font-size: 11px;
        color: var(--secondary-accent);
        font-weight: 600;
    }

    .btn-new-chat {
        margin: 16px 18px 8px 18px;
        padding: 0 16px;
        height: 44px;
        flex-shrink: 0;
        white-space: nowrap;
        background: linear-gradient(135deg, var(--primary-accent), var(--primary-light));
        color: #ffffff;
        border: none;
        border-radius: var(--radius-md);
        font-family: inherit;
        font-size: 14px;
        font-weight: 700;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
        cursor: pointer;
        transition: transform 0.28s var(--spring-bounce), background-color 0.2s ease, box-shadow 0.2s ease;
        box-shadow: var(--shadow-sm);
    }
    .btn-new-chat:hover {
        transform: translateY(-1px) scale(1.01);
        box-shadow: var(--shadow-md), var(--glow);
        background: linear-gradient(135deg, #255943, #367d5b);
    }
    .btn-new-chat:active {
        transform: translateY(0) scale(0.96);
        transition: transform 0.08s var(--spring-damped);
    }

    /* Sidebar Content Sections */
    .sidebar-content {
        flex: 1;
        overflow-y: auto;
        padding: 12px 14px;
        display: flex;
        flex-direction: column;
        gap: 20px;
    }

    .sidebar-section-title {
        font-size: 11px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        color: var(--text-muted);
        padding: 0 8px;
        margin-bottom: 8px;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .history-list {
        list-style: none;
        display: flex;
        flex-direction: column;
        gap: 4px;
    }

    .history-item {
        position: relative;
        border-radius: var(--radius-sm);
        transition: var(--transition-fast);
    }
    .history-item:hover {
        background-color: rgba(255, 255, 255, 0.05);
    }
    body.light-mode .history-item:hover {
        background-color: rgba(31, 74, 55, 0.06);
    }

    .history-item.active {
        background: rgba(31, 74, 55, 0.25);
        border-right: 3px solid var(--secondary-accent);
    }

    .history-restore-btn {
        width: 100%;
        background: transparent;
        border: none;
        color: var(--text-primary);
        padding: 9px 10px;
        text-align: right;
        font-family: inherit;
        font-size: 13px;
        cursor: pointer;
        display: flex;
        align-items: center;
        gap: 10px;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
    }

    .history-title {
        flex: 1;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .history-date {
        font-size: 10px;
        color: var(--text-muted);
        flex-shrink: 0;
    }

    .history-delete-btn {
        position: absolute;
        left: 6px;
        top: 50%;
        transform: translateY(-50%);
        background: transparent;
        border: none;
        color: var(--text-muted);
        opacity: 0;
        padding: 4px 6px;
        border-radius: 4px;
        cursor: pointer;
        transition: var(--transition-fast);
    }
    .history-item:hover .history-delete-btn {
        opacity: 1;
    }
    .history-delete-btn:hover {
        color: #ff6b6b;
        background: rgba(255, 107, 107, 0.1);
    }

    .history-clear-all {
        padding: 4px 8px;
        margin-bottom: 4px;
    }
    .history-clear-btn {
        background: transparent;
        border: none;
        color: var(--text-muted);
        font-size: 11px;
        font-family: inherit;
        cursor: pointer;
        display: flex;
        align-items: center;
        gap: 6px;
        transition: var(--transition-fast);
    }
    .history-clear-btn:hover {
        color: #ff6b6b;
    }

    /* Last Month Offices List in Sidebar */
    .offices-list {
        list-style: none;
        display: flex;
        flex-direction: column;
        gap: 6px;
    }

    .office-item {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 8px 10px;
        background: rgba(255, 255, 255, 0.03);
        border: 1px solid var(--border-color);
        border-radius: var(--radius-sm);
        font-size: 12px;
        transition: var(--transition-fast);
    }
    body.light-mode .office-item {
        background: rgba(255, 255, 255, 0.6);
    }
    .office-item:hover {
        border-color: var(--primary-light);
        transform: translateX(-2px);
    }
    .office-name {
        font-weight: 600;
        color: var(--text-primary);
    }
    .office-badge {
        font-size: 10px;
        padding: 2px 8px;
        border-radius: var(--radius-full);
        background: rgba(198, 162, 82, 0.15);
        color: var(--secondary-accent);
        border: 1px solid rgba(198, 162, 82, 0.3);
    }

    /* Sidebar Footer */
    .sidebar-footer {
        padding: 14px 18px;
        border-top: 1px solid var(--sidebar-border);
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .sidebar-admin-btn {
        width: 100%;
        height: 38px;
        flex-shrink: 0;
        white-space: nowrap;
        padding: 9px 14px;
        background: rgba(198, 162, 82, 0.15);
        border: 1px solid rgba(198, 162, 82, 0.4);
        border-radius: var(--radius-sm);
        color: #c6a252;
        font-size: 12px;
        font-weight: 700;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        text-decoration: none;
        transition: transform 0.28s var(--spring-damped), background-color 0.2s;
    }
    .sidebar-admin-btn:hover {
        background: rgba(198, 162, 82, 0.25);
        transform: translateY(-1px);
    }
    .sidebar-admin-btn:active {
        transform: scale(0.96);
    }

    .sidebar-user-card {
        width: 100%;
        height: 42px;
        flex-shrink: 0;
        white-space: nowrap;
        padding: 4px 12px;
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid var(--border-color);
        border-radius: var(--radius-sm);
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        transition: transform 0.28s var(--spring-damped), background-color 0.2s ease, border-color 0.2s ease;
    }
    body.light-mode .sidebar-user-card {
        background: rgba(31, 74, 55, 0.06);
        border-color: rgba(31, 74, 55, 0.15);
    }

    .sidebar-user-info {
        display: flex;
        align-items: center;
        gap: 8px;
        min-width: 0;
        flex: 1;
    }

    .theme-toggle-btn {
        width: 100%;
        height: 38px;
        flex-shrink: 0;
        white-space: nowrap;
        padding: 0 14px;
        background: rgba(255, 255, 255, 0.04);
        border: 1px solid var(--border-color);
        border-radius: var(--radius-sm);
        color: var(--text-secondary);
        font-family: inherit;
        font-size: 13px;
        font-weight: 600;
        display: flex;
        align-items: center;
        justify-content: space-between;
        cursor: pointer;
        transition: transform 0.28s var(--spring-damped), background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
    }
    #themeLabel {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .theme-toggle-btn:hover {
        background: rgba(255, 255, 255, 0.08);
        color: var(--text-primary);
        border-color: var(--secondary-accent);
    }
    .theme-toggle-btn:active {
        transform: scale(0.96);
        transition: transform 0.08s var(--spring-damped);
    }

    .developer-contact-btn {
        width: 100%;
        height: 38px;
        flex-shrink: 0;
        white-space: nowrap;
        padding: 0 14px;
        background: rgba(37, 211, 102, 0.12);
        border: 1px solid rgba(37, 211, 102, 0.35);
        border-radius: var(--radius-sm);
        color: #25D366;
        font-size: 12px;
        font-weight: 700;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        text-decoration: none;
        transition: transform 0.28s var(--spring-damped), background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
    }
    body.light-mode .developer-contact-btn {
        background: rgba(37, 211, 102, 0.1);
        border-color: rgba(37, 211, 102, 0.4);
        color: #0e8544;
    }
    .developer-contact-btn:hover {
        background: rgba(37, 211, 102, 0.24);
        border-color: #25D366;
        color: #25D366;
        transform: translateY(-1px);
    }
    .developer-contact-btn:active {
        transform: scale(0.96);
        transition: transform 0.08s var(--spring-damped);
    }

    .archive-link-btn {
        width: 100%;
        height: 38px;
        flex-shrink: 0;
        white-space: nowrap;
        padding: 0 14px;
        background: rgba(198, 162, 82, 0.1);
        border: 1px solid rgba(198, 162, 82, 0.25);
        border-radius: var(--radius-sm);
        color: var(--secondary-accent);
        text-decoration: none;
        font-size: 12px;
        font-weight: 700;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        transition: transform 0.28s var(--spring-damped), background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
    }
    .archive-link-btn:hover {
        background: rgba(198, 162, 82, 0.2);
        transform: translateY(-1px);
    }
    .archive-link-btn:active {
        transform: scale(0.96);
        transition: transform 0.08s var(--spring-damped);
    }

    /* ═══════════════════════════════════════
       Layout: Main Content & Header
    ════════════════════════════════════════ */
    #mainContent {
        flex: 1;
        height: 100dvh;
        display: flex;
        flex-direction: column;
        position: relative;
        z-index: 10;
        min-width: 0;
    }

    .app-header {
        height: var(--header-height);
        padding: 0 24px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        border-bottom: 1px solid var(--border-color);
        background: rgba(8, 12, 10, 0.72);
        backdrop-filter: blur(20px) saturate(180%);
        -webkit-backdrop-filter: blur(20px) saturate(180%);
        z-index: 15;
        flex-shrink: 0;
    }
    body.light-mode .app-header {
        background: rgba(244, 247, 245, 0.85);
        backdrop-filter: blur(20px) saturate(180%);
        -webkit-backdrop-filter: blur(20px) saturate(180%);
    }

    .header-left {
        display: flex;
        align-items: center;
        gap: 14px;
    }

    #mobileMenuToggle {
        display: none;
        background: transparent;
        border: 1px solid var(--border-color);
        color: var(--text-primary);
        width: 38px;
        height: 38px;
        border-radius: var(--radius-sm);
        align-items: center;
        justify-content: center;
        font-size: 16px;
        cursor: pointer;
        transition: transform 0.28s var(--spring-damped), border-color 0.2s;
        transform-origin: center;
    }
    #mobileMenuToggle:hover { border-color: var(--primary-light); color: var(--primary-light); }
    #mobileMenuToggle:active { transform: scale(0.94); transition: transform 0.08s var(--spring-damped); }

    .header-logo-wrap {
        width: 42px;
        height: 42px;
        border-radius: 12px;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0;
        box-shadow: 0 4px 12px rgba(31, 74, 55, 0.15);
        flex-shrink: 0;
        overflow: hidden;
    }
    .header-logo-wrap img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.25); border-radius: 9999px; }

    .header-title { min-width: 0; }
    .header-title h2 {
        font-size: 18px;
        font-weight: 800;
        color: var(--text-primary);
        line-height: 1.2;
        letter-spacing: -0.015em;
        font-optical-sizing: auto;
    }
    .header-title p {
        font-size: 12px;
        color: var(--text-muted);
    }

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

    .icon-btn {
        display: flex;
        align-items: center;
        gap: 6px;
        padding: 8px 14px;
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid var(--border-color);
        border-radius: var(--radius-sm);
        color: var(--text-secondary);
        font-family: inherit;
        font-size: 12px;
        font-weight: 600;
        cursor: pointer;
        text-decoration: none;
        transition: transform 0.28s var(--spring-damped), background-color 0.2s, border-color 0.2s, color 0.2s;
        transform-origin: center;
    }
    .icon-btn:hover {
        background: rgba(255, 255, 255, 0.1);
        color: var(--text-primary);
        border-color: var(--primary-light);
    }
    .icon-btn:active {
        transform: scale(0.95);
        transition: transform 0.08s var(--spring-damped);
    }

    /* User Profile Card & Controls in Header */
    .user-profile-btn {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 4px 10px 4px 6px;
        background: rgba(255, 255, 255, 0.06);
        border: 1px solid var(--border-color);
        border-radius: 30px;
        height: 36px;
        transition: var(--transition-fast);
    }
    body.light-mode .user-profile-btn {
        background: rgba(31, 74, 55, 0.06);
        border-color: rgba(31, 74, 55, 0.15);
    }

    #userAvatarWrap {
        width: 28px;
        height: 28px;
        border-radius: 50%;
        overflow: hidden;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        background: var(--primary-dark, #1F4A37);
        color: #fff;
        font-size: 16px;
    }

    .user-avatar {
        width: 100% !important;
        height: 100% !important;
        max-width: 28px !important;
        max-height: 28px !important;
        object-fit: cover !important;
        border-radius: 50% !important;
        display: block !important;
    }

    .user-name-label {
        font-size: 12px;
        font-weight: 600;
        color: var(--text-primary);
        max-width: 110px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .btn-signout {
        background: none;
        border: none;
        color: var(--text-muted);
        cursor: pointer;
        font-size: 13px;
        padding: 3px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        transition: color 0.2s ease, background-color 0.2s ease;
    }
    .btn-signout:hover {
        color: #ef4444;
        background: rgba(239, 68, 68, 0.1);
    }

    /* ═══════════════════════════════════════
       Layout: Chat Log Area
    ════════════════════════════════════════ */
    .chat-log-container {
        flex: 1;
        overflow-y: auto;
        position: relative;
        display: flex;
        flex-direction: column;
    }

    .welcome-screen {
        margin: auto;
        max-width: 720px;
        padding: 40px 24px;
        text-align: center;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 24px;
        animation: fadeIn 0.5s ease;
    }

    .welcome-badge {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        padding: 6px 16px;
        background: rgba(198, 162, 82, 0.12);
        border: 1px solid rgba(198, 162, 82, 0.3);
        border-radius: var(--radius-full);
        color: var(--secondary-accent);
        font-size: 12px;
        font-weight: 700;
    }

    .welcome-screen h3 {
        font-size: 1.8rem;
        font-weight: 800;
        color: var(--text-primary);
        line-height: 1.18;
        letter-spacing: -0.025em;
        font-optical-sizing: auto;
    }
    .welcome-screen h3 span {
        color: var(--secondary-accent);
    }

    .welcome-notice {
        font-size: 0.92rem;
        color: var(--text-secondary);
        max-width: 580px;
        line-height: 1.65;
        background: rgba(31, 74, 55, 0.15);
        border: 1px solid rgba(31, 74, 55, 0.3);
        padding: 14px 20px;
        border-radius: var(--radius-md);
        backdrop-filter: blur(12px) saturate(140%);
        -webkit-backdrop-filter: blur(12px) saturate(140%);
    }

    /* Welcome Screen Chart Card */
    .welcome-chart-card {
        width: 100%;
        background: var(--card-bg);
        border: 1px solid var(--border-color);
        border-radius: var(--radius-lg);
        padding: 16px;
        margin: 14px 0 18px 0;
        box-shadow: var(--shadow-sm);
        backdrop-filter: blur(16px) saturate(160%);
        -webkit-backdrop-filter: blur(16px) saturate(160%);
        transition: all 0.3s ease;
    }
    .welcome-chart-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 12px;
    }
    .welcome-chart-title {
        display: flex;
        align-items: center;
        gap: 8px;
        font-size: 0.92rem;
        font-weight: 700;
        color: var(--text-primary);
    }
    .welcome-chart-toggle {
        background: transparent;
        border: 1px solid var(--border-color);
        border-radius: var(--radius-sm);
        color: var(--text-muted);
        padding: 4px 10px;
        font-size: 0.8rem;
        cursor: pointer;
        display: flex;
        align-items: center;
        gap: 4px;
        transition: all 0.2s ease;
    }
    .welcome-chart-toggle:hover {
        border-color: var(--secondary-accent);
        color: var(--secondary-accent);
    }
    .welcome-chart-body {
        transition: max-height 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
        overflow: hidden;
        max-height: 300px;
    }
    .welcome-chart-body.collapsed {
        max-height: 0 !important;
        opacity: 0;
        margin-top: 0;
    }

    /* Suggestion Prompt Cards Grid */
    .suggestions-grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
        gap: 12px;
        width: 100%;
        margin-top: 8px;
    }

    .prompt-card {
        background: var(--card-bg);
        border: 1px solid var(--border-color);
        padding: 16px;
        border-radius: var(--radius-md);
        text-align: right;
        cursor: pointer;
        transition: transform 0.32s var(--spring-bounce), background-color 0.2s, border-color 0.2s, box-shadow 0.2s;
        transform-origin: center;
        display: flex;
        flex-direction: column;
        gap: 8px;
        backdrop-filter: blur(14px) saturate(160%);
        -webkit-backdrop-filter: blur(14px) saturate(160%);
    }
    .prompt-card:hover {
        transform: translateY(-2px) scale(1.015);
        border-color: var(--secondary-accent);
        box-shadow: var(--shadow-md);
        background: rgba(31, 74, 55, 0.22);
    }
    .prompt-card:active {
        transform: translateY(0) scale(0.96);
        transition: transform 0.08s var(--spring-damped);
    }
    .prompt-card i {
        font-size: 18px;
        color: var(--secondary-accent);
    }
    .prompt-card p {
        font-size: 13px;
        font-weight: 600;
        color: var(--text-primary);
        line-height: 1.4;
    }

    /* Actual Chat Messages */
    .chat-log {
        max-width: 860px;
        width: 100%;
        margin: 0 auto;
        padding: 24px;
        display: flex;
        flex-direction: column;
        gap: 20px;
    }

    .message-row {
        display: flex;
        gap: 14px;
        width: 100%;
        animation: messageSlideIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    }

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

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

    .avatar {
        width: 36px;
        height: 36px;
        border-radius: 10px;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        font-size: 14px;
    }
    .message-row.user .avatar {
        background: linear-gradient(135deg, var(--secondary-accent), #a8853b);
        color: #0c1813;
    }
    .message-row.assistant .avatar {
        background: linear-gradient(135deg, var(--primary-accent), var(--primary-light));
        color: #ffffff;
        box-shadow: var(--shadow-sm);
    }

    .bubble-wrapper {
        display: flex;
        flex-direction: column;
        gap: 6px;
        max-width: 82%;
    }

    .message-bubble {
        padding: 14px 18px;
        border-radius: var(--radius-md);
        font-size: 14px;
        line-height: 1.7;
        word-break: break-word;
    }

    .message-row.user .message-bubble {
        background-color: var(--user-bubble);
        color: var(--text-primary);
        border: 1px solid rgba(198, 162, 82, 0.2);
        border-top-left-radius: 4px;
    }

    .message-row.assistant .message-bubble {
        background-color: var(--assistant-bubble);
        color: var(--text-primary);
        border: 1px solid var(--border-color);
        border-top-right-radius: 4px;
        box-shadow: var(--shadow-sm);
    }

    /* Markdown Formatted Content Styles inside Assistant Bubbles */
    .message-bubble p {
        margin-bottom: 10px;
    }
    .message-bubble p:last-child {
        margin-bottom: 0;
    }
    .message-bubble strong {
        color: var(--secondary-accent);
        font-weight: 700;
    }
    .message-bubble ul, .message-bubble ol {
        margin: 10px 0;
        padding-right: 20px;
    }
    .message-bubble li {
        margin-bottom: 6px;
    }

    /* Citations Dropdown Component */
    .citations-container {
        margin-top: 8px;
        background: rgba(0, 0, 0, 0.25);
        border: 1px solid var(--border-color);
        border-radius: var(--radius-sm);
        overflow: hidden;
    }

    .citations-header {
        padding: 8px 12px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        cursor: pointer;
        background: rgba(255, 255, 255, 0.02);
        transition: var(--transition-fast);
    }
    .citations-header:hover {
        background: rgba(255, 255, 255, 0.05);
    }
    .citations-title {
        font-size: 11px;
        font-weight: 700;
        color: var(--secondary-accent);
        display: flex;
        align-items: center;
        gap: 6px;
    }
    .citations-arrow {
        font-size: 10px;
        color: var(--text-muted);
        transition: transform var(--transition-fast);
    }
    .citations-container.open .citations-arrow {
        transform: rotate(180deg);
    }

    .citations-content {
        display: none;
        padding: 10px 12px;
        border-top: 1px solid var(--border-color);
        flex-direction: column;
        gap: 6px;
    }
    .citations-container.open .citations-content {
        display: flex;
    }

    .citation-link-item {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 6px 10px;
        background: rgba(31, 74, 55, 0.15);
        border: 1px solid rgba(31, 74, 55, 0.3);
        border-radius: 6px;
        color: #4eac7a;
        text-decoration: none;
        font-size: 11px;
        font-weight: 600;
        transition: var(--transition-fast);
    }
    .citation-link-item:hover {
        background: rgba(31, 74, 55, 0.3);
        color: #6edb9f;
    }

    /* Typing Loader Dots */
    .typing-indicator {
        display: flex;
        align-items: center;
        gap: 6px;
        padding: 4px 0;
    }
    .typing-dot {
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background-color: var(--secondary-accent);
        animation: typingBounce 1.4s infinite ease-in-out both;
    }
    .typing-dot:nth-child(1) { animation-delay: -0.32s; }
    .typing-dot:nth-child(2) { animation-delay: -0.16s; }
    @keyframes typingBounce {
        0%, 80%, 100% { transform: scale(0); opacity: 0.3; }
        40% { transform: scale(1); opacity: 1; }
    }

    /* ═══════════════════════════════════════
       Layout: Input Area
    ════════════════════════════════════════ */
    .input-outer {
        max-width: 860px;
        width: 100%;
        margin: 0 auto;
        padding: 0 24px 20px 24px;
        flex-shrink: 0;
    }

    .input-box-wrapper {
        background: rgba(20, 32, 26, 0.72);
        border: 1px solid rgba(255, 255, 255, 0.12);
        border-radius: var(--radius-lg);
        padding: 8px 12px 8px 16px;
        display: flex;
        align-items: flex-end;
        gap: 10px;
        box-shadow: 0 12px 36px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.1);
        backdrop-filter: blur(24px) saturate(180%);
        -webkit-backdrop-filter: blur(24px) saturate(180%);
        transition: transform 0.28s var(--spring-damped), border-color 0.2s, box-shadow 0.2s;
    }
    body.light-mode .input-box-wrapper {
        background: rgba(255, 255, 255, 0.88);
        border-color: rgba(31, 74, 55, 0.18);
        box-shadow: 0 12px 36px rgba(0, 0, 0, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.8);
    }
    .input-box-wrapper:focus-within {
        border-color: var(--secondary-accent);
        box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45), var(--glow);
    }

    .chat-textarea {
        flex: 1;
        background: transparent;
        border: none;
        color: var(--text-primary);
        font-family: inherit;
        font-size: 14px;
        line-height: 1.5;
        resize: none;
        max-height: 160px;
        min-height: 44px;
        padding: 10px 4px;
        outline: none;
    }
    .chat-textarea::placeholder {
        color: var(--text-muted);
    }

    .submit-btn {
        width: 42px;
        height: 42px;
        border-radius: var(--radius-md);
        background: linear-gradient(135deg, var(--secondary-accent), #aa853b);
        color: #0c1813;
        border: none;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 16px;
        cursor: pointer;
        flex-shrink: 0;
        transition: transform 0.28s var(--spring-bounce), background-color 0.2s, box-shadow 0.2s;
        transform-origin: center;
    }
    .submit-btn:hover:not(:disabled) {
        transform: scale(1.04);
        box-shadow: 0 4px 14px rgba(198, 162, 82, 0.35);
    }
    .submit-btn:active:not(:disabled) {
        transform: scale(0.92);
        transition: transform 0.08s var(--spring-damped);
    }
        transform: scale(1.05);
        background: linear-gradient(135deg, #d8b463, var(--secondary-accent));
        box-shadow: 0 4px 14px rgba(198, 162, 82, 0.4);
    }
    .submit-btn:disabled {
        opacity: 0.4;
        cursor: not-allowed;
    }

    .input-footer-note {
        text-align: center;
        font-size: 11px;
        color: var(--text-muted);
        margin-top: 8px;
    }

    /* ═══════════════════════════════════════
       Toast & Overlays
    ════════════════════════════════════════ */
    .toast {
        position: fixed;
        bottom: 80px;
        left: 50%;
        transform: translateX(-50%);
        background: rgba(220, 53, 69, 0.9);
        color: #ffffff;
        padding: 10px 20px;
        border-radius: var(--radius-full);
        font-size: 13px;
        font-weight: 600;
        display: none;
        align-items: center;
        gap: 8px;
        box-shadow: var(--shadow-md);
        z-index: 100;
        backdrop-filter: blur(8px);
    }

    .sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.6);
        backdrop-filter: blur(4px);
        z-index: 18;
        display: none;
    }

    /* Loading Overlay */
    #loadingOverlay {
        position: fixed;
        inset: 0;
        background: var(--bg-color);
        z-index: 999;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 16px;
        transition: opacity 0.5s ease;
    }
    .spinner {
        width: 44px;
        height: 44px;
        border: 3px solid rgba(198, 162, 82, 0.2);
        border-top-color: var(--secondary-accent);
        border-radius: 50%;
        animation: spin 1s infinite linear;
    }
    @keyframes spin {
        0% { transform: rotate(0deg); }
        100% { transform: rotate(360deg); }
    }

    /* ═══════════════════════════════════════
       § Mobile Responsiveness — ≤768px
       ═══════════════════════════════════════ */
    @media (max-width: 768px) {
        body {
            flex-direction: column;
            overflow: hidden;
        }

        #appSidebar {
            position: fixed;
            top: 0;
            right: -100%;
            width: min(var(--sidebar-width), 88vw);
            height: 100dvh;
            border-left: none;
            border-right: 1px solid var(--sidebar-border);
            transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
            box-shadow: -4px 0 30px rgba(0,0,0,0.4);
        }
        #appSidebar.sidebar-open { right: 0; }

        #mobileMenuToggle { display: flex; }

        #mainContent {
            width: 100%;
            height: 100dvh;
            flex: none;
        }

        .chat-log { padding: 16px 14px; gap: 16px; }
        .bubble-wrapper { max-width: 90%; }

        .input-outer { padding: 0 12px 16px 12px; }

        .header-title p { display: none; }
        .header-logo-wrap,
        .header-logo-wrap *,
        .dash-brand img { display: none !important; }

        .source-badges-row { gap: 4px; }
        .source-badge { font-size: 10px; padding: 3px 8px; }
    }

    @media (max-width: 400px) {
        .welcome-screen h3 { font-size: 1.2rem; }
        .welcome-notice { font-size: 0.82rem; }
    }

    /* ═══════════════════════════════════════
       Connection Status Dot Indicator (Render Wakeup / Keep-Alive)
    ════════════════════════════════════════ */
    .title-with-status {
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .connection-status {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        padding: 3px 8px;
        border-radius: 12px;
        font-size: 11px;
        font-weight: 600;
        transition: all 0.3s ease;
    }

    .connection-status.connecting {
        background: rgba(217, 119, 6, 0.15);
        color: #d97706;
        border: 1px solid rgba(217, 119, 6, 0.3);
    }
    .connection-status.connecting .status-dot {
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background-color: #f59e0b;
        box-shadow: 0 0 8px #f59e0b;
        animation: statusPulseOrange 1.5s infinite ease-in-out;
    }
    .connection-status.connecting .status-text {
        display: inline;
    }

    .connection-status.connected {
        background: transparent;
        border: none;
        padding: 2px;
    }
    .connection-status.connected .status-dot {
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background-color: #10b981;
        box-shadow: 0 0 8px #10b981;
    }
    .connection-status.connected .status-text {
        display: none !important;
    }

    .connection-status.offline {
        background: rgba(220, 38, 38, 0.15);
        color: #ef4444;
        border: 1px solid rgba(220, 38, 38, 0.3);
    }
    .connection-status.offline .status-dot {
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background-color: #ef4444;
    }
    .connection-status.offline .status-text {
        display: inline;
    }

    @keyframes statusPulseOrange {
        0% { transform: scale(0.9); opacity: 0.7; }
        50% { transform: scale(1.2); opacity: 1; }
        100% { transform: scale(0.9); opacity: 0.7; }
    }

    /* ═══════════════════════════════════════
       Auth Overlay — شاشة تسجيل الدخول
    ════════════════════════════════════════ */
    #authOverlay {
        position: fixed;
        inset: 0;
        z-index: 9999;
        background: rgba(10, 18, 12, 0.92);
        backdrop-filter: blur(18px);
        -webkit-backdrop-filter: blur(18px);
        display: flex;
        align-items: center;
        justify-content: center;
        opacity: 1;
        transition: opacity 0.4s ease;
    }
    #authOverlay.hidden {
        opacity: 0;
        pointer-events: none;
    }

    .auth-card {
        background: linear-gradient(145deg, rgba(20, 35, 24, 0.98), rgba(12, 22, 15, 0.98));
        border: 1px solid rgba(74, 144, 80, 0.3);
        border-radius: 20px;
        padding: 48px 40px;
        width: 90%;
        max-width: 420px;
        text-align: center;
        box-shadow:
            0 32px 80px rgba(0, 0, 0, 0.6),
            0 0 0 1px rgba(74, 144, 80, 0.1) inset;
        animation: authCardIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    }

    body.light-mode .auth-card {
        background: linear-gradient(145deg, rgba(255, 255, 255, 0.98), rgba(240, 245, 242, 0.98));
        border: 1px solid rgba(31, 74, 55, 0.2);
        box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
    }

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

    .auth-logo {
        width: 70px;
        height: 70px;
        margin: 0 auto 24px;
        background: linear-gradient(135deg, #1F4A37, #2d6e45);
        border-radius: 18px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 30px;
        color: #fff;
        box-shadow: 0 8px 24px rgba(31, 74, 55, 0.5);
    }

    .auth-logo img {
        width: 52px;
        height: 52px;
        object-fit: contain;
    }

    .auth-card h2 {
        font-family: 'Cairo', sans-serif;
        font-size: 24px;
        font-weight: 700;
        color: #e8f5e9;
        margin: 0 0 8px;
    }

    body.light-mode .auth-card h2 {
        color: #1F4A37;
    }

    .auth-card p {
        font-size: 13px;
        color: rgba(232, 245, 233, 0.7);
        margin: 0 0 32px;
        line-height: 1.6;
    }

    body.light-mode .auth-card p {
        color: #555;
    }

    #googleSignInBtn {
        width: 100%;
        padding: 14px 20px;
        background: #ffffff;
        color: #3c4043;
        border: 1px solid #dadce0;
        border-radius: 12px;
        font-family: 'Cairo', sans-serif;
        font-size: 15px;
        font-weight: 600;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 12px;
        transition: all 0.2s ease;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    }

    #googleSignInBtn:hover {
        background: #f8f9fa;
        border-color: #d2e3fc;
        box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
        transform: translateY(-1px);
    }

    .google-icon {
        width: 20px;
        height: 20px;
        flex-shrink: 0;
    }

    .auth-status-message {
        margin-top: 14px;
        font-size: 12px;
        color: var(--gold-accent, #e5c158);
        display: none;
    }

    .auth-divider {
        height: 1px;
        background: rgba(255, 255, 255, 0.1);
        margin: 28px 0 20px;
    }

    body.light-mode .auth-divider {
        background: rgba(0, 0, 0, 0.1);
    }

    .auth-note {
        font-size: 11px !important;
        color: rgba(232, 245, 233, 0.5) !important;
        margin: 0 !important;
    }

    body.light-mode .auth-note {
        color: #777 !important;
    }

    /* ═══════════════════════════════════════
       Apple Design Accessibility Rules
    ════════════════════════════════════════ */
    @media (prefers-reduced-motion: reduce) {
        *, *::before, *::after {
            animation-duration: 0.01ms !important;
            animation-iteration-count: 1 !important;
            transition-duration: 0.01ms !important;
            scroll-behavior: auto !important;
        }

        .prompt-card:hover, .prompt-card:active,
        .icon-btn:active, .submit-btn:active,
        .btn-new-chat:active, #mobileMenuToggle:active {
            transform: none !important;
        }
    }

    @media (prefers-reduced-transparency: reduce) {
        .app-header, body.light-mode .app-header {
            background: #080c0a !important;
            backdrop-filter: none !important;
            -webkit-backdrop-filter: none !important;
        }
        body.light-mode .app-header {
            background: #f4f7f5 !important;
        }

        .input-box-wrapper, body.light-mode .input-box-wrapper {
            background: #14201a !important;
            backdrop-filter: none !important;
            -webkit-backdrop-filter: none !important;
        }
        body.light-mode .input-box-wrapper {
            background: #ffffff !important;
        }

        #authOverlay, #pendingApprovalOverlay {
            background: #080c0a !important;
            backdrop-filter: none !important;
            -webkit-backdrop-filter: none !important;
        }
        body.light-mode #authOverlay, body.light-mode #pendingApprovalOverlay {
            background: #f4f7f5 !important;
        }
    }
