/* ============================================================
   WELLNESS ORACLE — UPGRADED UI (Claude-inspired)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=DM+Serif+Display:ital@0;1&display=swap');

:root {
    --color-primary: #20a898;
    --color-primary-dark: #1a8a7a;
    --color-primary-light: rgba(32,168,152,0.12);
    --color-bg: #ffffff;
    --color-sidebar: #f5f5f0;
    --color-surface: #ffffff;
    --color-text: #1a1a1a;
    --color-text-secondary: #6b7280;
    --color-border: #e5e5e0;
    --color-hover: #f0f0ea;
    --color-danger: #dc2626;
    --color-oracle-bubble: #f7f7f5;
    --color-user-bubble: #20a898;
    --sidebar-width: 272px;
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-xl: 24px;
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --chat-font-size: 15px;
    --app-height: 100dvh;
    --keyboard-offset: 0px;
    --bottom-input-height: 0px;
}

.dark-mode {
    --color-bg: #1a1a1a;
    --color-sidebar: #111111;
    --color-surface: #242424;
    --color-text: #ececec;
    --color-text-secondary: #9ca3af;
    --color-border: #2e2e2e;
    --color-hover: #2a2a2a;
    --color-oracle-bubble: #242424;
}

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

body {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    height: var(--app-height);
    overflow: hidden;
    transition: background var(--transition), color var(--transition);
    -webkit-font-smoothing: antialiased;
    overscroll-behavior: none;
}

body.auth-page-scroll {
    height: auto !important;
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior: auto;
}

body.auth-page-scroll .app-container {
    height: auto !important;
    min-height: 100vh;
    min-height: 100dvh;
    overflow: visible !important;
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--color-text-secondary); }

/* ── ICONS ── */
.icon { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.icon-sm { width: 15px; height: 15px; }
.icon-lg { width: 22px; height: 22px; }

/* ── APP LAYOUT ── */
.app-container { display: flex; height: var(--app-height); position: relative; overflow: hidden; }

button,
[role="button"],
.chip,
.chat-history-item,
.chat-history-item-body,
.user-profile-card,
.attach-option,
.theme-option,
.settings-nav-btn {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

/* ── OVERLAY ── */
.sidebar-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,0.45); backdrop-filter: blur(2px);
    z-index: 998; opacity: 0; transition: opacity var(--transition);
}
.sidebar-overlay.active { display: block; opacity: 1; }

/* ═══════════════════════════════════════════
   SIDEBAR
═══════════════════════════════════════════ */
.sidebar {
    width: var(--sidebar-width);
    background: var(--color-sidebar);
    border-right: 1px solid var(--color-border);
    display: flex; flex-direction: column;
    transition: transform 0.3s cubic-bezier(0.4,0,0.2,1), width 0.3s cubic-bezier(0.4,0,0.2,1), min-width 0.3s cubic-bezier(0.4,0,0.2,1), border 0.3s;
    z-index: 999; height: var(--app-height);
    overflow: hidden; flex-shrink: 0;
}

/* Header */
.sidebar-header { padding: 16px; border-bottom: 1px solid var(--color-border); flex-shrink: 0; }

.logo-section { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.logo-content { display: flex; align-items: center; gap: 10px; text-decoration: none; }

.logo-icon {
    width: 36px; height: 36px; border-radius: 10px;
    background: linear-gradient(135deg, #003d7a, #20a898);
    display: flex; align-items: center; justify-content: center;
    overflow: hidden; flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(32,168,152,0.3);
}
.sidebar-logo { width: 100%; height: 100%; object-fit: cover; border-radius: 10px; }

.brand-title {
    font-size: 15px; font-weight: 600; color: var(--color-text);
    letter-spacing: -0.2px; line-height: 1.2;
}
.brand-text span { font-size: 11px; color: var(--color-text-secondary); font-weight: 400; }

.close-sidebar-btn {
    display: flex; background: none; border: none; cursor: pointer;
    padding: 6px; color: var(--color-text-secondary); border-radius: var(--radius-sm);
    transition: background var(--transition), color var(--transition);
    align-items: center; justify-content: center;
}
.close-sidebar-btn:hover { background: var(--color-hover); color: var(--color-text); }

/* New Chat Button */
.new-chat-btn {
    width: 100%; padding: 10px 14px;
    background: var(--color-primary); color: white; border: none;
    border-radius: var(--radius-md); font-size: 13.5px; font-weight: 500;
    cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 7px;
    transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
    font-family: inherit;
}
.new-chat-btn:hover { background: var(--color-primary-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(32,168,152,0.3); }
.new-chat-btn:active { transform: translateY(0); }

.apps-directory-btn {
    width: 100%;
    margin-top: 10px;
    padding: 10px 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    color: var(--color-text);
    font-size: 13.5px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    transition: transform var(--transition), border-color var(--transition), background var(--transition), box-shadow var(--transition);
}
.apps-directory-btn:hover {
    transform: translateY(-1px);
    border-color: rgba(32,168,152,0.3);
    background: rgba(32,168,152,0.06);
    box-shadow: 0 8px 20px rgba(32,168,152,0.08);
}

/* ── AUTH SECTION ── */
.auth-section { padding: 12px 16px; border-bottom: 1px solid var(--color-border); flex-shrink: 0; }
.auth-buttons { display: flex; gap: 8px; }

.login-btn, .signup-btn {
    flex: 1; padding: 9px; border-radius: var(--radius-sm);
    font-size: 13px; cursor: pointer; transition: all var(--transition);
    font-family: inherit; font-weight: 500;
}
.login-btn { background: var(--color-surface); color: var(--color-text); border: 1px solid var(--color-border); }
.login-btn:hover { background: var(--color-hover); border-color: var(--color-text-secondary); }
.signup-btn { background: var(--color-primary); color: white; border: 1px solid var(--color-primary); }
.signup-btn:hover { background: var(--color-primary-dark); }

/* ── USER SECTION ── */
/* user-section moved to sidebar-footer — see bottom of file */

.user-info { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.user-avatar {
    width: 38px; height: 38px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    color: white; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: 14px; flex-shrink: 0; letter-spacing: 0.5px;
}
.user-details { flex: 1; min-width: 0; }
.user-name { font-size: 13.5px; font-weight: 600; color: var(--color-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-email { font-size: 11px; color: var(--color-text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 1px; }

.user-actions { display: flex; flex-direction: column; gap: 5px; }
.user-action-btn {
    width: 100%; padding: 8px 10px; background: transparent;
    border: 1px solid var(--color-border); border-radius: var(--radius-sm);
    font-size: 12.5px; cursor: pointer; display: flex; align-items: center; gap: 7px;
    color: var(--color-text); transition: all var(--transition); font-family: inherit;
}
.user-action-btn:hover { background: var(--color-hover); }
.delete-account-btn { color: var(--color-danger); border-color: transparent; }
.delete-account-btn:hover { background: rgba(220,38,38,0.08); border-color: rgba(220,38,38,0.2); }

/* ── SIDEBAR CONTENT (history) ── */
.sidebar-content { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 14px 12px; min-height: 0; }
.section-title { font-size: 11px; font-weight: 600; color: var(--color-text-secondary); text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 10px; padding: 0 4px; }
.chat-history { display: flex; flex-direction: column; gap: 2px; }

.empty-history {
    text-align: center; color: var(--color-text-secondary); font-size: 13px;
    padding: 28px 12px; border: 1px dashed var(--color-border);
    border-radius: var(--radius-md); background: var(--color-hover); line-height: 1.5;
}

.chat-history-item {
    display: flex; align-items: center; gap: 4px;
    border-radius: var(--radius-sm); cursor: pointer; transition: all var(--transition);
    color: var(--color-text); overflow: hidden;
    border: 1px solid transparent;
}
.chat-history-item:hover { background: var(--color-hover); border-color: var(--color-border); }
.chat-history-item.active { background: var(--color-primary-light); border-color: rgba(32,168,152,0.25); }
.chat-history-item.is-temporary { border-style: dashed; }

.chat-history-item-body { flex: 1; min-width: 0; padding: 9px 8px; }
.chat-title { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-bottom: 2px; }
.chat-history-item.active .chat-title { color: var(--color-primary-dark); font-weight: 600; }
.chat-meta { font-size: 11px; color: var(--color-text-secondary); }
.chat-temp-badge {
    display: inline-flex;
    align-items: center;
    margin-left: 6px;
    padding: 2px 6px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #9a3412;
    background: rgba(251, 146, 60, 0.16);
    vertical-align: middle;
}

.chat-delete-btn {
    flex-shrink: 0; width: 26px; height: 26px; margin-right: 5px;
    display: flex; align-items: center; justify-content: center;
    background: none; border: none; border-radius: var(--radius-sm);
    color: var(--color-danger); cursor: pointer; opacity: 0; transition: opacity var(--transition), background var(--transition);
}
.chat-history-item:hover .chat-delete-btn { opacity: 1; }
.chat-delete-btn:hover { background: rgba(220,38,38,0.1); }
@media (hover: none) and (pointer: coarse) { .chat-delete-btn { opacity: 1; } }

/* ── SIDEBAR COLLAPSED (desktop) ── */
.app-container.sidebar-collapsed .sidebar {
    transform: translateX(calc(-1 * var(--sidebar-width)));
    width: 0;
    min-width: 0;
    overflow: hidden;
    border-right: none;
}
.app-container.sidebar-collapsed .main-content {
    margin-left: 0;
}

/* ── SIDEBAR SEARCH ── */
.sidebar-search-row {
    padding: 0 0 10px 0;
}
.sidebar-search-wrap {
    display: flex; align-items: center;
    background: var(--color-surface);
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 7px 10px; gap: 7px;
    transition: border-color var(--transition), box-shadow var(--transition);
    cursor: text;
}
.sidebar-search-wrap:focus-within {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(32,168,152,0.1);
    outline: none;
}
.sidebar-search-icon {
    width: 14px; height: 14px; flex-shrink: 0;
    color: var(--color-text-secondary); stroke-width: 2;
}
.sidebar-search-input {
    flex: 1; border: none; background: transparent;
    font-size: 12.5px; color: var(--color-text);
    font-family: inherit; outline: none; min-width: 0;
    -webkit-appearance: none;
    appearance: none;
}
.sidebar-search-input::placeholder { color: var(--color-text-secondary); }
.sidebar-search-input:focus { outline: none; box-shadow: none; }
.sidebar-search-clear {
    background: none; border: none; cursor: pointer; padding: 1px;
    color: var(--color-text-secondary); display: flex; align-items: center;
    border-radius: 4px; transition: color var(--transition);
    flex-shrink: 0;
}
.sidebar-search-clear:hover { color: var(--color-text); }
.chat-history-item.search-hidden { display: none; }

/* Highlight matched text in search */
.chat-title mark {
    background: rgba(32,168,152,0.2);
    color: var(--color-primary-dark);
    border-radius: 2px; padding: 0 1px;
    font-weight: 600;
}


.sidebar-footer {
    padding: 10px 12px; border-top: 1px solid var(--color-border);
    flex-shrink: 0; background: var(--color-sidebar);
    padding-bottom: max(10px, env(safe-area-inset-bottom));
}
.action-btn {
    width: 100%; padding: 9px 10px; background: transparent;
    border: 1px solid transparent; border-radius: var(--radius-sm);
    font-size: 12.5px; cursor: pointer; display: flex; align-items: center; gap: 8px;
    color: var(--color-text-secondary); transition: all var(--transition); margin-bottom: 2px;
    font-family: inherit;
}
.action-btn:hover { background: var(--color-hover); color: var(--color-text); }
.action-btn.danger { color: var(--color-danger); }
.action-btn.danger:hover { background: rgba(220,38,38,0.08); }

/* ═══════════════════════════════════════════
   MAIN CONTENT
═══════════════════════════════════════════ */
.main-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; position: relative; min-width: 0; }

/* Top Bar */
.top-bar {
    padding: 12px 20px; border-bottom: 1px solid var(--color-border);
    background: var(--color-surface); display: flex; align-items: center;
    justify-content: space-between; flex-shrink: 0; z-index: 10;
    position: sticky;
    top: 0;
}
.top-bar-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.menu-btn {
    display: flex; background: none; border: none; cursor: pointer;
    padding: 7px; color: var(--color-text); border-radius: var(--radius-sm);
    transition: background var(--transition); flex-shrink: 0;
    align-items: center; justify-content: center;
}
.menu-btn:hover { background: var(--color-hover); }
.chat-title-main { font-size: 15px; font-weight: 600; color: var(--color-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.top-controls { display: flex; gap: 6px; flex-shrink: 0; }
.icon-btn {
    width: 36px; height: 36px; background: transparent; border: 1px solid var(--color-border);
    border-radius: var(--radius-sm); cursor: pointer; display: flex; align-items: center;
    justify-content: center; transition: all var(--transition); color: var(--color-text-secondary);
}
.icon-btn:hover { background: var(--color-hover); color: var(--color-text); }
.temporary-chat-btn {
    position: relative;
    overflow: hidden;
}
.temporary-chat-btn.is-active {
    border-color: rgba(194, 65, 12, 0.35);
    background: rgba(251, 146, 60, 0.14);
    color: #c2410c;
}
.temporary-chat-pulse {
    position: absolute;
    top: 7px;
    right: 7px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #f97316;
    box-shadow: 0 0 0 0 rgba(249, 115, 22, 0.45);
    opacity: 0;
    transform: scale(0.8);
}
.temporary-chat-btn.is-active .temporary-chat-pulse {
    opacity: 1;
    animation: temporaryPulse 1.8s ease-out infinite;
}

/* ── CHAT AREA ── */
.chat-area {
    flex: 1; overflow-y: auto; overflow-x: hidden;
    padding: 24px 20px; padding-bottom: 20px;
    display: flex; flex-direction: column;
    align-items: center;
    scroll-behavior: smooth;
}
.temporary-chat-banner {
    width: min(100%, 860px);
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin: 0 auto 18px;
    padding: 16px 18px;
    border-radius: 18px;
    border: 1px solid rgba(194, 65, 12, 0.18);
    background: linear-gradient(135deg, rgba(255, 237, 213, 0.92), rgba(255, 251, 235, 0.98));
    color: #9a3412;
    box-shadow: 0 12px 28px rgba(194, 65, 12, 0.08);
}
.temporary-chat-banner-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: rgba(249, 115, 22, 0.14);
}
.temporary-chat-banner-icon svg {
    width: 20px;
    height: 20px;
}
.temporary-chat-banner-body {
    min-width: 0;
}
.temporary-chat-banner-title {
    font-size: 14px;
    font-weight: 700;
    color: #7c2d12;
    margin-bottom: 4px;
}
.temporary-chat-banner-copy {
    margin: 0;
    font-size: 13px;
    line-height: 1.6;
    color: #9a3412;
}
.temporary-chat-banner-meta {
    margin-top: 8px;
    font-size: 12px;
    color: rgba(124, 45, 18, 0.82);
}

/* ── WELCOME SECTION (Home) ── */
.welcome-section {
    max-width: 680px; width: 100%; margin: auto;
    padding: 40px 0 20px;
    display: flex; flex-direction: column; align-items: center;
    animation: fadeInUp 0.5s ease both;
}

/* ── WELCOME INPUT (centered on homepage) ── */
.welcome-input-wrap {
    width: 100%; max-width: 640px;
    margin: 24px 0 20px;
}
.welcome-input-wrap .input-container {
    width: 100%;
}

.connected-apps-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.connected-app-chip,
.connected-app-empty {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 30px;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    line-height: 1;
}

.connected-app-chip {
    border: 1px solid color-mix(in srgb, var(--app-chip-color, #20a898) 30%, transparent);
    background: color-mix(in srgb, var(--app-chip-color, #20a898) 10%, transparent);
    color: var(--app-chip-color, var(--color-primary-dark));
    cursor: pointer;
    transition: transform var(--transition), background var(--transition), border-color var(--transition);
}

.connected-app-chip:hover {
    transform: translateY(-1px);
    background: color-mix(in srgb, var(--app-chip-color, #20a898) 16%, transparent);
    border-color: color-mix(in srgb, var(--app-chip-color, #20a898) 44%, transparent);
}

.connected-app-chip .app-at {
    font-weight: 700;
}

.connected-app-empty {
    border: 1px dashed var(--color-border);
    color: var(--color-text-secondary);
    background: var(--color-hover);
}

/* Smooth transition when input moves to bottom */
.input-container {
    transition: none;
}

/* Bottom input-area (after first message) */
#bottomInputArea {
    padding: 8px 20px 12px;
    background: var(--color-bg);
    border-top: 1px solid var(--color-border);
    flex-shrink: 0;
    padding-bottom: calc(max(12px, env(safe-area-inset-bottom)) + var(--keyboard-offset));
    display: flex;
    justify-content: center;
    animation: inputSlideUp 0.35s cubic-bezier(0.4, 0, 0.2, 1) both;
    position: sticky;
    bottom: 0;
    z-index: 20;
}

/* On mobile: fix to bottom of the visual viewport to eliminate keyboard gap */
@media (max-width: 768px) {
    #bottomInputArea {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        /* Use visual viewport offset to stay just above keyboard */
        transform: translateY(calc(-1 * var(--keyboard-offset)));
        padding-bottom: max(10px, env(safe-area-inset-bottom));
        z-index: 50;
        /* Prevent layout shift — takes this out of flow, so spacer handles gap */
        width: 100%;
        /* Disable slide-up animation on mobile to avoid conflict with transform */
        animation: none;
    }
}
@keyframes inputSlideUp {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes temporaryPulse {
    0% { box-shadow: 0 0 0 0 rgba(249, 115, 22, 0.42); }
    70% { box-shadow: 0 0 0 8px rgba(249, 115, 22, 0); }
    100% { box-shadow: 0 0 0 0 rgba(249, 115, 22, 0); }
}

.welcome-logo-wrap {
    width: 72px; height: 72px; border-radius: 20px;
    background: linear-gradient(135deg, #003d7a, #20a898);
    display: flex; align-items: center; justify-content: center;
    overflow: hidden; margin-bottom: 20px;
    box-shadow: 0 8px 32px rgba(32,168,152,0.25);
    animation: pulseGlow 3s ease-in-out infinite;
}
@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 8px 32px rgba(32,168,152,0.25); }
    50%       { box-shadow: 0 8px 40px rgba(32,168,152,0.45); }
}
.welcome-logo-wrap img { width: 100%; height: 100%; object-fit: cover; border-radius: 20px; }

.welcome-greeting {
    font-family: 'DM Serif Display', Georgia, serif;
    font-size: 28px; color: var(--color-text); text-align: center;
    margin-bottom: 8px; line-height: 1.25;
}
.welcome-sub {
    font-size: 15px; color: var(--color-text-secondary); text-align: center;
    margin-bottom: 24px; line-height: 1.6; max-width: 720px;
}

.dashboard-health-note {
    width: 100%;
    margin: 0 0 20px;
    padding: 14px 16px;
    border-radius: var(--radius-lg);
    background: rgba(0,61,122,0.06);
    border: 1px solid rgba(0,61,122,0.12);
    color: var(--color-text-secondary);
    font-size: 13px;
    line-height: 1.6;
}

.dashboard-user-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(15,118,110,0.08);
    border: 1px solid rgba(15,118,110,0.18);
}

.dashboard-user-pill-label {
    font-size: 11px;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.dashboard-user-pill-name {
    font-size: 12.5px;
    font-weight: 700;
    color: #0f766e;
}

/* Suggestion chips — shown on homepage */
.suggestion-chips {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    width: 100%;
    max-width: 600px;
    margin-top: 8px;
}
.chip {
    background: var(--color-surface); border: 1px solid var(--color-border);
    border-radius: var(--radius-md); padding: 14px 16px; cursor: pointer;
    transition: all var(--transition); text-align: left;
    animation: fadeInUp 0.5s ease both;
}
.chip:nth-child(1) { animation-delay: 0.05s; }
.chip:nth-child(2) { animation-delay: 0.10s; }
.chip:nth-child(3) { animation-delay: 0.15s; }
.chip:nth-child(4) { animation-delay: 0.20s; }
.chip:hover { border-color: var(--color-primary); background: var(--color-primary-light); transform: translateY(-2px); box-shadow: 0 4px 12px rgba(32,168,152,0.12); }
.claim-chip { grid-column: 1 / -1; }
.claim-chip:hover { border-color: #003d7a; box-shadow: 0 8px 24px rgba(0,61,122,0.12); }
.chip-icon { font-size: 20px; margin-bottom: 6px; display: block; }
.chip-title { font-size: 13.5px; font-weight: 600; color: var(--color-text); margin-bottom: 3px; }
.chip-desc { font-size: 12px; color: var(--color-text-secondary); line-height: 1.4; }

.seo-content {
    width: 100%;
    max-width: 860px;
    margin-top: 28px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.seo-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}
.seo-panel {
    background: linear-gradient(180deg, rgba(255,255,255,0.92), rgba(247,247,245,0.96));
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 22px 22px 20px;
    box-shadow: 0 10px 28px rgba(0,0,0,0.04);
}
.dark-mode .seo-panel {
    background: linear-gradient(180deg, rgba(36,36,36,0.92), rgba(26,26,26,0.96));
}
.seo-hero-copy {
    background:
        radial-gradient(circle at top right, rgba(32,168,152,0.14), transparent 34%),
        linear-gradient(180deg, rgba(0,61,122,0.06), rgba(32,168,152,0.04));
}
.seo-eyebrow {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-primary-dark);
    margin-bottom: 10px;
}
.seo-panel h3 {
    font-family: 'DM Serif Display', Georgia, serif;
    font-size: 24px;
    line-height: 1.25;
    margin-bottom: 10px;
    color: var(--color-text);
}
.seo-panel h4 {
    font-size: 16px;
    line-height: 1.4;
    margin-bottom: 6px;
    color: var(--color-text);
}
.seo-panel p,
.seo-panel li {
    font-size: 14px;
    line-height: 1.8;
    color: var(--color-text-secondary);
}
.seo-panel p + p {
    margin-top: 10px;
}
.seo-list {
    padding-left: 18px;
}
.seo-faq {
    display: grid;
    gap: 14px;
}
.seo-faq-item {
    padding-top: 12px;
    border-top: 1px solid var(--color-border);
}
.seo-faq-item:first-child {
    padding-top: 0;
    border-top: none;
}

/* OLD feature cards (kept for back-compat, hidden on new UI) */
.features-grid { display: none; }
.welcome-message { display: none; }

/* ── MESSAGES CONTAINER ── */
.messages-container {
    max-width: 740px; width: 100%; margin: 0 auto;
    display: flex; flex-direction: column; gap: 6px;
    padding-bottom: 8px;
}

/* ── MESSAGE ── */
.message {
    display: flex; align-items: flex-end; gap: 10px;
    animation: msgIn 0.25s ease both;
}
@keyframes msgIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

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

/* Avatar */
.message-avatar {
    width: 30px; height: 30px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; font-size: 12px; font-weight: 700; overflow: hidden;
}
.message-avatar.oracle {
    background: linear-gradient(135deg, #003d7a, #20a898);
    padding: 0; position: relative;
}
/* Oracle avatar — static when showing response */
.message-avatar.oracle img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.oracle-avatar-svg { width: 18px; height: 18px; color: white; }

/* Loading avatar: SVG lotus draw/reconstruct animation */
.message-avatar.oracle.is-loading {
    background: linear-gradient(135deg, #003d7a, #20a898);
}
.oracle-draw-svg {
    width: 100%; height: 100%; padding: 3px;
}
.draw-path {
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    animation: drawStroke 1.6s ease-in-out infinite alternate;
}
.draw-circle  { animation-delay: 0s;    stroke-dasharray: 120; stroke-dashoffset: 120; }
.draw-p1      { animation-delay: 0.15s; }
.draw-p2      { animation-delay: 0.3s;  }
.draw-p3      { animation-delay: 0.45s; }
.draw-base    { animation-delay: 0.6s;  stroke-dasharray: 60; stroke-dashoffset: 60; }
.draw-dot     { animation-delay: 0.7s;  stroke-dasharray: 12; stroke-dashoffset: 12; }

@keyframes drawStroke {
    0%   { stroke-dashoffset: 200; opacity: 0.3; }
    50%  { stroke-dashoffset: 0;   opacity: 1; }
    100% { stroke-dashoffset: 200; opacity: 0.3; }
}

.message-avatar.user {
    background: linear-gradient(135deg, #374151, #1f2937);
    color: white; letter-spacing: 0.5px;
}
.dark-mode .message-avatar.user { background: linear-gradient(135deg, #4b5563, #374151); }

/* Bubble */
.message-content {
    max-width: min(560px, 85%); padding: 10px 14px;
    border-radius: 18px; font-size: var(--chat-font-size, 15.5px); line-height: 1.8;
    word-break: break-word;
}
.message.oracle .message-content {
    background: transparent;
    border: none;
    border-bottom-left-radius: 6px; color: var(--color-text);
    padding-left: 4px;
    font-size: var(--chat-font-size, 15.5px);
}
.message.user .message-content {
    background: var(--color-user-bubble); color: white;
    border-bottom-right-radius: 6px;
}
.message.user .message-content a { color: rgba(255,255,255,0.85); text-decoration: underline; }
.message.oracle .message-content a { color: var(--color-primary); }

/* Markdown rendering in oracle messages */
.message.oracle .message-content strong { font-weight: 600; }
.message.oracle .message-content em { font-style: italic; }
.message.oracle .message-content code {
    background: rgba(0,0,0,0.06); border-radius: 4px;
    padding: 1px 5px; font-size: 13px; font-family: 'SF Mono', 'Fira Code', monospace;
}
.dark-mode .message.oracle .message-content code { background: rgba(255,255,255,0.08); }
.message.oracle .message-content ul, .message.oracle .message-content ol {
    padding-left: 18px; margin: 6px 0;
}
.message.oracle .message-content li { margin-bottom: 4px; }
.message.oracle .message-content p + p { margin-top: 8px; }

/* Status chip above oracle bubble */
.status-chip {
    display: flex; align-items: center; gap: 6px;
    font-size: 12px; color: var(--color-text-secondary);
    margin-bottom: 6px; margin-left: 40px;
    animation: fadeIn 0.3s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.status-dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--color-primary);
    animation: statusPulse 1s ease-in-out infinite;
}
@keyframes statusPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.4; transform: scale(0.6); }
}

/* Thinking indicator */
.typing-indicator {
    display: flex; align-items: center; gap: 4px; padding: 2px 0;
}
.typing-indicator span {
    width: 7px; height: 7px; background: var(--color-text-secondary);
    border-radius: 50%; display: inline-block;
    animation: bounce 1.2s ease-in-out infinite;
}
.typing-indicator span:nth-child(1) { animation-delay: 0s; }
.typing-indicator span:nth-child(2) { animation-delay: 0.18s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.36s; }
@keyframes bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
    30%            { transform: translateY(-5px); opacity: 1; }
}

/* Streaming cursor */
.streaming-cursor {
    display: inline-block; width: 2px; height: 1em;
    background: var(--color-text); vertical-align: middle;
    margin-left: 1px; border-radius: 1px;
    animation: blink 0.8s step-end infinite;
}
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

.message-content.response-reveal > * {
    opacity: 0;
    transform: translateY(10px);
    animation: oracleResponseReveal 0.52s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.message-content.response-reveal > * + * {
    margin-top: inherit;
}

.message-content.response-reveal p,
.message-content.response-reveal li,
.message-content.response-reveal blockquote,
.message-content.response-reveal pre {
    will-change: opacity, transform;
}

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

/* ── INPUT AREA (bottom shell — populated by JS after first message) ── */
.input-area {
    padding: 8px 20px 12px; background: var(--color-bg);
    border-top: 1px solid var(--color-border); flex-shrink: 0;
    padding-bottom: calc(max(12px, env(safe-area-inset-bottom)) + var(--keyboard-offset));
    margin-bottom: -4px;
    display: flex; justify-content: center;
    position: sticky;
    bottom: 0;
    z-index: 20;
}

.input-container { max-width: 740px; width: 100%; margin: 0 auto; }

#errorMessage .error-message {
    background: #fee2e2; color: #dc2626; padding: 8px 12px;
    border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 8px;
    border-left: 3px solid #dc2626;
}
#errorMessage .success-message {
    background: #d1fae5; color: #065f46; padding: 8px 12px;
    border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 8px;
    border-left: 3px solid var(--color-primary);
}

/* File previews */
.image-preview-container, .pdf-preview-container {
    position: relative; display: inline-flex; align-items: center;
    gap: 8px; padding: 8px 12px; background: var(--color-oracle-bubble);
    border: 1px solid var(--color-border); border-radius: var(--radius-md);
    margin-bottom: 8px; max-width: 100%;
}
.preview-image { height: 56px; width: 56px; object-fit: cover; border-radius: var(--radius-sm); }

/* ── MULTI-IMAGE SWIPEABLE STRIP (upload previews above input) ── */
.file-preview-strip {
    display: flex;
    flex-direction: row;
    gap: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding: 6px 2px 10px;
    scrollbar-width: thin;
    scrollbar-color: var(--color-border) transparent;
    align-items: flex-start;
    flex-wrap: nowrap;
}
.file-preview-strip::-webkit-scrollbar { height: 4px; }
.file-preview-strip::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 2px; }
.file-preview-strip > .image-preview-container,
.file-preview-strip > .pdf-preview-container {
    scroll-snap-align: start;
    flex-shrink: 0;
    margin-bottom: 0;
}

/* ── IN-CHAT MULTI-IMAGE SWIPEABLE ROW ── */
.chat-image-row {
    display: flex;
    flex-direction: row;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
    padding-bottom: 4px;
    scrollbar-width: thin;
    scrollbar-color: var(--color-border) transparent;
}
.chat-image-row::-webkit-scrollbar { height: 4px; }
.chat-image-row::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 2px; }
.chat-image-row img {
    scroll-snap-align: start;
    flex-shrink: 0;
    max-height: 200px;
    max-width: 200px;
    width: auto;
    border-radius: 10px;
    cursor: zoom-in;
    object-fit: cover;
}
@media (max-width: 480px) {
    .chat-image-row img { max-height: 160px; max-width: 160px; }
}
.pdf-icon { width: 24px; height: 24px; color: #dc2626; }
.file-name { font-size: 13px; color: var(--color-text); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; }
.remove-file-btn, .remove-preview-btn {
    background: rgba(0,0,0,0.12); border: none; border-radius: 50%;
    width: 20px; height: 20px; display: flex; align-items: center; justify-content: center;
    cursor: pointer; font-size: 14px; color: var(--color-text); transition: background var(--transition); flex-shrink: 0;
}
.remove-file-btn:hover, .remove-preview-btn:hover { background: rgba(0,0,0,0.25); }

/* ── CLEAR ALL FILES BUTTON ── */
.clear-all-files-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 5px 12px 5px 10px;
    background: linear-gradient(135deg, rgba(220,38,38,0.08), rgba(220,38,38,0.12));
    border: 1px solid rgba(220,38,38,0.25);
    border-radius: 20px;
    color: #dc2626;
    font-size: 12px; font-weight: 600; font-family: inherit;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4,0,0.2,1);
    margin-top: 6px;
    letter-spacing: 0.01em;
    box-shadow: 0 1px 3px rgba(220,38,38,0.1);
}
.clear-all-files-btn:hover {
    background: linear-gradient(135deg, rgba(220,38,38,0.15), rgba(220,38,38,0.22));
    border-color: rgba(220,38,38,0.45);
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(220,38,38,0.2);
}
.clear-all-files-btn:active { transform: translateY(0); box-shadow: none; }
.dark-mode .clear-all-files-btn {
    background: rgba(220,38,38,0.12);
    border-color: rgba(220,38,38,0.3);
}

/* Input wrapper */
.input-wrapper {
    display: flex; align-items: flex-end; gap: 6px;
    background: var(--color-surface); border: 1px solid var(--color-border);
    border-radius: 18px; padding: 8px 8px 8px 12px;
    transition: border-color var(--transition), box-shadow var(--transition);
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.input-wrapper:focus-within { border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(32,168,152,0.15); }

.input-actions { display: flex; align-items: center; gap: 2px; padding-bottom: 4px; }

/* ── + ATTACH POPUP ── */
.attach-popup-wrapper { position: relative; display: flex; align-items: center; z-index: 1; }

.attach-plus-btn {
    width: 38px; height: 38px; display: flex; align-items: center; justify-content: center;
    background: none; border: none; border-radius: var(--radius-sm);
    color: var(--color-text-secondary); cursor: pointer; transition: all var(--transition);
    /* Reliable touch target */
    min-width: 44px; min-height: 44px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    -webkit-appearance: none;
    appearance: none;
    user-select: none;
}
.attach-plus-btn:hover { background: var(--color-hover); color: var(--color-primary); }

.attach-popup {
    display: none; position: absolute; bottom: calc(100% + 10px); left: 0;
    background: var(--color-surface); border: 1px solid var(--color-border);
    border-radius: var(--radius-md); box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    min-width: 160px; overflow: hidden; z-index: 200;
    animation: popupFadeIn 0.15s ease;
}
.attach-popup.open { display: block; }

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

.attach-option {
    display: flex; align-items: center; gap: 9px;
    width: 100%; padding: 10px 14px; background: none; border: none;
    font-size: 13.5px; font-family: inherit; color: var(--color-text);
    cursor: pointer; transition: background var(--transition); text-align: left;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}
.attach-option:hover { background: var(--color-hover); color: var(--color-primary); }
.attach-option-mobile-bridge {
    color: var(--color-text);
}

/* Divider line in attach popup */
.attach-divider {
    height: 1px;
    background: var(--color-border, #e5e7eb);
    margin: 3px 0;
}

/* Web search toggle in attach popup */
.attach-option-websearch {
    gap: 8px;
    font-weight: 500;
    color: var(--color-text-secondary, #6b7280);
    font-size: 13px;
}
.attach-option-websearch:hover {
    background: var(--color-hover);
    color: var(--color-primary);
}
.attach-option-websearch.ws-active {
    color: var(--color-primary, #20a898);
    background: rgba(32,168,152,.05);
}


.message-input-stack {
    position: relative;
    flex: 1;
    min-height: 52px;
}

.message-input-highlight,
.message-input {
    width: 100%;
    min-height: 52px;
    max-height: 260px;
    padding: 5px 4px;
    font-size: 14.5px;
    line-height: 1.6;
    font-family: inherit;
    white-space: pre-wrap;
    word-break: break-word;
}

.message-input-highlight {
    position: absolute;
    inset: 0;
    overflow: hidden;
    color: transparent;
    pointer-events: none;
    z-index: 0;
}

.composer-mention {
    border-radius: 999px;
    padding: 1px 4px;
    color: transparent;
    background: rgba(32,168,152,0.12);
    box-shadow: inset 0 0 0 1px rgba(32,168,152,0.2);
}

.composer-mention.is-connected {
    color: transparent;
    background: color-mix(in srgb, var(--mention-color, #20a898) 14%, transparent);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--mention-color, #20a898) 28%, transparent);
}

.message-input {
    flex: 1; border: none; outline: none; background: transparent;
    font-size: 14.5px; color: var(--color-text); caret-color: var(--color-text); resize: none;
    max-height: 260px; line-height: 1.6; padding: 5px 4px;
    font-family: inherit; min-height: 52px;
    position: relative;
    z-index: 0;
}
.message-input::placeholder { color: var(--color-text-secondary); }

.send-btn {
    width: 42px; height: 42px; background: var(--color-primary); border: none;
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: all var(--transition); color: white; flex-shrink: 0;
    /* Reliable touch target on all devices */
    min-width: 44px; min-height: 44px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    -webkit-appearance: none;
    appearance: none;
    user-select: none;
    position: relative;
    z-index: 1;
}
.send-btn:hover { background: var(--color-primary-dark); transform: scale(1.05); }
.send-btn:active { transform: scale(0.94); }
.send-btn:disabled { background: var(--color-border); cursor: not-allowed; transform: none; }

.apps-page {
    flex: 1;
    overflow-y: auto;
    padding: 28px 24px 40px;
    background:
        radial-gradient(circle at top right, rgba(32,168,152,0.14), transparent 28%),
        radial-gradient(circle at bottom left, rgba(0,61,122,0.12), transparent 32%),
        var(--color-bg);
}

.apps-page-shell {
    max-width: 1080px;
    margin: 0 auto;
}

.apps-page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
    margin-bottom: 24px;
}

.apps-page-eyebrow {
    margin: 0 0 8px;
    font-size: 11px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--color-primary-dark);
    font-weight: 700;
}

.apps-page-header h2 {
    margin: 0;
    font-family: 'DM Serif Display', Georgia, serif;
    font-size: 34px;
    line-height: 1.08;
    color: var(--color-text);
}

.apps-page-copy {
    margin: 12px 0 0;
    max-width: 680px;
    color: var(--color-text-secondary);
    line-height: 1.7;
}

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

.apps-page-secondary-btn,
.apps-card-action,
.apps-card-open,
.apps-card-signin {
    border: none;
    border-radius: 999px;
    font-family: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: transform var(--transition), box-shadow var(--transition), background var(--transition), border-color var(--transition);
}

.apps-page-secondary-btn {
    padding: 10px 16px;
    background: var(--color-surface);
    color: var(--color-text);
    border: 1px solid var(--color-border);
}

.apps-page-secondary-btn:hover,
.apps-card-open:hover,
.apps-card-action:hover,
.apps-card-signin:hover {
    transform: translateY(-1px);
}

.apps-directory-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 18px;
}

.apps-directory-card {
    position: relative;
    padding: 22px;
    border-radius: 24px;
    border: 1px solid color-mix(in srgb, var(--app-color, #20a898) 22%, rgba(0,0,0,0.08));
    background: linear-gradient(180deg, color-mix(in srgb, var(--app-color, #20a898) 10%, white), rgba(255,255,255,0.92));
    box-shadow: 0 12px 34px rgba(15, 23, 42, 0.08);
}

.apps-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 16px;
}

.apps-card-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 46px;
    height: 46px;
    padding: 0 14px;
    border-radius: 15px;
    background: color-mix(in srgb, var(--app-color, #20a898) 16%, white);
    color: var(--app-color, var(--color-primary-dark));
    font-size: 20px;
    font-weight: 800;
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--app-color, #20a898) 20%, transparent);
}

.apps-card-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.06);
    color: var(--color-text-secondary);
    font-size: 12px;
    font-weight: 700;
}

.apps-card-status.is-connected {
    color: #0f766e;
    background: rgba(15, 118, 110, 0.12);
}

.apps-card-status.is-warning {
    color: #92400e;
    background: rgba(245, 158, 11, 0.15);
}

.apps-card-status.is-danger {
    color: #b91c1c;
    background: rgba(220, 38, 38, 0.12);
}

.apps-directory-card h3 {
    margin: 0 0 8px;
    font-size: 22px;
    color: var(--color-text);
}

.apps-directory-card.is-active {
    border-color: color-mix(in srgb, var(--app-color, #20a898) 40%, transparent);
    box-shadow: 0 18px 38px color-mix(in srgb, var(--app-color, #20a898) 20%, transparent);
}

.apps-directory-card p {
    margin: 0;
    color: var(--color-text-secondary);
    line-height: 1.65;
}

.apps-card-hint {
    margin-top: 16px;
    padding: 10px 12px;
    border-radius: 14px;
    background: rgba(255,255,255,0.64);
    color: var(--color-text);
    font-size: 12.5px;
    line-height: 1.5;
}

.apps-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

.apps-card-action,
.apps-card-signin,
.apps-card-open {
    padding: 10px 14px;
    font-size: 13px;
}

.apps-card-action,
.apps-card-signin {
    background: var(--app-color, var(--color-primary));
    color: #fff;
    box-shadow: 0 8px 18px color-mix(in srgb, var(--app-color, #20a898) 22%, transparent);
}

.apps-card-open {
    background: rgba(255,255,255,0.72);
    color: var(--color-text);
    border: 1px solid rgba(15, 23, 42, 0.08);
}

.apps-card-disconnect {
    background: transparent;
    color: #b91c1c;
    border: 1px solid rgba(185, 28, 28, 0.18);
    box-shadow: none;
}

.app-consent-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 3200;
}

.app-consent-modal.active {
    display: block;
}

.app-consent-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(4px);
}

.app-consent-card {
    position: relative;
    width: min(560px, calc(100vw - 24px));
    margin: min(10vh, 84px) auto 0;
    padding: 26px 24px 22px;
    border-radius: 26px;
    background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(247,250,252,0.98));
    border: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.22);
    animation: modalIn 0.24s ease both;
}

.app-consent-eyebrow {
    margin: 0 0 8px;
    font-size: 11px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    font-weight: 800;
    color: var(--color-primary-dark);
}

.app-consent-title {
    margin: 0;
    font-size: 28px;
    line-height: 1.1;
    color: var(--color-text);
}

.app-consent-copy,
.app-consent-legal {
    color: var(--color-text-secondary);
    line-height: 1.7;
}

.app-consent-copy {
    margin: 12px 0 0;
}

.app-consent-list {
    margin-top: 18px;
    display: grid;
    gap: 10px;
}

.app-consent-item {
    padding: 12px 14px;
    border-radius: 16px;
    background: rgba(32,168,152,0.06);
    border: 1px solid rgba(32,168,152,0.12);
    color: var(--color-text);
    line-height: 1.6;
}

.app-consent-legal {
    margin: 16px 0 0;
    font-size: 13px;
}

.app-consent-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 18px;
}

.apps-page-note {
    margin-top: 22px;
    padding: 16px 18px;
    border-radius: 18px;
    border: 1px solid rgba(32,168,152,0.16);
    background: rgba(255,255,255,0.68);
    color: var(--color-text-secondary);
    line-height: 1.7;
}

.app-workspace-panel {
    margin-bottom: 18px;
}

.app-workspace-shell {
    padding: 22px;
    border-radius: 24px;
    border: 1px solid color-mix(in srgb, var(--app-color, #20a898) 28%, rgba(15, 23, 42, 0.08));
    background:
        radial-gradient(circle at top right, color-mix(in srgb, var(--app-color, #20a898) 16%, transparent), transparent 36%),
        linear-gradient(180deg, rgba(255,255,255,0.96), rgba(247,250,252,0.96));
    box-shadow: 0 18px 44px rgba(15, 23, 42, 0.08);
}

.app-workspace-top {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
}

.app-workspace-eyebrow {
    margin: 0 0 8px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--app-color, var(--color-primary-dark));
}

.app-workspace-top h3 {
    margin: 0;
    font-size: 26px;
    color: var(--color-text);
}

.app-workspace-copy {
    margin: 8px 0 0;
    color: var(--color-text-secondary);
    line-height: 1.6;
}

.app-workspace-status {
    padding: 8px 12px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--app-color, #20a898) 12%, transparent);
    color: var(--app-color, var(--color-primary-dark));
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.app-workspace-summary {
    margin-top: 16px;
    padding: 14px 16px;
    border-radius: 18px;
    background: rgba(255,255,255,0.78);
    border: 1px solid rgba(15, 23, 42, 0.06);
    color: var(--color-text);
    line-height: 1.7;
    font-size: 14px;
}

.app-workspace-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}

/* Stop button — shown while AI is generating a response */
.send-btn.stop-mode {
    background: var(--color-text-secondary) !important;
    border-radius: 50%;
    cursor: pointer;
    transition: background var(--transition), transform var(--transition);
}
.send-btn.stop-mode:hover {
    background: #374151 !important;
    transform: scale(1.06);
}

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

.workflow-trail-wrap {
    margin-top: 12px;
    border-top: 1px solid rgba(0,0,0,0.06);
    padding-top: 10px;
}

.thought-trail-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: none;
    background: transparent;
    color: var(--color-text-secondary);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
}

.trail-toggle-label {
    letter-spacing: 0.01em;
}

.thought-trail-steps {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 12px;
}

.trail-step {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.trail-step-icon {
    min-width: 34px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: rgba(32,168,152,0.1);
    flex-shrink: 0;
    padding: 0 8px;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.02em;
}

.trail-step-body {
    flex: 1;
    min-width: 0;
}

.trail-step-label {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--color-text);
}

.trail-step-detail {
    margin-top: 2px;
    font-size: 12px;
    line-height: 1.45;
    color: var(--color-text-secondary);
}

.trail-step-connector {
    position: absolute;
    left: 12px;
    top: 30px;
    width: 1px;
    height: calc(100% + 8px);
    background: rgba(32,168,152,0.18);
}

.trail-step:last-child .trail-step-connector {
    display: none;
}

.thought-trail-duration {
    color: var(--color-primary, #20a898);
    font-weight: 700;
}

.mobile-upload-modal {
    position: fixed;
    inset: 0;
    display: none;
    z-index: 1400;
}

.mobile-upload-modal.active {
    display: block;
}

.mobile-upload-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(10, 15, 26, 0.55);
    backdrop-filter: blur(8px);
}

.mobile-upload-modal-card {
    position: relative;
    width: min(92vw, 520px);
    margin: 7vh auto 0;
    background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(245,250,248,0.98));
    border: 1px solid rgba(32,168,152,0.18);
    border-radius: 28px;
    box-shadow: 0 30px 80px rgba(9, 20, 34, 0.22);
    padding: 28px 26px 24px;
    animation: modalIn 0.22s ease both;
}

.mobile-upload-brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.mobile-upload-brand img,
.mobile-bridge-logo {
    border-radius: 20px;
    box-shadow: 0 10px 24px rgba(32,168,152,0.18);
}

.mobile-upload-kicker,
.mobile-bridge-kicker {
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-primary, #20a898);
    font-weight: 700;
}

.mobile-upload-title,
.mobile-bridge-title {
    margin-top: 3px;
    font-size: 24px;
    line-height: 1.15;
    color: var(--color-text, #111827);
}

.mobile-upload-copy,
.mobile-bridge-copy {
    margin: 16px 0 18px;
    color: var(--color-text-secondary, #5b6474);
    line-height: 1.55;
}

.mobile-upload-qr-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 16px;
}

.mobile-upload-qr {
    width: 220px;
    height: 220px;
    border-radius: 22px;
    background: white;
    border: 1px solid rgba(32,168,152,0.12);
    padding: 12px;
}

.mobile-upload-link-box {
    padding: 12px 14px;
    border-radius: 16px;
    background: rgba(15, 23, 42, 0.05);
    color: var(--color-text, #111827);
    font-size: 12px;
    line-height: 1.45;
    word-break: break-all;
}

.mobile-upload-actions,
.mobile-bridge-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

.mobile-upload-status,
.mobile-bridge-status {
    margin-top: 14px;
    padding: 12px 14px;
    border-radius: 16px;
    background: rgba(32,168,152,0.08);
    border: 1px solid rgba(32,168,152,0.14);
    color: var(--color-text-secondary, #4b5563);
    font-size: 13px;
}

.mobile-bridge-screen {
    display: none;
    min-height: 100dvh;
    padding: 24px 18px;
    background:
        radial-gradient(circle at top, rgba(32,168,152,0.18), transparent 38%),
        linear-gradient(180deg, #f4fbf9 0%, #eef4ff 100%);
    align-items: center;
    justify-content: center;
}

.mobile-bridge-screen.active {
    display: flex;
}

.mobile-bridge-card {
    width: min(100%, 420px);
    background: rgba(255,255,255,0.94);
    border: 1px solid rgba(32,168,152,0.16);
    border-radius: 28px;
    padding: 28px 22px 24px;
    text-align: center;
    box-shadow: 0 26px 70px rgba(11, 27, 44, 0.16);
}

.mobile-bridge-actions {
    flex-direction: column;
}

body.mobile-upload-mode .app-container,
body.mobile-upload-mode .cookie-consent,
body.mobile-upload-mode .privacy-popup-overlay,
body.mobile-upload-mode #dragDropOverlay,
body.mobile-upload-mode #voiceChatModal,
body.mobile-upload-mode #pricingModal {
    display: none !important;
}

body.mobile-upload-mode {
    background: linear-gradient(180deg, #f4fbf9 0%, #eef4ff 100%);
}

/* ── PDF DOWNLOAD BUTTON ── */
.pdf-download-btn {
    display: inline-flex; align-items: center; gap: 12px;
    background: linear-gradient(135deg, #0a2452 0%, #1a4a8a 50%, #20a898 100%);
    color: white; border: none; border-radius: 12px;
    padding: 12px 20px; font-size: 13.5px; font-weight: 600;
    cursor: pointer; margin-top: 8px; transition: all var(--transition);
    font-family: inherit; text-align: left; min-width: 220px;
    box-shadow: 0 2px 10px rgba(10,36,82,0.25);
    position: relative; overflow: hidden;
}
.pdf-download-btn::before {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.08) 0%, transparent 60%);
    pointer-events: none;
}
.pdf-download-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(32,168,152,0.45);
    background: linear-gradient(135deg, #0d2d60 0%, #1f56a0 50%, #26c4b0 100%);
}
.pdf-download-btn:active { transform: translateY(0); }
.pdf-download-btn svg { flex-shrink: 0; }

/* ═══════════════════════════════════════════
   AUTH MODAL
═══════════════════════════════════════════ */
.auth-modal {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,0.6); backdrop-filter: blur(8px);
    z-index: 2000;
    /* Scroll the overlay so content is never clipped on short screens.
       overscroll-behavior: contain stops the scroll from leaking to the
       body (which has overflow:hidden) — fixes the "scroll disappears
       after a second" bug on iOS/Android. */
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    align-items: flex-start;
    justify-content: center;
    /* padding-bottom gives breathing room above the keyboard on mobile */
    padding: 16px 16px max(16px, env(safe-area-inset-bottom));
}
.auth-modal.active { display: flex; }
/* Thin scrollbar on the overlay */
.auth-modal::-webkit-scrollbar { width: 5px; }
.auth-modal::-webkit-scrollbar-track { background: transparent; }
.auth-modal::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.25); border-radius: 99px; }
/* When the viewport is tall enough, keep the panel vertically centred */
@media (min-height: 700px) {
    .auth-modal { align-items: center; }
}

.auth-container {
    background: var(--color-surface); border-radius: var(--radius-xl);
    width: 100%; max-width: 420px; padding: 32px 28px;
    position: relative; box-shadow: 0 24px 60px rgba(0,0,0,0.2);
    animation: modalIn 0.3s cubic-bezier(0.34,1.56,0.64,1) both;
    border: 1px solid var(--color-border);
    /* Never let the card get clipped — flex-shrink:0 allows it to grow
       beyond the overlay height so the overlay itself scrolls */
    flex-shrink: 0;
}
@keyframes modalIn {
    from { opacity: 0; transform: translateY(24px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.auth-logo-header {
    display: flex; flex-direction: column; align-items: center; margin-bottom: 24px; gap: 10px;
}
.auth-logo-header .logo-circle {
    width: 52px; height: 52px; border-radius: 14px;
    background: linear-gradient(135deg, #003d7a, #20a898);
    overflow: hidden; display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 16px rgba(32,168,152,0.3);
}
.auth-logo-header .logo-circle img { width: 100%; height: 100%; object-fit: cover; }
.auth-logo-header h3,
.auth-modal-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--color-text);
}
.auth-logo-header p { font-size: 13px; color: var(--color-text-secondary); margin-top: -6px; }

.close-modal {
    position: absolute; top: 14px; right: 16px;
    width: 36px; height: 36px; background: var(--color-hover); border: none;
    border-radius: 50%; cursor: pointer; font-size: 18px; display: flex;
    align-items: center; justify-content: center; color: var(--color-text-secondary);
    transition: all var(--transition); line-height: 1;
    /* Ensure minimum tap target */
    min-width: 36px; min-height: 36px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}
.close-modal:hover { background: var(--color-border); color: var(--color-text); }

.auth-tabs { display: flex; gap: 0; margin-bottom: 24px; background: var(--color-hover); border-radius: var(--radius-sm); padding: 3px; }
.auth-tab {
    flex: 1; padding: 8px; background: none; border: none;
    border-radius: var(--radius-sm); font-size: 13.5px; font-weight: 500;
    cursor: pointer; transition: all var(--transition); color: var(--color-text-secondary); font-family: inherit;
}
.auth-tab.active { background: var(--color-surface); color: var(--color-text); box-shadow: 0 1px 4px rgba(0,0,0,0.08); }

.auth-form { display: none; }
.auth-form.active { display: block; }

.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 12.5px; font-weight: 600; color: var(--color-text-secondary); margin-bottom: 5px; text-transform: uppercase; letter-spacing: 0.4px; }
.form-group input {
    width: 100%; padding: 11px 14px; border: 1.5px solid var(--color-border);
    border-radius: var(--radius-sm); font-size: 14px; color: var(--color-text);
    background: var(--color-bg); transition: border-color var(--transition), box-shadow var(--transition);
    font-family: inherit; outline: none;
}
.form-group input:focus { border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(32,168,152,0.12); }
.form-group input::placeholder { color: var(--color-text-secondary); font-size: 13.5px; }

.password-input-wrapper { position: relative; }
.password-input-wrapper input { padding-right: 42px; }
.password-toggle {
    position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
    background: none; border: none; cursor: pointer; color: var(--color-text-secondary);
    display: flex; align-items: center; justify-content: center; padding: 4px;
    transition: color var(--transition);
}
.password-toggle:hover { color: var(--color-text); }
.eye-icon { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 2; }

.auth-btn {
    width: 100%; padding: 12px; background: var(--color-primary);
    color: white; border: none; border-radius: var(--radius-sm);
    font-size: 14.5px; font-weight: 600; cursor: pointer;
    transition: all var(--transition); font-family: inherit; margin-top: 4px;
}
.auth-btn:hover { background: var(--color-primary-dark); transform: translateY(-1px); box-shadow: 0 4px 14px rgba(32,168,152,0.35); }
.auth-btn:active { transform: translateY(0); }

.confirm-container {
    max-width: 440px;
}

.confirm-modal-message {
    margin: 0;
    white-space: pre-line;
    line-height: 1.55;
}

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

.confirm-modal-btn {
    border: none;
    border-radius: var(--radius-sm);
    padding: 11px 16px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all var(--transition);
}

.confirm-modal-btn.secondary {
    background: var(--color-hover);
    color: var(--color-text);
}

.confirm-modal-btn.secondary:hover {
    background: var(--color-border);
}

.confirm-modal-btn.primary {
    background: var(--color-primary);
    color: #fff;
}

.confirm-modal-btn.primary:hover {
    background: var(--color-primary-dark);
}

.confirm-modal-btn.danger {
    background: #dc2626;
    color: #fff;
}

.confirm-modal-btn.danger:hover {
    background: #b91c1c;
}

/* Accept Terms */
.accepterms {
    margin: 12px 0 16px; padding: 10px 12px;
    background: var(--color-primary-light); border: 1px solid rgba(32,168,152,0.2);
    border-radius: var(--radius-sm);
}
.accepterms h5 { margin: 0; font-size: 12px; font-weight: 400; color: var(--color-text-secondary); line-height: 1.6; text-align: center; }
.accepterms a { color: var(--color-primary); text-decoration: none; font-weight: 600; }
.accepterms a:hover { text-decoration: underline; }

/* ── LEGAL MODAL ── */
.legal-modal {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,0.6); backdrop-filter: blur(4px);
    z-index: 2000; overflow-y: auto; align-items: flex-start; justify-content: center;
    padding: 24px 16px;
}
.legal-modal.active { display: flex; }
.legal-modal-content {
    background: var(--color-surface); border-radius: var(--radius-xl);
    max-width: 800px; width: 100%; position: relative;
    overflow: hidden; box-shadow: 0 20px 60px rgba(0,0,0,0.25);
    animation: modalIn 0.3s ease both;
}

/* ── COOKIE CONSENT ── */
.cookie-consent {
    position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
    background: var(--color-surface); border: 1px solid var(--color-border);
    border-radius: var(--radius-lg); padding: 16px 20px;
    max-width: 600px; width: calc(100% - 32px);
    z-index: 1500; box-shadow: 0 8px 32px rgba(0,0,0,0.12);
    display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
    animation: slideUp 0.4s cubic-bezier(0.34,1.56,0.64,1) both;
}
@keyframes slideUp { from { opacity: 0; transform: translateX(-50%) translateY(24px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }
.cookie-consent.hidden { display: none; }
.cookie-consent-text { flex: 1; min-width: 200px; }
.cookie-consent-text strong { font-size: 14px; }
.cookie-consent-text p { font-size: 12.5px; color: var(--color-text-secondary); margin-top: 4px; line-height: 1.5; }
.cookie-consent-text a { color: var(--color-primary); text-decoration: none; }
.cookie-consent-text a:hover { text-decoration: underline; }
.cookie-consent-buttons { display: flex; gap: 8px; flex-shrink: 0; }
.cookie-btn {
    padding: 8px 16px; border-radius: var(--radius-sm); font-size: 13px;
    font-weight: 600; cursor: pointer; transition: all var(--transition); font-family: inherit;
}
.cookie-accept { background: var(--color-primary); color: white; border: none; }
.cookie-accept:hover { background: var(--color-primary-dark); }
.cookie-decline { background: transparent; color: var(--color-text-secondary); border: 1px solid var(--color-border); }
.cookie-decline:hover { background: var(--color-hover); }

/* ── PRIVACY POPUP ── */
.privacy-popup-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.8);
    backdrop-filter: blur(8px); z-index: 10000;
    display: flex; align-items: center; justify-content: center; padding: 20px;
    animation: fadeIn 0.3s ease;
}
.privacy-popup {
    background: var(--color-surface); border-radius: var(--radius-xl);
    max-width: 680px; width: 100%; max-height: 90vh; overflow-y: auto;
    box-shadow: 0 24px 60px rgba(0,0,0,0.3);
    animation: modalIn 0.4s cubic-bezier(0.34,1.56,0.64,1) both;
    border: 1px solid var(--color-border);
}
.privacy-popup-header {
    background: linear-gradient(135deg, #003d7a 0%, #20a898 100%);
    color: white; padding: 28px; border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    text-align: center;
}
.privacy-popup-header h2 { font-size: 24px; font-weight: 700; margin: 0 0 6px; color: white; }
.privacy-popup-header p { font-size: 14px; margin: 0; color: rgba(255,255,255,0.9); }
.privacy-popup-content { padding: 24px; }
.privacy-section {
    background: var(--color-oracle-bubble); border-radius: var(--radius-md); padding: 20px;
    margin-bottom: 16px; border: 1px solid var(--color-border);
    transition: border-color var(--transition), box-shadow var(--transition);
}
.privacy-section:hover { border-color: var(--color-primary); box-shadow: 0 4px 12px rgba(32,168,152,0.12); }
.privacy-section h3 { font-size: 16px; font-weight: 700; color: var(--color-text); margin: 0 0 8px; }
.privacy-section p { font-size: 13.5px; line-height: 1.7; color: var(--color-text-secondary); margin: 0 0 12px; }
.privacy-link {
    display: inline-flex; align-items: center; gap: 5px;
    color: var(--color-primary); text-decoration: none; font-weight: 600; font-size: 13px;
    padding: 6px 12px; background: var(--color-primary-light);
    border-radius: var(--radius-sm); transition: all var(--transition);
}
.privacy-link:hover { background: var(--color-primary); color: white; }
.privacy-popup-footer { padding: 20px 24px 24px; background: var(--color-hover); border-radius: 0 0 var(--radius-xl) var(--radius-xl); }
.privacy-notice { font-size: 12.5px; color: var(--color-text-secondary); text-align: center; margin: 0 0 16px; line-height: 1.6; }
.privacy-popup-buttons { display: flex; gap: 10px; justify-content: center; }
.privacy-btn { padding: 12px 28px; border: none; border-radius: 10px; font-size: 14px; font-weight: 600; cursor: pointer; transition: all var(--transition); font-family: inherit; flex: 1; max-width: 180px; }
.privacy-accept { background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark)); color: white; box-shadow: 0 4px 12px rgba(32,168,152,0.3); }
.privacy-accept:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(32,168,152,0.4); }
.privacy-decline { background: var(--color-surface); color: var(--color-text-secondary); border: 1px solid var(--color-border); }
.privacy-decline:hover { background: var(--color-hover); }

/* ── FORGOT PASSWORD LINK ── */
.forgot-password-row {
    display: flex;
    justify-content: flex-end;
    margin-top: 7px;
}
.forgot-password-link {
    background: none;
    border: none;
    color: var(--color-primary);
    font-size: 12.5px;
    font-weight: 500;
    cursor: pointer;
    padding: 0;
    font-family: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: color var(--transition);
}
.forgot-password-link:hover { color: var(--color-primary-dark); }


.auth-error-message {
    background: #fee2e2; color: #dc2626; padding: 10px 14px;
    border-radius: var(--radius-sm); margin-bottom: 12px;
    font-size: 13px; border-left: 3px solid #dc2626; animation: fadeInUp 0.2s ease;
}

/* ═══════════════════════════════════════════
   RESPONSIVE — DESKTOP sidebar collapse
═══════════════════════════════════════════ */
@media (min-width: 769px) {
    .sidebar {
        transition: transform 0.3s cubic-bezier(0.4,0,0.2,1), width 0.3s cubic-bezier(0.4,0,0.2,1);
    }
    .app-container.sidebar-collapsed .sidebar {
        transform: translateX(calc(-1 * var(--sidebar-width)));
        width: 0;
        min-width: 0;
        overflow: hidden;
        border-right: none;
        pointer-events: none;
    }
    .main-content {
        transition: margin-left 0.3s cubic-bezier(0.4,0,0.2,1);
    }
    /* When collapsed: sidebar slides away, strip (52px) occupies left edge */
    .app-container.sidebar-collapsed .main-content {
        margin-left: 0;
    }
}

/* ═══════════════════════════════════════════
   RESPONSIVE — MOBILE
═══════════════════════════════════════════ */
@media (max-width: 768px) {
    /* ── Sidebar: always fixed overlay on mobile ── */
    .sidebar {
        position: fixed; left: 0; top: 0;
        width: 280px;
        height: var(--app-height);
        transform: translateX(-100%);
        transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
        box-shadow: 4px 0 32px rgba(0,0,0,0.18);
        z-index: 200;
    }
    .sidebar.active {
        transform: translateX(0) !important;
        pointer-events: auto !important;
    }
    /* Overlay visible when sidebar open */
    .sidebar-overlay {
        display: block;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.28s;
        z-index: 199;
    }
    .sidebar-overlay.active {
        opacity: 1;
        pointer-events: auto;
    }
    /* Collapsed class has no effect on mobile — overlay pattern handles open/close */
    .app-container.sidebar-collapsed .sidebar { transform: translateX(-100%); pointer-events: none; }
    .app-container.sidebar-collapsed .main-content { margin-left: 0 !important; }
    /* Main content always full-width on mobile */
    .main-content { margin-left: 0 !important; width: 100% !important; }
    /* Always show hamburger on mobile */
    .menu-btn { display: flex !important; }
    /* Hide desktop icon strip on mobile */
    .icon-strip { display: none !important; }

    .top-bar {
        padding: 10px 12px;
        gap: 10px;
    }
    .top-bar-left {
        gap: 8px;
        flex: 1;
    }
    .chat-title-main {
        font-size: 14px;
        max-width: 42vw;
    }
    .top-controls {
        gap: 4px;
    }
    .menu-btn,
    .icon-btn,
    .strip-btn,
    .attach-plus-btn {
        min-width: 42px;
        min-height: 42px;
    }
    .icon-btn,
    .menu-btn {
        border-radius: 10px;
    }
    .input-area { padding: 10px 12px; padding-bottom: max(10px, env(safe-area-inset-bottom)); }
    #bottomInputArea {
        padding: 10px 12px;
        padding-bottom: max(10px, env(safe-area-inset-bottom));
        transform: translateY(calc(-1 * var(--keyboard-offset)));
    }
    .chat-area { padding: 16px 12px 24px; padding-bottom: calc(var(--bottom-input-height) + 24px); }
    .messages-container { max-width: 100%; }
    .welcome-input-wrap { padding: 0 4px; }
    .welcome-section {
        padding: 20px 0 16px;
        margin: 0;
    }
    .welcome-input-wrap,
    .dashboard-health-note,
    .suggestion-chips,
    .seo-content {
        width: 100%;
    }
    .suggestion-chips { grid-template-columns: 1fr; }
    .chip {
        padding: 16px;
    }
    .seo-content { margin-top: 22px; }
    .seo-grid { grid-template-columns: 1fr; }
    .seo-panel { padding: 18px 16px; }
    .apps-page { padding: 18px 14px 28px; }
    .apps-page-header { flex-direction: column; }
    .apps-page-header h2 { font-size: 28px; }
    .apps-page-actions { width: 100%; }
    .apps-page-secondary-btn { width: 100%; justify-content: center; }
    .app-consent-card { width: min(560px, calc(100vw - 18px)); margin-top: 18px; padding: 24px 18px 18px; }
    .app-consent-title { font-size: 24px; }
    .app-consent-actions { flex-direction: column; }
    .app-consent-actions .apps-card-open,
    .app-consent-actions .apps-card-signin { width: 100%; }
    .seo-panel h3 { font-size: 22px; }
    .welcome-greeting { font-size: 22px; }
    .auth-container { padding: 24px 20px; }
    .cookie-consent { bottom: 10px; gap: 10px; }
    .cookie-consent-buttons { width: 100%; }
    .cookie-btn { flex: 1; }
    .share-popup {
        position: fixed;
        top: 64px;
        right: 12px;
        left: 12px;
        min-width: 0;
        width: auto;
    }
    .attach-popup {
        position: fixed;
        left: 12px;
        right: 12px;
        bottom: calc(72px + max(10px, env(safe-area-inset-bottom)) + var(--keyboard-offset, 0px));
        min-width: 0;
        border-radius: 16px;
        z-index: 1500;
        /* Ensure popup is well above the fixed input bar */
        pointer-events: auto;
    }
    /* Dashboard: input lives in the scrollable page, not the fixed bottom bar.
       Popup must open relative to the button, not the viewport bottom. */
    .popup-inline .attach-popup {
        position: absolute;
        bottom: calc(100% + 8px);
        left: 0;
        right: auto;
        min-width: 200px;
        z-index: 300;
    }
    .attach-option {
        padding: 14px 16px;
        font-size: 14px;
        min-height: 52px;
    }

    /* Close button always visible inside sidebar on mobile */
    .close-sidebar-btn { display: flex !important; }

    /* Sidebar footer auth / user section always visible */
    .sidebar-footer { display: flex !important; }
}

@media (max-width: 480px) {
    .top-controls {
        gap: 2px;
    }
    .chat-title-main {
        max-width: 34vw;
    }
    .dashboard-user-pill {
        display: none !important;
    }
    .input-wrapper {
        gap: 4px;
        padding: 8px 8px 8px 10px;
    }
    .message-input,
    .message-input-highlight {
        font-size: 16px;
    }
    .form-group input,
    .settings-input,
    .profile-text-input,
    .profile-textarea,
    .sidebar-search-input {
        font-size: 16px;
    }
    .auth-btn,
    .login-btn,
    .signup-btn,
    .settings-action-btn,
    .google-auth-btn {
        min-height: 44px;
    }
    .send-btn {
        width: 44px;
        height: 44px;
        min-width: 44px;
        min-height: 44px;
    }
    .message-content { max-width: 88%; font-size: 15px; padding: 10px 13px; }
    .welcome-logo-wrap { width: 60px; height: 60px; border-radius: 16px; }
    .welcome-greeting { font-size: 20px; }
    .welcome-sub { font-size: 14px; margin-bottom: 24px; }
    .temporary-chat-banner-copy { font-size: 12.5px; }
    .temporary-chat-banner-meta { font-size: 11.5px; }

    .privacy-popup-buttons { flex-direction: column; }
    .privacy-btn { max-width: 100%; }
}

/* Ensure bottom of chat is never hidden behind fixed input bar on mobile */
@media (max-width: 768px) {
    .messages-container {
        padding-bottom: calc(var(--bottom-input-height, 100px) + 16px);
    }
    .temporary-chat-banner {
        gap: 12px;
        padding: 14px;
        border-radius: 16px;
        margin-bottom: 16px;
    }
    .temporary-chat-banner-icon {
        width: 36px;
        height: 36px;
        border-radius: 10px;
    }
    /* All interactive elements in input area: reliable touch, no ghost delays */
    #bottomInputArea *,
    .welcome-input-wrap .input-container * {
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }
    /* 44px minimum tap targets everywhere in the input bar */
    #bottomInputArea button,
    #bottomInputArea .attach-option,
    .welcome-input-wrap .input-container button,
    .welcome-input-wrap .input-container .attach-option {
        min-height: 44px;
    }
    /* Send button: proper 44px circle */
    #sendBtn {
        width: 44px !important;
        height: 44px !important;
        min-width: 44px !important;
        min-height: 44px !important;
        flex-shrink: 0;
    }
    /* + Attach button: proper 44px tap target */
    .attach-plus-btn {
        width: 44px !important;
        height: 44px !important;
        min-width: 44px !important;
        min-height: 44px !important;
    }
    /* Attach popup above the fixed input bar */
    .attach-popup.open {
        pointer-events: auto;
        z-index: 1500;
    }
    /* Voice modal buttons — fully tappable */
    .voice-modal-card button {
        min-height: 44px;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }
    /* Voice stop button */
    .voice-stop-btn {
        min-height: 44px;
        min-width: 80px;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }
    /* All modal close buttons — larger tap target */
    .close-modal,
    .pricing-close-btn,
    .voice-close-btn,
    .img-lightbox-close,
    .img-lightbox-download,
    .code-panel-close-btn,
    .standalone-back-btn {
        min-width: 44px;
        min-height: 44px;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }

    /* Pricing modal buttons — full-width on small screens */
    .pricing-cta-btn {
        min-height: 48px;
        touch-action: manipulation;
    }

    /* Auth modal inputs — prevent iOS zoom (already 16px in 480px query, extend to 768px) */
    .form-group input,
    .settings-input,
    .profile-text-input,
    .profile-textarea {
        font-size: 16px;
    }

    /* Cookie consent buttons */
    .cookie-btn {
        min-height: 44px;
        touch-action: manipulation;
    }

    /* Suggestion chips */
    .chip {
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
        cursor: pointer;
    }

    /* User profile card and dropdown */
    .user-profile-card {
        min-height: 52px;
        touch-action: manipulation;
    }
    .user-action-btn {
        min-height: 44px;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }

    /* Password toggle button */
    .password-toggle {
        min-width: 44px;
        min-height: 44px;
        right: 0;
        top: 0;
        transform: none;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Auth tabs */
    .auth-tab {
        min-height: 40px;
        touch-action: manipulation;
    }

    /* Google auth button */
    .google-auth-btn {
        min-height: 48px;
        touch-action: manipulation;
    }

    /* Lightbox overlay — ensure full viewport tap area */
    .img-lightbox-overlay {
        touch-action: manipulation;
    }

    /* Prevent phantom ghost taps by using pointer-events correctly */
    .sidebar-overlay {
        touch-action: manipulation;
    }
}
.dark-mode .auth-container { border-color: var(--color-border); }
.dark-mode .input-wrapper { background: var(--color-surface); }
.dark-mode .privacy-section { background: var(--color-hover); }
.dark-mode .cookie-consent { background: #1e1e1e; border-color: var(--color-border); }
.dark-mode .auth-error-message { background: rgba(220,38,38,0.15); }

/* ── ACCESSIBILITY ── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* Focus visible */
button:focus-visible, input:focus-visible {
    outline: 2px solid var(--color-primary); outline-offset: 2px;
}
/* Textarea: suppress the square outline — glow comes from .input-wrapper:focus-within */
textarea:focus-visible { outline: none; }



/* ══════════════════════════════════════════════════════════
   SIDEBAR RESTRUCTURE — User profile at bottom, dropdown
══════════════════════════════════════════════════════════ */

/* Footer action buttons area */
.footer-actions {
    margin-bottom: 0;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--color-border);
}

/* User section — now lives inside sidebar-footer at bottom */
.user-section {
    display: none;
    padding: 10px 0 0 0;
    flex-shrink: 0;
}
.user-section.active { display: block; }

/* Profile card row */
.user-profile-card {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 10px 8px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background var(--transition);
    position: relative;
    border: 1px solid transparent;
}
.user-profile-card:hover {
    background: var(--color-hover);
    border-color: var(--color-border);
}

.user-menu-btn {
    flex-shrink: 0;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    color: var(--color-text-secondary);
    border-radius: var(--radius-sm);
    transition: background var(--transition), color var(--transition);
    display: flex;
    align-items: center;
}
.user-menu-btn:hover { background: var(--color-hover); color: var(--color-text); }

/* Dropdown */
.user-dropdown {
    display: none;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 5px;
    margin-top: 4px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.1);
    animation: fadeInUp 0.18s ease both;
}
.user-dropdown.open { display: block; }

/* ══════════════════════════════════════════════════════════
   OTP MODAL STYLES
══════════════════════════════════════════════════════════ */

.auth-modal { display: none; }
.auth-modal.active { display: flex; }

/* OTP method tabs */
.otp-method-tabs {
    display: flex;
    gap: 8px;
    margin: 4px 0 12px;
}
.otp-method-tab {
    flex: 1;
    padding: 9px 12px;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: transparent;
    font-size: 13px;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    color: var(--color-text-secondary);
    transition: all var(--transition);
}
.otp-method-tab.active {
    background: var(--color-primary-light);
    border-color: var(--color-primary);
    color: var(--color-primary);
}
.otp-method-tab:hover:not(.active) { background: var(--color-hover); }

/* 6-digit OTP input row */
.otp-input-group {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin: 8px 0 4px;
}
.otp-digit {
    width: 44px;
    height: 52px;
    border: 2px solid var(--color-border);
    border-radius: 10px;
    font-size: 22px;
    font-weight: 700;
    text-align: center;
    background: var(--color-surface);
    color: var(--color-text);
    font-family: inherit;
    transition: all var(--transition);
    outline: none;
}
.otp-digit:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(32,168,152,0.15);
}
.otp-digit:not(:placeholder-shown) {
    border-color: var(--color-primary);
    background: var(--color-primary-light);
}

/* OTP error */
.otp-error-msg {
    color: var(--color-danger);
    font-size: 13px;
    text-align: center;
    margin: 8px 0;
    padding: 10px 14px;
    background: rgba(220,38,38,0.07);
    border-radius: 8px;
    border-left: 3px solid var(--color-danger);
}

/* Resend button */
.resend-otp-btn {
    background: none;
    border: none;
    color: var(--color-primary);
    font-size: 13px;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    text-decoration: underline;
    padding: 4px 8px;
}
.resend-otp-btn:disabled {
    color: var(--color-text-secondary);
    cursor: not-allowed;
    text-decoration: none;
}

@media (max-width: 400px) {
    .otp-digit { width: 38px; height: 46px; font-size: 18px; }
    .otp-input-group { gap: 5px; }
}

/* ═══════════════════════════════════════════
   VERTICAL ICON STRIP
═══════════════════════════════════════════ */
.icon-strip {
    width: 52px;
    background: var(--color-sidebar);
    border-right: 1px solid var(--color-border);
    display: none; /* shown when sidebar collapsed on desktop */
    flex-direction: column;
    align-items: center;
    padding: 10px 0;
    gap: 2px;
    flex-shrink: 0;
    z-index: 100;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    transition: opacity 0.2s ease;
    order: -1; /* always rendered as the first (leftmost) column */
}
.app-container.sidebar-collapsed .icon-strip {
    display: flex;
}
.strip-btn {
    width: 36px; height: 36px;
    background: none; border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    border-radius: var(--radius-sm);
    color: var(--color-text-secondary);
    transition: background var(--transition), color var(--transition);
    flex-shrink: 0;
}
.strip-btn svg {
    width: 18px; height: 18px;
    stroke: currentColor; fill: none;
    stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.strip-btn:hover { background: var(--color-hover); color: var(--color-text); }
.strip-spacer { flex: 1; }
.strip-avatar {
    width: 28px; height: 28px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    color: white; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 11px; letter-spacing: 0.5px;
    pointer-events: none;
}
.strip-user-btn { padding: 0; }
.strip-user-btn:hover .strip-avatar { box-shadow: 0 0 0 2px var(--color-primary); }

/* Mobile: never show strip */
@media (max-width: 768px) {
    .icon-strip { display: none !important; }
}

/* ═══════════════════════════════════════════
   SETTINGS MODAL
═══════════════════════════════════════════ */
.settings-modal {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.55); backdrop-filter: blur(6px);
    z-index: 3000; align-items: flex-start; justify-content: center;
    padding: 20px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    animation: fadeIn 0.2s ease;
}
.settings-modal.active { display: flex; }

.settings-container {
    background: var(--color-surface);
    border-radius: var(--radius-xl);
    max-width: 780px; width: 100%;
    min-height: 0;
    max-height: calc(100dvh - 40px);
    display: flex; overflow: hidden;
    box-shadow: 0 24px 60px rgba(0,0,0,0.28);
    border: 1px solid var(--color-border);
    animation: modalIn 0.3s cubic-bezier(0.34,1.56,0.64,1) both;
    margin: auto;
}

/* Settings Sidebar (left nav) */
.settings-sidebar {
    width: 200px; flex-shrink: 0;
    background: var(--color-sidebar);
    border-right: 1px solid var(--color-border);
    display: flex; flex-direction: column;
    padding: 20px 12px 16px;
    position: relative;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.settings-logo-row {
    display: flex; align-items: center; gap: 8px;
    padding: 0 4px 16px; border-bottom: 1px solid var(--color-border);
    margin-bottom: 12px;
    min-width: 0;
}
.settings-logo-icon {
    width: 28px; height: 28px; border-radius: 8px; overflow: hidden; flex-shrink: 0;
    background: linear-gradient(135deg, #003d7a, #20a898);
}
.settings-logo-icon img { width: 100%; height: 100%; object-fit: cover; }
.settings-logo-name {
    font-size: 13px; font-weight: 600; color: var(--color-text);
    min-width: 0;
    overflow-wrap: anywhere;
}

.settings-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.settings-nav-btn {
    width: 100%; padding: 9px 10px;
    background: transparent; border: none; cursor: pointer;
    display: flex; align-items: center; gap: 9px;
    font-size: 13px; font-weight: 500; color: var(--color-text-secondary);
    border-radius: var(--radius-sm); transition: all var(--transition);
    font-family: inherit; text-align: left;
}
.settings-nav-btn svg {
    width: 16px; height: 16px; stroke: currentColor; fill: none;
    stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0;
}
.settings-nav-btn:hover { background: var(--color-hover); color: var(--color-text); }
.settings-nav-btn.active {
    background: var(--color-primary-light); color: var(--color-primary);
    font-weight: 600;
}
.settings-close-btn {
    margin-top: 12px; width: 32px; height: 32px;
    background: none; border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    border-radius: var(--radius-sm); color: var(--color-text-secondary);
    transition: all var(--transition); align-self: flex-end;
}
.settings-close-btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; }
.settings-close-btn:hover { background: var(--color-hover); color: var(--color-text); }

/* Settings Content (right panel) */
.settings-content {
    flex: 1; overflow-y: auto; padding: 24px 28px;
    min-width: 0;
    overscroll-behavior: contain;
}
.settings-tab { display: none; }
.settings-tab.active { display: block; }

.settings-section {
    margin-bottom: 28px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--color-border);
}
.settings-section:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }

.settings-section-title {
    font-size: 15px; font-weight: 700; color: var(--color-text);
    margin-bottom: 5px;
}
.settings-section-desc {
    font-size: 13px; color: var(--color-text-secondary);
    line-height: 1.6; margin-bottom: 14px;
}

/* Account Profile Header */
.account-profile-header {
    display: flex; align-items: center; gap: 16px;
    padding: 16px; background: var(--color-hover);
    border-radius: var(--radius-md); margin-bottom: 0;
    min-width: 0;
}
.account-info { min-width: 0; flex: 1; }
.account-avatar-lg {
    width: 56px; height: 56px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    color: white; border-radius: 50%; display: flex; align-items: center;
    justify-content: center; font-size: 22px; font-weight: 700; flex-shrink: 0;
}
.account-name {
    font-size: 17px; font-weight: 700; color: var(--color-text);
    word-break: break-word;
    overflow-wrap: anywhere;
}
.account-email {
    font-size: 13px; color: var(--color-text-secondary); margin: 2px 0 6px;
    word-break: break-word;
    overflow-wrap: anywhere;
}
.account-badge { font-size: 12px; color: var(--color-primary); font-weight: 600; }

.settings-guest-notice {
    display: flex; align-items: center; gap: 14px;
    padding: 16px; background: var(--color-hover); border-radius: var(--radius-md);
    border: 1px dashed var(--color-border);
}
.guest-icon { font-size: 32px; flex-shrink: 0; }
.settings-guest-notice strong { font-size: 14px; color: var(--color-text); display: block; margin-bottom: 3px; }
.settings-guest-notice p { font-size: 13px; color: var(--color-text-secondary); margin: 0; }

/* Input field */
.settings-input {
    flex: 1; padding: 10px 14px; border: 1.5px solid var(--color-border);
    border-radius: var(--radius-sm); font-size: 13.5px; color: var(--color-text);
    background: var(--color-bg); font-family: inherit; outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
}
.settings-input:focus { border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(32,168,152,0.12); }
.settings-field-row { display: flex; gap: 10px; align-items: center; }

/* Action buttons */
.settings-action-btn {
    padding: 9px 16px; border-radius: var(--radius-sm);
    font-size: 13px; font-weight: 500; cursor: pointer;
    border: 1px solid var(--color-border); background: var(--color-surface);
    color: var(--color-text); font-family: inherit;
    transition: all var(--transition); display: inline-flex; align-items: center; gap: 6px;
    white-space: nowrap; flex-shrink: 0;
}
.settings-action-btn:hover { background: var(--color-hover); }
.settings-action-btn.primary {
    background: var(--color-primary); color: white; border-color: var(--color-primary);
}
.settings-action-btn.primary:hover { background: var(--color-primary-dark); }
.settings-action-btn.danger {
    background: transparent; color: var(--color-danger); border-color: rgba(220,38,38,0.25);
}
.settings-action-btn.danger:hover { background: rgba(220,38,38,0.08); border-color: var(--color-danger); }

/* Action list rows */
.settings-action-list { display: flex; flex-direction: column; gap: 2px; }
.settings-action-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 14px; border-radius: var(--radius-md); gap: 16px;
    background: var(--color-surface); border: 1px solid var(--color-border);
    margin-bottom: 6px;
}
.settings-action-row:last-child { margin-bottom: 0; }
.danger-row { border-color: rgba(220,38,38,0.15); background: rgba(220,38,38,0.03); }
.settings-action-label { font-size: 13.5px; font-weight: 600; color: var(--color-text); margin-bottom: 2px; }
.danger-text { color: var(--color-danger); }
.settings-action-desc { font-size: 12px; color: var(--color-text-secondary); }

/* Toggle row */
.settings-toggle-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 14px; border-radius: var(--radius-md); gap: 16px;
    border: 1px solid var(--color-border); margin-bottom: 6px;
}
.toggle-switch { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
    position: absolute; cursor: pointer; inset: 0;
    background: var(--color-border); border-radius: 24px;
    transition: background 0.2s;
}
.toggle-slider::before {
    content: ''; position: absolute; width: 18px; height: 18px;
    left: 3px; bottom: 3px; background: white; border-radius: 50%;
    transition: transform 0.2s; box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle-switch input:checked + .toggle-slider { background: var(--color-primary); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); }

/* Theme picker */
.settings-theme-grid { display: flex; gap: 14px; }
.theme-option {
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    background: none; border: 2px solid var(--color-border);
    border-radius: var(--radius-md); padding: 10px 16px;
    cursor: pointer; font-family: inherit; font-size: 13px;
    color: var(--color-text-secondary); transition: all var(--transition);
}
.theme-option:hover, .theme-option.active { border-color: var(--color-primary); color: var(--color-primary); }
.theme-preview {
    width: 80px; height: 50px; border-radius: 6px; display: flex; overflow: hidden;
    border: 1px solid rgba(0,0,0,0.1);
}
.theme-preview-light { background: #fff; }
.theme-preview-light .theme-preview-sidebar { width: 28px; background: #f5f5f0; border-right: 1px solid #e5e5e0; }
.theme-preview-light .theme-preview-main { flex: 1; background: #fff; }
.theme-preview-dark { background: #1a1a1a; }
.theme-preview-dark .theme-preview-sidebar { width: 28px; background: #111; border-right: 1px solid #2e2e2e; }
.theme-preview-dark .theme-preview-main { flex: 1; background: #1a1a1a; }

/* Font size buttons */
.settings-font-btns { display: flex; gap: 10px; align-items: flex-end; }
.font-size-btn {
    width: 40px; height: 40px; background: var(--color-surface);
    border: 1.5px solid var(--color-border); border-radius: var(--radius-sm);
    cursor: pointer; font-family: inherit; color: var(--color-text-secondary);
    transition: all var(--transition); font-size: 14px; font-weight: 600;
}
.font-size-btn:hover, .font-size-btn-active { border-color: var(--color-primary); color: var(--color-primary); background: var(--color-primary-light); }
.font-size-btn-active { font-size: 14px; }
.font-size-lg { font-size: 20px; height: 48px; }

/* About header */
.about-header {
    display: flex; flex-direction: column; align-items: center;
    gap: 6px; padding: 16px 0 20px;
}
.about-logo {
    width: 64px; height: 64px; border-radius: 18px; overflow: hidden;
    background: linear-gradient(135deg, #003d7a, #20a898);
    box-shadow: 0 8px 24px rgba(32,168,152,0.3); margin-bottom: 4px;
}
.about-logo img { width: 100%; height: 100%; object-fit: cover; }
.about-title { font-size: 20px; font-weight: 700; color: var(--color-text); }
.about-version { font-size: 12px; color: var(--color-primary); font-weight: 600; }
.about-authors { font-size: 12.5px; color: var(--color-text-secondary); }

/* Link rows */
.settings-link-row {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 14px; border-radius: var(--radius-md);
    text-decoration: none; color: var(--color-text);
    border: 1px solid var(--color-border); margin-bottom: 6px;
    font-size: 13.5px; font-weight: 500; transition: all var(--transition);
    background: var(--color-surface);
}
.settings-link-row svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; flex-shrink: 0; color: var(--color-text-secondary); }
.settings-link-row .link-arrow { margin-left: auto; color: var(--color-text-secondary); }
.settings-link-row:hover { background: var(--color-hover); border-color: var(--color-primary); color: var(--color-primary); }
.settings-link-row:last-child { margin-bottom: 0; }

/* Settings responsive */
@media (max-width: 680px) {
    .settings-modal {
        align-items: stretch;
        padding: 0;
    }
    .settings-container {
        flex-direction: column;
        max-height: 100dvh;
        min-height: 100dvh;
        height: 100dvh;
        border-radius: 0;
    }
    .settings-sidebar {
        width: 100%;
        height: auto;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: flex-start;
        padding: 12px;
        border-right: none;
        border-bottom: 1px solid var(--color-border);
        overflow-x: hidden;
        overflow-y: visible;
    }
    .settings-logo-row {
        flex: 1 1 100%;
        border-bottom: none;
        padding-bottom: 8px;
        margin-bottom: 8px;
        padding-right: 40px;
    }
    .settings-nav {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 6px;
        flex: 1 1 100%;
        width: 100%;
    }
    .settings-nav-btn {
        padding: 10px 8px;
        font-size: 11px;
        flex-direction: column;
        gap: 5px;
        text-align: center;
        justify-content: center;
        min-width: 0;
        flex: 1 1 calc(50% - 6px);
        max-width: calc(50% - 3px);
        white-space: normal;
        line-height: 1.25;
    }
    .settings-nav-btn svg { width: 14px; height: 14px; }
    .settings-close-btn {
        position: absolute;
        top: 10px;
        right: 10px;
        margin-top: 0;
        flex: 0 0 auto;
    }
    .settings-content {
        padding: 16px;
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
    }
    .account-profile-header {
        align-items: flex-start;
        gap: 12px;
    }
    .settings-guest-notice,
    .settings-field-row,
    .settings-action-row,
    .settings-toggle-row,
    .settings-theme-grid,
    .settings-font-btns {
        flex-direction: column;
        align-items: stretch;
    }
    .settings-input,
    .settings-action-btn,
    .theme-option,
    .font-size-btn {
        width: 100%;
        max-width: 100%;
    }
    .settings-action-row > div:first-child,
    .settings-toggle-row > div:first-child,
    .settings-guest-notice > div:nth-child(2) {
        width: 100%;
    }
    .settings-link-row {
        align-items: flex-start;
        white-space: normal;
        overflow-wrap: anywhere;
    }
    #changeEmailOtpSection .otp-input-group {
        flex-wrap: wrap;
        justify-content: flex-start !important;
    }
    #changeEmailOtpSection > div[style*="display:flex"] {
        flex-direction: column;
        align-items: stretch;
    }
}

@media (max-width: 420px) {
    .account-profile-header {
        flex-direction: column;
    }
    .account-avatar-lg {
        width: 52px;
        height: 52px;
        font-size: 20px;
    }
    .account-name {
        font-size: 16px;
    }
    .settings-nav-btn {
        flex-basis: 100%;
        max-width: 100%;
    }
}
/* ── SHARE BUTTON & POPUP ──────────────────────────────── */
.share-btn-wrap {
    position: relative;
}
.share-btn {
    color: var(--text-secondary, #6b7280);
    transition: color 0.2s;
}
.share-btn:hover {
    color: var(--accent, #2da58e);
}
.share-popup {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background: var(--surface, #fff);
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 12px;
    padding: 14px 16px;
    min-width: 260px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.13);
    z-index: 999;
    animation: sharePopIn 0.18s ease;
}
.share-popup.visible {
    display: block;
}
@keyframes sharePopIn {
    from { opacity: 0; transform: translateY(-6px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
.share-popup-title {
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 8px;
    color: var(--text-primary, #111);
}
.share-popup-url {
    font-size: 11px;
    color: var(--text-secondary, #6b7280);
    background: var(--surface-secondary, #f3f4f6);
    border-radius: 7px;
    padding: 7px 10px;
    word-break: break-all;
    margin-bottom: 8px;
    font-family: monospace;
}
.share-popup-hint {
    font-size: 11px;
    color: var(--text-secondary, #9ca3af);
}

/* ── ORACLE MESSAGE BODY (wraps content + copy footer) ── */
.oracle-msg-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}
.oracle-msg-footer {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 2px 4px 0;
    margin-top: 2px;
}

/* ── COPY BUTTON ON AI MESSAGES ───────────────────────── */
.message.oracle {
    position: relative;
}
.copy-msg-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 5px 7px;
    border-radius: 6px;
    opacity: 1;
    transition: opacity 0.2s, background 0.2s;
    display: flex;
    align-items: center;
    color: var(--color-text-secondary, #9ca3af);
    margin-top: 4px;
    flex-shrink: 0;
    align-self: flex-end;
}
.copy-msg-btn:hover {
    background: var(--color-hover, #f3f4f6);
    color: var(--color-primary, #20a898);
}
.copy-msg-btn svg {
    width: 15px;
    height: 15px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.copy-msg-btn.copied svg {
    stroke: #22c55e;
}
.dark-mode .copy-msg-btn:hover {
    background: var(--color-hover);
}

/* ═══════════════════════════════════════════
   VOICE BUTTON — dynamic send/mic toggle
═══════════════════════════════════════════ */
.send-btn.voice-mode,
.send-btn.send-mode {
    background: var(--color-primary);
    transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
}
.send-btn.voice-mode:hover,
.send-btn.send-mode:hover {
    background: var(--color-primary-dark);
    transform: scale(1.08);
    box-shadow: 0 4px 16px rgba(32,168,152,0.4);
}
/* Both icons sit centered inside the button */
#sendIcon, #micIcon {
    position: absolute;
    transition: opacity 0.18s ease, transform 0.18s ease;
    /* Ensure icons stay centered and don't block touch events */
    pointer-events: none;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}
#sendBtn {
    position: relative;
    overflow: hidden;
}

/* ═══════════════════════════════════════════
   VOICE CHAT MODAL
═══════════════════════════════════════════ */
.voice-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 3000;
    align-items: flex-end;
    justify-content: center;
    padding: 0;
}
.voice-modal.active {
    display: flex;
}
.voice-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
.voice-modal-card {
    position: relative;
    background: var(--color-surface);
    border-radius: 28px 28px 0 0;
    width: 100%;
    max-width: 480px;
    padding: 28px 24px 36px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    box-shadow: 0 -8px 48px rgba(0,0,0,0.22);
    animation: voiceSlideUp 0.38s cubic-bezier(0.34,1.2,0.64,1) both;
    border: 1px solid var(--color-border);
    border-bottom: none;
}
@keyframes voiceSlideUp {
    from { transform: translateY(100%); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

/* Header */
.voice-modal-header {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}
.voice-modal-logo {
    width: 42px; height: 42px;
    border-radius: 12px;
    overflow: hidden;
    background: linear-gradient(135deg,#003d7a,#20a898);
    flex-shrink: 0;
    box-shadow: 0 3px 10px rgba(32,168,152,0.28);
}
.voice-modal-logo img { width:100%; height:100%; object-fit:cover; }
.voice-modal-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--color-text);
    line-height: 1.2;
}
.voice-modal-subtitle {
    font-size: 12.5px;
    color: var(--color-text-secondary);
    margin-top: 2px;
}
.voice-close-btn {
    margin-left: auto;
    width: 44px; height: 44px;
    background: var(--color-hover);
    border: none; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    color: var(--color-text-secondary);
    transition: background var(--transition), color var(--transition);
    flex-shrink: 0;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}
.voice-close-btn:hover { background: var(--color-border); color: var(--color-text); }

/* Wave area */
.voice-wave-area {
    width: 100%;
    height: 110px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}
#voiceWaveCanvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.4s;
    border-radius: 12px;
}
#voiceWaveCanvas.active { opacity: 1; }

/* Idle rings */
.voice-wave-idle {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s;
}
.voice-wave-idle.hidden { opacity: 0; pointer-events: none; }
.idle-ring {
    position: absolute;
    border-radius: 50%;
    border: 2px solid var(--color-primary);
    opacity: 0.18;
    animation: idlePulse 2.4s ease-in-out infinite;
}
.ring1 { width: 90px; height: 90px; animation-delay: 0s; }
.ring2 { width: 65px; height: 65px; animation-delay: 0.4s; opacity: 0.28; }
.ring3 { width: 44px; height: 44px; animation-delay: 0.8s; opacity: 0.4; }
@keyframes idlePulse {
    0%,100% { transform: scale(1); opacity: 0.18; }
    50%      { transform: scale(1.08); opacity: 0.35; }
}
.idle-mic-icon {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Transcript */
.voice-transcript-wrap {
    width: 100%;
    min-height: 60px;
    background: var(--color-oracle-bubble);
    border: 1px solid var(--color-border);
    border-radius: 14px;
    padding: 14px 16px;
    margin-bottom: 24px;
}
.voice-transcript {
    font-size: 14.5px;
    color: var(--color-text);
    line-height: 1.6;
    text-align: center;
    min-height: 22px;
    font-style: italic;
    color: var(--color-text-secondary);
    transition: color 0.3s;
}
.voice-transcript.has-text {
    font-style: normal;
    color: var(--color-text);
}

/* Controls */
.voice-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}
.voice-mic-btn {
    width: 72px; height: 72px;
    border-radius: 50%;
    background: var(--color-primary);
    border: none;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    color: white;
    transition: all 0.2s cubic-bezier(0.34,1.4,0.64,1);
    box-shadow: 0 6px 24px rgba(32,168,152,0.4);
    position: relative;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    -webkit-appearance: none;
    appearance: none;
    user-select: none;
}
.voice-mic-btn:hover {
    transform: scale(1.06);
    box-shadow: 0 8px 32px rgba(32,168,152,0.55);
}
.voice-mic-btn:active { transform: scale(0.95); }
.voice-mic-btn.recording {
    background: #ef4444;
    box-shadow: 0 6px 24px rgba(239,68,68,0.5);
    animation: micPulse 1.2s ease-in-out infinite;
}
@keyframes micPulse {
    0%,100% { box-shadow: 0 6px 24px rgba(239,68,68,0.5); }
    50%      { box-shadow: 0 6px 36px rgba(239,68,68,0.8), 0 0 0 14px rgba(239,68,68,0.12); }
}
.voice-mic-btn.processing {
    background: var(--color-primary-dark);
    animation: none;
    opacity: 0.8;
    cursor: not-allowed;
}
.voice-mic-label {
    font-size: 12px;
    color: var(--color-text-secondary);
    text-align: center;
}
/* Stop button — always visible, lets user end the session */
.voice-stop-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 18px;
    border-radius: 20px;
    border: 1.5px solid var(--color-danger, #ef4444);
    background: transparent;
    color: var(--color-danger, #ef4444);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.18s, color 0.18s;
    margin-top: 2px;
}
.voice-stop-btn:hover {
    background: var(--color-danger, #ef4444);
    color: #fff;
}

/* Speaking bar */
.voice-speaking-bar {
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 8px 16px;
    background: var(--color-primary-light);
    border-radius: 20px;
    margin-top: 4px;
}
.speaking-dot {
    width: 5px; height: 18px;
    background: var(--color-primary);
    border-radius: 3px;
    animation: speakBar 0.8s ease-in-out infinite;
}
.speaking-dot:nth-child(1) { animation-delay: 0s;    height: 8px; }
.speaking-dot:nth-child(2) { animation-delay: 0.1s;  height: 18px; }
.speaking-dot:nth-child(3) { animation-delay: 0.2s;  height: 12px; }
.speaking-dot:nth-child(4) { animation-delay: 0.3s;  height: 20px; }
.speaking-dot:nth-child(5) { animation-delay: 0.15s; height: 10px; }
@keyframes speakBar {
    0%,100% { transform: scaleY(0.5); opacity: 0.6; }
    50%      { transform: scaleY(1.4); opacity: 1; }
}

/* Mobile adjustments */
@media (max-width: 480px) {
    .voice-modal-card { border-radius: 22px 22px 0 0; padding: 22px 18px 32px; }
    .voice-wave-area { height: 90px; }
}

/* ══════════════════════════════════════════════════════════════
   NEW SPLIT AUTH PANEL
══════════════════════════════════════════════════════════════ */

.auth-container-wide {
    max-width: 560px !important;
    padding: 0 !important;
    /* overflow: hidden clips content on short screens — use visible instead
       and let each child manage its own overflow */
    overflow: visible !important;
    border-radius: 30px !important;
    box-shadow: 0 40px 100px rgba(9, 20, 34, 0.24) !important;
    border: 1px solid rgba(32,168,152,0.12) !important;
    /* Keep the rounded corners by applying clip-path instead */
    clip-path: inset(0 round 30px);
    /* Ensure it can grow with content and never gets squashed */
    width: 100%;
    flex-shrink: 0;
    margin: auto;
}

.auth-split-panel {
    display: block;
    /* Remove fixed min-height — on short viewports this was forcing the panel
       taller than the screen with no way to scroll */
    min-height: 0;
}

/* LEFT branding side */
.auth-brand-side {
    width: 390px;
    flex-shrink: 0;
    background:
        radial-gradient(circle at top right, rgba(255,255,255,0.16), transparent 30%),
        radial-gradient(circle at bottom left, rgba(255,255,255,0.12), transparent 28%),
        linear-gradient(160deg, #05254d 0%, #0b4d6f 45%, #20a898 100%);
    padding: 42px 34px;
    display: none !important;
    flex-direction: column;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.auth-brand-glow {
    position: absolute;
    width: 300px; height: 300px;
    border-radius: 50%;
    background: rgba(255,255,255,0.06);
    top: -80px; right: -80px;
    pointer-events: none;
}

.auth-brand-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
}

.auth-brand-kicker {
    font-size: 11px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.72);
    margin-bottom: 18px;
    font-weight: 700;
}

.auth-brand-logo {
    width: 72px; height: 72px;
    border-radius: 20px;
    overflow: hidden;
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(4px);
    margin-bottom: 18px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    border: 1px solid rgba(255,255,255,0.2);
}
.auth-brand-logo img { width: 100%; height: 100%; object-fit: cover; }

.auth-brand-title {
    font-size: 30px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 8px;
    letter-spacing: -0.6px;
}
.auth-brand-sub {
    font-size: 14px;
    color: rgba(255,255,255,0.82);
    margin-bottom: 24px;
    line-height: 1.7;
    max-width: 30ch;
}

.auth-brand-metric-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    width: 100%;
    margin-bottom: 22px;
}

.auth-brand-metric {
    padding: 14px 14px 13px;
    border-radius: 16px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.14);
    backdrop-filter: blur(10px);
}

.auth-brand-metric strong {
    display: block;
    font-size: 14px;
    color: #fff;
    margin-bottom: 5px;
}

.auth-brand-metric span {
    font-size: 12px;
    line-height: 1.55;
    color: rgba(255,255,255,0.76);
}

.auth-brand-features {
    display: flex;
    flex-direction: column;
    gap: 11px;
    width: 100%;
}
.auth-feat-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 13px;
    color: rgba(255,255,255,0.88);
    background: rgba(255,255,255,0.08);
    border-radius: 14px;
    padding: 12px 14px;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255,255,255,0.15);
    line-height: 1.55;
}
.auth-feat-icon { font-size: 14px; color: #fff; margin-top: 1px; }

/* RIGHT form side */
.auth-form-side {
    flex: 1;
    width: 100%;
    padding: 42px 36px 34px;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: auto;
    display: flex;
    flex-direction: column;
    background:
        radial-gradient(circle at top left, rgba(32,168,152,0.08), transparent 24%),
        linear-gradient(180deg, #fffefb 0%, #f9fbff 100%);
}
/* Thin teal scrollbar on form side */
.auth-form-side::-webkit-scrollbar { width: 4px; }
.auth-form-side::-webkit-scrollbar-track { background: transparent; }
.auth-form-side::-webkit-scrollbar-thumb { background: rgba(32,168,152,0.35); border-radius: 99px; }

.auth-form-header {
    margin-bottom: 22px;
}

.auth-form-kicker {
    font-size: 11px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--color-primary);
    font-weight: 700;
    margin-bottom: 10px;
}

.auth-form-title {
    font-size: 30px;
    line-height: 1.08;
    margin-bottom: 10px;
    letter-spacing: -0.04em;
}

.auth-form-copy {
    font-size: 14px;
    line-height: 1.65;
    color: var(--color-text-secondary);
    max-width: 54ch;
}

/* Tabs */
.auth-tabs {
    display: flex;
    gap: 0;
    background: rgba(15,23,42,0.05);
    border-radius: 14px;
    padding: 4px;
    margin-bottom: 22px;
}
.auth-tab {
    flex: 1;
    padding: 11px;
    border: none;
    background: transparent;
    border-radius: 10px;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}
.auth-tab.active {
    background: var(--color-surface);
    color: var(--color-text);
    box-shadow: 0 8px 20px rgba(15,23,42,0.08);
}

/* Google button */
.google-auth-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 11px 18px;
    border: 1.5px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text);
    border-radius: 14px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.18s;
    font-family: inherit;
    margin-bottom: 16px;
    box-shadow: 0 10px 22px rgba(15,23,42,0.05);
}
.google-auth-btn:hover {
    background: #fff;
    border-color: rgba(15,23,42,0.18);
    box-shadow: 0 12px 28px rgba(15,23,42,0.1);
    transform: translateY(-1px);
}

/* Divider */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
    color: var(--color-text-secondary);
    font-size: 12px;
}
.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--color-border);
}

/* Switch text */
.auth-switch-text {
    text-align: center;
    font-size: 13px;
    color: var(--color-text-secondary);
    margin-top: 14px;
}
.auth-switch-text button {
    background: none;
    border: none;
    color: var(--color-primary);
    font-weight: 600;
    cursor: pointer;
    font-size: inherit;
    font-family: inherit;
    padding: 0;
}
.auth-switch-text button:hover { text-decoration: underline; }

.auth-trust-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

.auth-trust-row span {
    display: inline-flex;
    align-items: center;
    padding: 7px 10px;
    border-radius: 999px;
    background: rgba(32,168,152,0.08);
    border: 1px solid rgba(32,168,152,0.14);
    color: var(--color-text-secondary);
    font-size: 12px;
    font-weight: 600;
}

/* ── CLOSE button on the wide auth modal ── */
.auth-container-wide .close-modal {
    position: absolute;
    top: 12px; right: 14px;
    z-index: 10;
    background: var(--color-hover);
    border: none;
    border-radius: 50%;
    width: 30px; height: 30px;
    font-size: 18px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    color: var(--color-text-secondary);
    transition: background 0.18s;
}
.auth-container-wide .close-modal:hover { background: var(--color-border); }

/* Responsive: stack on mobile */
@media (max-width: 660px) {
    .auth-modal,
    .auth-modal.page-mode {
        align-items: flex-start !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch;
        padding: 0 0 max(20px, env(safe-area-inset-bottom));
    }

    .auth-split-panel { flex-direction: column; }
    .auth-brand-side {
        width: 100%;
        padding: 24px 20px;
        min-height: auto;
        max-height: none !important;
        overflow: visible !important;
    }
    .auth-brand-metric-row { grid-template-columns: 1fr; }
    .auth-form-side {
        padding: 24px 20px 32px;
        max-height: none;
        overflow: visible;
    }
    .auth-container-wide {
        max-width: 100% !important;
        border-radius: 22px !important;
        clip-path: inset(0 round 22px);
        margin: 12px auto 0;
        min-height: auto !important;
    }
    .auth-modal.page-mode .auth-container-wide {
        min-height: auto !important;
    }
    .auth-form-title { font-size: 24px; }

    /* Gallery: horizontal scroll strip on mobile */
    .auth-gen-gallery-strip {
        flex-direction: row !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        flex-wrap: nowrap !important;
        padding: 0 0 8px !important;
        gap: 8px !important;
        scroll-snap-type: x mandatory;
    }
    .auth-gen-img-wrap {
        width: 100px !important;
        height: 100px !important;
        flex-shrink: 0;
        scroll-snap-align: start;
    }
}

/* ══════════════════════════════════════════════════════════════
   TOKEN LIMIT POPUP
══════════════════════════════════════════════════════════════ */

.token-limit-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(8px);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.token-limit-overlay.active { display: flex; }

.token-limit-modal {
    background: var(--color-surface);
    border-radius: 24px;
    padding: 40px 36px;
    max-width: 680px;
    width: 100%;
    text-align: center;
    box-shadow: 0 32px 80px rgba(0,0,0,0.35);
    border: 1px solid var(--color-border);
    animation: tokenModalIn 0.38s cubic-bezier(0.34,1.3,0.64,1) both;
}
@keyframes tokenModalIn {
    from { opacity: 0; transform: scale(0.88) translateY(20px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.token-limit-icon {
    font-size: 52px;
    margin-bottom: 12px;
    line-height: 1;
    display: block;
}
.token-limit-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 10px;
}
.token-limit-desc {
    font-size: 15px;
    color: var(--color-text-secondary);
    line-height: 1.6;
    margin-bottom: 28px;
}
.token-timer-badge {
    display: inline-block;
    background: var(--color-primary-light);
    color: var(--color-primary);
    font-weight: 700;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 14px;
    border: 1px solid rgba(32,168,152,0.3);
}

.token-limit-plans {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
    justify-content: center;
}

.token-plan-card {
    flex: 1;
    max-width: 260px;
    border: 1.5px solid var(--color-border);
    border-radius: 16px;
    padding: 22px 18px;
    text-align: left;
    position: relative;
    transition: box-shadow 0.2s, border-color 0.2s;
}
.token-plan-card:hover {
    box-shadow: 0 8px 28px rgba(0,0,0,0.1);
}
.token-plan-card.token-plan-featured {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(32,168,152,0.15);
}
.token-plan-badge {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--color-primary);
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 12px;
    border-radius: 20px;
    white-space: nowrap;
}
.token-plan-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 4px;
}
.token-plan-price {
    font-size: 26px;
    font-weight: 700;
    color: var(--color-primary);
    margin-bottom: 14px;
}
.token-plan-price span {
    font-size: 13px;
    color: var(--color-text-secondary);
    font-weight: 400;
}
.token-plan-perks {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 18px;
    font-size: 13px;
    color: var(--color-text-secondary);
}
.token-plan-btn {
    width: 100%;
    padding: 11px;
    border-radius: 10px;
    border: 1.5px solid var(--color-border);
    background: transparent;
    color: var(--color-text);
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.18s;
    font-family: inherit;
}
.token-plan-btn:hover { background: var(--color-hover); }
.token-plan-btn-primary {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}
.token-plan-btn-primary:hover { background: var(--color-primary-dark); border-color: var(--color-primary-dark); }

.token-limit-wait {
    font-size: 13px;
    color: var(--color-text-secondary);
    margin-top: 4px;
}

@media (max-width: 520px) {
    .token-limit-plans { flex-direction: column; align-items: center; }
    .token-plan-card { max-width: 100%; width: 100%; }
    .token-limit-modal { padding: 30px 18px; }
}

/* ── Premium Badge ───────────────────────────────────────── */
.premium-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 20px;
    margin-top: 2px;
    letter-spacing: 0.3px;
    line-height: 1.6;
}
.badge-pro {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
    box-shadow: 0 1px 4px rgba(245,158,11,0.4);
}
.badge-basic {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: #fff;
    box-shadow: 0 1px 4px rgba(99,102,241,0.4);
}

/* ── Premium Avatar Ring ──────────────────────────────────── */
.user-avatar.premium-avatar {
    outline: 2.5px solid #f59e0b;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(245,158,11,0.15);
}

/* ── Razorpay secure note ──────────────────────────────────── */
.token-secure-note {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: var(--color-text-secondary);
    background: var(--color-hover);
    border-radius: 8px;
    padding: 6px 12px;
    margin: 10px 0 4px;
    gap: 2px;
}

/* ── Plan card shimmer on featured ──────────────────────────── */
.token-plan-card.token-plan-featured {
    animation: planPulse 3s ease-in-out infinite;
}
@keyframes planPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(32,168,152,0.0), 0 4px 20px rgba(32,168,152,0.15); }
    50%       { box-shadow: 0 0 0 4px rgba(32,168,152,0.12), 0 4px 20px rgba(32,168,152,0.25); }
}

/* ── Token limit modal max-height scroll on small screens ─── */
.token-limit-modal {
    max-height: 92vh;
    overflow-y: auto;
}

/* ══════════════════════════════════════════════════════════
   UPGRADE BUTTON IN USER DROPDOWN
   ══════════════════════════════════════════════════════════ */
.user-action-btn.upgrade-btn {
    background: linear-gradient(135deg, #003d7a 0%, #20a898 100%);
    color: #fff !important;
    font-weight: 700;
    border-radius: 10px;
    margin-bottom: 6px;
    border: none;
    box-shadow: 0 2px 10px rgba(32,168,152,0.25);
    transition: box-shadow 0.2s, transform 0.15s;
    letter-spacing: 0.01em;
}
.user-action-btn.upgrade-btn:hover {
    box-shadow: 0 4px 18px rgba(32,168,152,0.38);
    transform: translateY(-1px);
}
.user-action-btn.upgrade-btn svg {
    stroke: #fff;
}

/* ══════════════════════════════════════════════════════════
   PRICING MODAL
   ══════════════════════════════════════════════════════════ */
.pricing-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.65);
    backdrop-filter: blur(6px);
    z-index: 10500;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.pricing-modal-overlay.active {
    display: flex;
    animation: fadeInOverlay 0.25s ease;
}
@keyframes fadeInOverlay {
    from { opacity: 0; }
    to   { opacity: 1; }
}
.pricing-modal-box {
    background: var(--color-surface, #fff);
    border-radius: 20px;
    max-width: 620px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 32px 28px 28px;
    position: relative;
    box-shadow: 0 24px 80px rgba(0,0,0,0.32);
    animation: slideUpModal 0.3s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes slideUpModal {
    from { opacity: 0; transform: translateY(32px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
.pricing-close-btn {
    position: absolute;
    top: 14px; right: 16px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--color-text-secondary, #888);
    width: 32px; height: 32px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.15s, color 0.15s;
}
.pricing-close-btn:hover {
    background: var(--color-border, #eee);
    color: var(--color-text, #111);
}
.pricing-header {
    text-align: center;
    margin-bottom: 24px;
}
.pricing-logo {
    font-size: 36px;
    margin-bottom: 8px;
}
.pricing-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--color-text, #111);
    margin: 0 0 6px;
}
.pricing-subtitle {
    font-size: 0.9rem;
    color: var(--color-text-secondary, #888);
    margin: 0 0 12px;
}
.pricing-free-note {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--color-bg, #f5f5f5);
    border: 1px solid var(--color-border, #ddd);
    border-radius: 20px;
    padding: 4px 14px;
    font-size: 0.82rem;
    color: var(--color-text-secondary, #666);
}
.pricing-free-badge {
    background: var(--color-text-secondary, #888);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 10px;
    letter-spacing: 0.05em;
}
.pricing-plans-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 18px;
}
@media (max-width: 500px) {
    .pricing-plans-grid { grid-template-columns: 1fr; }
}
.pricing-card {
    border: 1.5px solid var(--color-border, #ddd);
    border-radius: 16px;
    padding: 20px;
    position: relative;
    background: var(--color-surface, #fff);
    transition: transform 0.18s, box-shadow 0.18s;
}
.pricing-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 28px rgba(0,0,0,0.1);
}
.pricing-card-featured {
    border-color: #20a898;
    background: linear-gradient(160deg, rgba(32,168,152,0.05) 0%, rgba(0,61,122,0.04) 100%);
    box-shadow: 0 4px 20px rgba(32,168,152,0.15);
}
.pricing-popular-tag {
    position: absolute;
    top: -11px; left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(90deg, #003d7a, #20a898);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 3px 14px;
    border-radius: 20px;
    white-space: nowrap;
    letter-spacing: 0.03em;
}
.pricing-card-header {
    text-align: center;
    margin-bottom: 14px;
}
.pricing-plan-icon {
    font-size: 28px;
    display: block;
    margin-bottom: 4px;
}
.pricing-plan-name {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--color-text, #111);
}
.pricing-plan-price {
    font-size: 2rem;
    font-weight: 900;
    color: var(--color-primary, #20a898);
    line-height: 1.1;
    margin-top: 4px;
}
.pricing-plan-price span {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--color-text-secondary, #888);
}
.pricing-perks {
    list-style: none;
    padding: 0; margin: 0 0 16px;
    display: flex;
    flex-direction: column;
    gap: 7px;
}
.pricing-perks li {
    font-size: 0.84rem;
    color: var(--color-text, #333);
    display: flex;
    align-items: center;
    gap: 6px;
}
.perk-x { opacity: 0.45; }
.pricing-cta-btn {
    width: 100%;
    padding: 11px 0;
    border: none;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.15s, transform 0.15s;
}
.pricing-cta-btn:hover { opacity: 0.88; transform: translateY(-1px); }
.pricing-cta-basic {
    background: var(--color-border, #eee);
    color: var(--color-text, #111);
    border: 1.5px solid var(--color-border, #ccc);
}
.pricing-cta-pro {
    background: linear-gradient(135deg, #003d7a 0%, #20a898 100%);
    color: #fff;
    box-shadow: 0 4px 14px rgba(32,168,152,0.3);
}
.pricing-secure-row {
    text-align: center;
    font-size: 0.78rem;
    color: var(--color-text-secondary, #999);
    margin-bottom: 6px;
}
.pricing-hindi-note {
    text-align: center;
    font-size: 0.78rem;
    color: var(--color-text-secondary, #aaa);
    margin: 0;
}

/* dark mode pricing */
body.dark-mode .pricing-modal-box {
    background: #1a1f2e;
    border: 1px solid rgba(255,255,255,0.08);
}
body.dark-mode .pricing-card {
    background: #232838;
    border-color: rgba(255,255,255,0.1);
}
body.dark-mode .pricing-card-featured {
    border-color: #20a898;
    background: linear-gradient(160deg, rgba(32,168,152,0.08), rgba(0,61,122,0.06));
}
body.dark-mode .pricing-free-note {
    background: rgba(255,255,255,0.05);
    border-color: rgba(255,255,255,0.12);
}
body.dark-mode .pricing-cta-basic {
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.15);
    color: #e8eaf0;
}

/* ══════════════════════════════════════════════════════════
   AI THOUGHT TRAIL
   ══════════════════════════════════════════════════════════ */
.thought-trail-wrap {
    margin-top: 10px;
    border-top: 1px solid var(--color-border, rgba(0,0,0,0.08));
    padding-top: 8px;
}
.thought-trail-toggle {
    background: none;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--color-text-secondary, #888);
    font-size: 0.78rem;
    font-weight: 500;
    padding: 3px 6px 3px 2px;
    border-radius: 6px;
    transition: background 0.15s, color 0.15s;
    letter-spacing: 0.01em;
}
.thought-trail-toggle:hover {
    background: var(--color-bg, #f0f4f8);
    color: var(--color-primary, #20a898);
}
.trail-toggle-label {
    opacity: 0.75;
}
.thought-trail-toggle:hover .trail-toggle-label { opacity: 1; }
.trail-arrow { flex-shrink: 0; }
.thought-trail-steps {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 10px 4px 4px;
}
.trail-step {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    position: relative;
    padding-bottom: 10px;
}
.trail-step:last-child { padding-bottom: 0; }
.trail-step:last-child .trail-step-connector { display: none; }
.trail-step-icon {
    font-size: 15px;
    font-weight: 400;
    width: 26px;
    min-width: 26px;
    height: 26px;
    background: var(--color-bg, #f5f7fa);
    border: 1.5px solid var(--color-border, #e0e4ea);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
    line-height: 1;
    padding: 0;
}
.trail-step-body {
    flex: 1;
    padding-top: 3px;
}
.trail-step-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--color-text, #333);
    line-height: 1.2;
}
.trail-step-detail {
    font-size: 0.75rem;
    color: var(--color-text-secondary, #999);
    margin-top: 1px;
    line-height: 1.3;
}
.trail-step-connector {
    position: absolute;
    left: 12px;
    top: 26px;
    bottom: 0;
    width: 2px;
    background: linear-gradient(180deg, var(--color-border, #dde1e8) 0%, transparent 100%);
    border-radius: 2px;
}

/* dark mode trail */
body.dark-mode .thought-trail-wrap {
    border-top-color: rgba(255,255,255,0.08);
}
body.dark-mode .thought-trail-toggle:hover {
    background: rgba(255,255,255,0.05);
}
body.dark-mode .trail-step-icon {
    background: rgba(255,255,255,0.06);
    border-color: rgba(255,255,255,0.12);
}
body.dark-mode .trail-step-connector {
    background: linear-gradient(180deg, rgba(255,255,255,0.12) 0%, transparent 100%);
}
body.dark-mode .trail-step-label { color: #d8dce8; }
body.dark-mode .trail-step-detail { color: #7a8299; }

body.dark-mode .mobile-upload-modal-card,
body.dark-mode .mobile-bridge-card {
    background: linear-gradient(180deg, rgba(18,24,38,0.97), rgba(13,17,28,0.98));
    border-color: rgba(83, 216, 194, 0.18);
}

body.dark-mode .mobile-upload-link-box {
    background: rgba(255,255,255,0.05);
    color: #dbe2ee;
}

body.dark-mode .mobile-upload-copy,
body.dark-mode .mobile-bridge-copy,
body.dark-mode .mobile-upload-status,
body.dark-mode .mobile-bridge-status {
    color: #9ca8bb;
}


/* ── CHAT IMAGE BUBBLE ───────────────────────────────────── */
.user-image-bubble {
    padding: 0 !important;
    background: transparent !important;
    max-width: 280px;
    display: flex;
    flex-direction: column;
    gap: 0;
    border-radius: 14px;
    overflow: hidden;
}

.chat-uploaded-img {
    width: 100%;
    max-width: 280px;
    display: block;
    cursor: zoom-in;
    object-fit: cover;
    border-radius: 14px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.18);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.user-image-bubble:has(.chat-img-caption) .chat-uploaded-img {
    border-radius: 14px 14px 0 0;
}

.chat-uploaded-img:hover {
    transform: scale(1.02);
    box-shadow: 0 6px 24px rgba(0,0,0,0.22);
}

.chat-img-caption {
    font-size: 14px;
    line-height: 1.5;
    word-break: break-word;
    padding: 8px 12px;
    background: var(--color-primary, #2563eb);
    color: #fff;
    border-radius: 0 0 14px 14px;
}

.chat-img-placeholder {
    width: 220px;
    height: 130px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.07);
    border-radius: 14px;
    font-size: 13px;
    color: var(--color-text-secondary);
}

.chat-file-card {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 8px;
    padding: 10px 12px;
    border-radius: 14px;
    background: rgba(255,255,255,0.92);
    border: 1px solid rgba(0,0,0,0.08);
    box-shadow: 0 4px 14px rgba(0,0,0,0.08);
    max-width: 320px;
}

.message.user .chat-file-card {
    background: rgba(255,255,255,0.98);
}

.chat-file-icon {
    min-width: 42px;
    height: 42px;
    border-radius: 12px;
    background: rgba(32,168,152,0.12);
    color: var(--color-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.05em;
}

.chat-file-meta {
    flex: 1;
    min-width: 0;
}

.chat-file-name {
    font-size: 13px;
    font-weight: 700;
    color: #111827;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-file-sub {
    margin-top: 2px;
    font-size: 11px;
    color: #6b7280;
}

.chat-file-download-btn {
    border: none;
    border-radius: 10px;
    background: var(--color-primary);
    color: #fff;
    padding: 8px 10px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    flex-shrink: 0;
}

.chat-file-download-btn:hover {
    background: var(--color-primary-dark);
}

body.dark-mode .chat-file-card {
    background: rgba(36,36,36,0.96);
    border-color: rgba(255,255,255,0.08);
}

body.dark-mode .chat-file-name {
    color: #f3f4f6;
}

body.dark-mode .chat-file-sub {
    color: #9ca3af;
}

/* ── IMAGE LIGHTBOX ─────────────────────────────────────── */
.img-lightbox-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.88);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    align-items: center;
    justify-content: center;
    padding: 24px;
    animation: lightboxFadeIn 0.18s ease;
}

.img-lightbox-overlay.open {
    display: flex;
}

@keyframes lightboxFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.img-lightbox-box {
    position: relative;
    max-width: min(92vw, 900px);
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: lightboxScaleIn 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes lightboxScaleIn {
    from { transform: scale(0.88); opacity: 0; }
    to   { transform: scale(1);    opacity: 1; }
}

.img-lightbox-img {
    max-width: 100%;
    max-height: 88vh;
    border-radius: 12px;
    box-shadow: 0 24px 80px rgba(0,0,0,0.6);
    display: block;
    object-fit: contain;
    user-select: none;
}

/* Download button — top right */
.img-lightbox-download {
    position: absolute;
    top: -14px;
    right: 44px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(8px);
    border: 1.5px solid rgba(255,255,255,0.25);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.15s ease;
    z-index: 10001;
}

.img-lightbox-download svg {
    width: 17px;
    height: 17px;
    pointer-events: none;
}

.img-lightbox-download:hover {
    background: rgba(255,255,255,0.28);
    transform: scale(1.1);
}

/* Close button — top right corner */
.img-lightbox-close {
    position: absolute;
    top: -14px;
    right: 0px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(8px);
    border: 1.5px solid rgba(255,255,255,0.25);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.15s ease;
    z-index: 10001;
}

.img-lightbox-close svg {
    width: 16px;
    height: 16px;
    pointer-events: none;
}

.img-lightbox-close:hover {
    background: rgba(220, 53, 69, 0.6);
    transform: scale(1.1);
}

/* Mobile adjustments */
@media (max-width: 600px) {
    .img-lightbox-overlay { padding: 16px; }
    .img-lightbox-download { top: -42px; right: 44px; }
    .img-lightbox-close    { top: -42px; right: 0px; }
}

/* ═══════════════════════════════════════════════════════════
   DRAG & DROP OVERLAY
   ═══════════════════════════════════════════════════════════ */
.drag-drop-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 8000;
    background: rgba(var(--color-primary-rgb, 37, 99, 235), 0.13);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.drag-drop-overlay.active {
    display: flex;
    animation: ddFadeIn 0.15s ease;
}

@keyframes ddFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.drag-drop-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    background: var(--color-surface, #fff);
    border: 2.5px dashed var(--color-primary, #2563eb);
    border-radius: 24px;
    padding: 52px 64px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
    animation: ddScaleIn 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none;
}

@keyframes ddScaleIn {
    from { transform: scale(0.88); opacity: 0; }
    to   { transform: scale(1);    opacity: 1; }
}

.drag-drop-icon {
    width: 72px;
    height: 72px;
    color: var(--color-primary, #2563eb);
    animation: ddBounce 0.9s ease-in-out infinite alternate;
}

.drag-drop-icon svg { width: 100%; height: 100%; }

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

.drag-drop-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--color-text, #111);
    letter-spacing: -0.3px;
}

.drag-drop-sub {
    font-size: 14px;
    color: var(--color-text-secondary, #6b7280);
}

/* ═══════════════════════════════════════════════════════════
   SKELETON LOADING — shared shimmer animation
   ═══════════════════════════════════════════════════════════ */
@keyframes skeletonShimmer {
    0%   { background-position: -600px 0; }
    100% { background-position:  600px 0; }
}

.skeleton {
    background: linear-gradient(
        90deg,
        var(--skeleton-base,  #e8eaed) 25%,
        var(--skeleton-shine, #f4f5f7) 50%,
        var(--skeleton-base,  #e8eaed) 75%
    );
    background-size: 600px 100%;
    animation: skeletonShimmer 1.4s ease-in-out infinite;
    border-radius: 6px;
}

body.dark-mode .skeleton {
    --skeleton-base:  #2a2d35;
    --skeleton-shine: #363a45;
}

/* ── Sidebar chat history skeletons ─────────────────────── */
.skeleton-chat-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 4px 0;
}

.skeleton-chat-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px 12px;
    border-radius: 10px;
}

.skeleton-chat-title {
    height: 13px;
    border-radius: 6px;
}

.skeleton-chat-meta {
    height: 10px;
    width: 50%;
    border-radius: 6px;
}

/* ── Message skeleton (loading a chat session) ──────────── */
.skeleton-message-wrap {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 24px 16px;
    width: 100%;
}

.skeleton-message {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

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

.skeleton-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    flex-shrink: 0;
}

.skeleton-bubble {
    display: flex;
    flex-direction: column;
    gap: 7px;
    max-width: 65%;
}

.skeleton-line {
    height: 12px;
    border-radius: 6px;
}

.skeleton-line.short  { width: 55%; }
.skeleton-line.medium { width: 80%; }
.skeleton-line.long   { width: 100%; }
.skeleton-line.xlong  { width: 90%; }

/* ── Image upload skeleton (while FileReader loads) ─────── */
.skeleton-img-preview {
    width: 220px;
    height: 140px;
    border-radius: 14px;
    flex-shrink: 0;
}

/* ── Welcome chips skeleton ─────────────────────────────── */
.skeleton-chips {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    padding: 8px 0;
}

.skeleton-chip {
    height: 38px;
    border-radius: 20px;
}

/* ══════════════════════════════════════════════
   DRAG & DROP OVERLAY
   ══════════════════════════════════════════════ */
#dragDropOverlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(32, 168, 152, 0.13);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.18s ease;
    border: 3px dashed transparent;
}
#dragDropOverlay.active {
    opacity: 1;
    pointer-events: none; /* overlay is visual only — drop still fires on body */
    border: 3px dashed var(--primary, #20a898);
}
.drag-drop-inner {
    background: var(--surface, #fff);
    border: 2.5px dashed var(--primary, #20a898);
    border-radius: 24px;
    padding: 48px 64px;
    text-align: center;
    box-shadow: 0 8px 40px rgba(32,168,152,0.18);
    transform: scale(0.95);
    transition: transform 0.18s ease;
}
#dragDropOverlay.active .drag-drop-inner {
    transform: scale(1);
}
.drag-drop-icon {
    font-size: 56px;
    margin-bottom: 14px;
    animation: drag-bounce 0.6s ease infinite alternate;
}
@keyframes drag-bounce {
    from { transform: translateY(0); }
    to   { transform: translateY(-8px); }
}
.drag-drop-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--primary, #20a898);
    margin-bottom: 6px;
}
.drag-drop-sub {
    font-size: 14px;
    color: var(--text-secondary, #6b7280);
}

/* Dark mode */
body.dark-mode #dragDropOverlay {
    background: rgba(32, 168, 152, 0.10);
}
body.dark-mode .drag-drop-inner {
    background: var(--surface, #1e2736);
}

/* ── NOTIFICATION BELL ── */
.notif-bell-btn {
    position: relative;
}
.notif-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    font-size: 8px;
    color: #ef4444;
    line-height: 1;
    pointer-events: none;
    animation: notif-pulse 2s infinite;
}
@keyframes notif-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.3); }
}

/* ═══════════════════════════════════════════
   CODE PANEL (right slide-in)
═══════════════════════════════════════════ */
.code-panel-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,0.18);
    z-index: 1200; opacity: 0;
    transition: opacity 0.25s ease;
    pointer-events: none; /* lets clicks pass through to chat */
}
.code-panel-overlay.active { display: block; opacity: 1; pointer-events: none; }

.code-panel {
    position: fixed; top: 0; right: 0; bottom: 0;
    width: min(560px, 92vw);
    background: #0d1117;
    border-left: 1px solid rgba(255,255,255,0.07);
    z-index: 1201;
    display: flex; flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.32s cubic-bezier(0.4,0,0.2,1);
    box-shadow: -8px 0 40px rgba(0,0,0,0.45);
}
.code-panel.open { transform: translateX(0); }

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

.code-panel-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 16px;
    background: #161b22;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    flex-shrink: 0;
}
.code-panel-title-row {
    display: flex; align-items: center; gap: 10px;
}
.code-panel-icon {
    width: 28px; height: 28px; border-radius: 7px;
    background: linear-gradient(135deg, #003d7a, #20a898);
    display: flex; align-items: center; justify-content: center;
    color: white; flex-shrink: 0;
}
.code-panel-title {
    font-size: 14px; font-weight: 600; color: #e6edf3;
    font-family: 'DM Sans', sans-serif;
}
.code-panel-lang-badge {
    font-size: 10px; font-weight: 700; letter-spacing: 0.08em;
    padding: 2px 8px; border-radius: 20px;
    background: rgba(32,168,152,0.18); color: #20a898;
    border: 1px solid rgba(32,168,152,0.3);
    text-transform: uppercase;
}
.code-panel-actions { display: flex; align-items: center; gap: 8px; }

.code-panel-copy-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 14px; border: 1px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.05); color: #8b949e;
    border-radius: 8px; font-size: 12.5px; font-weight: 500;
    font-family: 'DM Sans', sans-serif; cursor: pointer;
    transition: all 0.2s ease;
}
.code-panel-copy-btn:hover {
    background: rgba(32,168,152,0.15); border-color: rgba(32,168,152,0.4);
    color: #20a898;
}
.code-panel-copy-btn.copied {
    background: rgba(32,168,152,0.15); border-color: rgba(32,168,152,0.5);
    color: #20a898;
}
.code-panel-close-btn {
    width: 30px; height: 30px; display: flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.08);
    border-radius: 7px; color: #8b949e; cursor: pointer;
    transition: all 0.2s ease;
}
.code-panel-close-btn:hover { background: rgba(220,38,38,0.15); border-color: rgba(220,38,38,0.3); color: #f85149; }

.code-panel-body {
    flex: 1; overflow: auto; padding: 0;
}
.code-panel-pre {
    margin: 0; padding: 20px; min-height: 100%;
    background: transparent;
    font-size: 13.5px; line-height: 1.7;
    font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
    tab-size: 2;
}
.code-panel-code {
    color: #e6edf3; white-space: pre; display: block;
}

/* Syntax highlight colors (applied by JS) */
.code-kw  { color: #ff7b72; }   /* keywords */
.code-str { color: #a5d6ff; }   /* strings */
.code-cmt { color: #8b949e; font-style: italic; }  /* comments */
.code-num { color: #79c0ff; }   /* numbers */
.code-fn  { color: #d2a8ff; }   /* functions */
.code-tag { color: #7ee787; }   /* html tags */
.code-atr { color: #79c0ff; }   /* attributes */

/* In-chat code block "Open in panel" button */
.open-code-panel-btn {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 4px 10px; margin-top: 6px;
    background: rgba(32,168,152,0.1); border: 1px solid rgba(32,168,152,0.25);
    border-radius: 6px; color: var(--color-primary); font-size: 12px;
    font-weight: 600; cursor: pointer; font-family: inherit;
    transition: all 0.2s ease;
}
.open-code-panel-btn:hover {
    background: rgba(32,168,152,0.2); border-color: rgba(32,168,152,0.45);
    transform: translateX(2px);
}

.apps-page-disabled {
    min-height: 260px;
    align-items: center;
    justify-content: center;
}

.standalone-page {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2100;
    background:
        radial-gradient(circle at top left, rgba(32,168,152,0.12), transparent 24%),
        radial-gradient(circle at bottom right, rgba(0,61,122,0.08), transparent 28%),
        linear-gradient(180deg, #f5f7f3 0%, #ffffff 58%);
    overflow-y: auto;
}

.standalone-page.active {
    display: block;
}

.standalone-page-shell {
    max-width: 1100px;
    margin: 0 auto;
    padding: 28px 22px 40px;
}

.standalone-page-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
}

.standalone-page-title-wrap h2 {
    font-family: 'DM Serif Display', Georgia, serif;
    font-size: 32px;
    line-height: 1.1;
}

.standalone-page-eyebrow {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: #0f766e;
    margin-bottom: 6px;
}

.standalone-back-btn,
.standalone-link-btn,
.secondary-page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 16px;
    border-radius: 999px;
    border: 1px solid var(--color-border);
    background: rgba(255,255,255,0.9);
    color: var(--color-text);
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
}

.standalone-back-btn svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2.2;
}

.profile-page-grid {
    display: grid;
    grid-template-columns: 1.15fr 0.95fr;
    gap: 20px;
}

.profile-card {
    padding: 26px;
    border-radius: 28px;
    background: rgba(255,255,255,0.94);
    border: 1px solid rgba(15,23,42,0.08);
    box-shadow: 0 26px 52px rgba(15,23,42,0.06);
}

.profile-card-hero {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1.3fr auto;
    gap: 20px;
    background:
        radial-gradient(circle at top right, rgba(15,118,110,0.16), transparent 28%),
        linear-gradient(135deg, rgba(0,61,122,0.98), rgba(15,118,110,0.95));
    color: white;
}

.profile-hero-main {
    display: flex;
    align-items: center;
    gap: 18px;
}

.profile-hero-avatar {
    width: 82px;
    height: 82px;
    border-radius: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 700;
    background: rgba(255,255,255,0.18);
    border: 1px solid rgba(255,255,255,0.28);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.18);
}

.profile-hero-label,
.profile-field-note {
    font-size: 13px;
    line-height: 1.6;
}

.profile-card-hero .profile-hero-label,
.profile-card-hero p {
    color: rgba(255,255,255,0.82);
}

.profile-card-hero h3 {
    font-size: 34px;
    line-height: 1.1;
    margin: 4px 0 6px;
}

.profile-hero-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
    align-self: start;
}

.profile-hero-badge {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.18);
    color: rgba(255,255,255,0.92);
    font-size: 12px;
    font-weight: 700;
}

.profile-hero-stats {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.profile-stat-chip {
    padding: 14px 16px;
    border-radius: 18px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.14);
    backdrop-filter: blur(8px);
}

.profile-stat-value {
    display: block;
    font-size: 20px;
    font-weight: 700;
    color: #fff;
}

.profile-stat-label {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: rgba(255,255,255,0.72);
}

.profile-card-head h3 {
    font-size: 22px;
    line-height: 1.15;
    margin-top: 4px;
}

.profile-card-copy {
    margin-top: 8px;
    font-size: 13px;
    line-height: 1.65;
    color: var(--color-text-secondary);
}

.profile-field-label {
    display: block;
    margin: 18px 0 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-secondary);
}

.profile-text-input,
.profile-textarea {
    width: 100%;
    border-radius: 18px;
    border: 1px solid var(--color-border);
    background: linear-gradient(180deg, #ffffff, #fbfcff);
    color: var(--color-text);
    padding: 14px 16px;
    font: inherit;
}

.profile-text-input:focus,
.profile-textarea:focus {
    outline: none;
    border-color: rgba(32,168,152,0.42);
    box-shadow: 0 0 0 4px rgba(32,168,152,0.12);
}

.profile-textarea {
    min-height: 168px;
    resize: vertical;
}

.profile-perks-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 18px;
}

.profile-perk-item {
    padding: 14px 14px 13px;
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(32,168,152,0.06), rgba(15,23,42,0.02));
    border: 1px solid rgba(32,168,152,0.1);
}

.profile-perk-item strong {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    color: var(--color-text);
}

.profile-perk-item span {
    display: block;
    font-size: 12.5px;
    line-height: 1.55;
    color: var(--color-text-secondary);
}

.profile-action-stack {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.profile-save-btn,
.secondary-page-btn {
    width: 100%;
}

.secondary-page-btn {
    border-radius: 16px;
    padding: 13px 16px;
    border: 1px solid rgba(15,23,42,0.1);
    background: rgba(15,23,42,0.03);
    font-weight: 700;
}

.text-page-link {
    font-size: 13px;
    font-weight: 600;
    color: #0f766e;
    text-decoration: none;
    text-align: center;
}

.auth-modal.page-mode,
.settings-modal.page-mode {
    background:
        radial-gradient(circle at top left, rgba(15,118,110,0.13), transparent 28%),
        linear-gradient(180deg, #f6f5ef 0%, #ffffff 58%);
    backdrop-filter: none;
    padding: 0;
}

.auth-modal.page-mode {
    position: relative;
    inset: auto;
    display: block;
    min-height: 100vh;
    min-height: 100dvh;
    overflow: visible;
}

.auth-modal.page-mode.active {
    display: block;
}

.auth-modal.page-mode .auth-container-wide,
.settings-modal.page-mode .settings-container {
    width: 100%;
    max-width: none !important;
    min-height: 100dvh;
    margin: 0;
    border-radius: 0;
    box-shadow: none;
    border: none;
}

.auth-modal.page-mode .auth-container-wide {
    animation: none;
}

.settings-modal.page-mode .settings-container {
    max-height: none;
}

@media (max-width: 900px) {
    .profile-page-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .dashboard-user-pill {
        display: none !important;
    }

    .welcome-sub {
        margin-bottom: 18px;
    }

    .standalone-page-shell {
        padding: 18px 14px 28px;
    }

    .standalone-page-topbar {
        flex-wrap: wrap;
        align-items: flex-start;
    }

    .standalone-page-title-wrap h2 {
        font-size: 26px;
    }

    .profile-card,
    .profile-card-hero {
        padding: 18px;
    }

    .profile-card-hero {
        grid-template-columns: 1fr;
    }

    .profile-hero-main {
        align-items: flex-start;
    }

    .profile-hero-badges {
        justify-content: flex-start;
    }

    .profile-hero-stats,
    .profile-perks-grid {
        grid-template-columns: 1fr;
    }

    .auth-modal.page-mode .auth-container-wide .close-modal,
    .settings-modal.page-mode .settings-close-btn {
        top: 12px;
        right: 12px;
    }
}
/* ============================================================
   WELLNESS ORACLE — IMAGE GENERATION STYLES
   Add this to the bottom of style.css
   ============================================================ */

/* ── Image Gen Button (in input bar) ── */
.wo-image-gen-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1.5px solid rgba(32, 168, 152, 0.3);
  background: rgba(32, 168, 152, 0.08);
  color: var(--color-primary, #20a898);
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}
.wo-image-gen-btn:hover {
  background: rgba(32, 168, 152, 0.18);
  border-color: rgba(32, 168, 152, 0.6);
  transform: scale(1.05);
}
.wo-image-gen-btn svg { pointer-events: none; }

/* ── Floating Panel ── */
.wo-image-gen-panel {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease;
}
.wo-image-gen-panel.open {
  pointer-events: all;
  opacity: 1;
}
.wo-panel-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
}
.wo-panel-card {
  position: relative;
  z-index: 1;
  width: min(560px, 100vw);
  background: var(--color-surface, #fff);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.18);
  transform: translateY(30px);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  overflow: hidden;
  border-top: 1px solid rgba(32, 168, 152, 0.2);
}
.wo-image-gen-panel.open .wo-panel-card {
  transform: translateY(0);
}

.wo-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px 14px;
  border-bottom: 1px solid var(--color-border, rgba(0,0,0,0.08));
}
.wo-panel-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text, #111);
}
.wo-panel-close {
  background: none;
  border: none;
  color: var(--color-text-secondary, #888);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  transition: color 0.15s;
}
.wo-panel-close:hover { color: var(--color-text, #111); }

.wo-panel-body {
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.wo-panel-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--color-text-secondary, #888);
  margin-bottom: -4px;
}

/* ── Suggestion chips ── */
.wo-img-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  min-height: 36px;
}
.wo-suggest-chip {
  background: rgba(32, 168, 152, 0.08);
  border: 1px solid rgba(32, 168, 152, 0.25);
  color: var(--color-primary, #20a898);
  font-size: 12px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wo-suggest-chip:hover {
  background: rgba(32, 168, 152, 0.18);
  border-color: rgba(32, 168, 152, 0.5);
}
.wo-suggest-loading {
  font-size: 12px;
  color: var(--color-text-secondary, #aaa);
  font-style: italic;
}

/* ── Prompt textarea ── */
.wo-img-prompt-input {
  width: 100%;
  background: var(--color-input-bg, #f8f8f8);
  border: 1.5px solid var(--color-border, rgba(0,0,0,0.1));
  border-radius: 12px;
  color: var(--color-text, #111);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
  padding: 12px 14px;
  resize: none;
  transition: border-color 0.2s;
}
.wo-img-prompt-input:focus {
  outline: none;
  border-color: var(--color-primary, #20a898);
}
.wo-img-prompt-input::placeholder { color: var(--color-text-secondary, #aaa); }

/* ── Style selector ── */
.wo-style-grid {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.wo-style-btn {
  background: var(--color-input-bg, #f4f4f4);
  border: 1.5px solid var(--color-border, rgba(0,0,0,0.1));
  color: var(--color-text-secondary, #666);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 7px 14px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.15s;
}
.wo-style-btn:hover {
  border-color: var(--color-primary, #20a898);
  color: var(--color-primary, #20a898);
}
.wo-style-btn.active {
  background: rgba(32, 168, 152, 0.12);
  border-color: var(--color-primary, #20a898);
  color: var(--color-primary, #20a898);
  font-weight: 600;
}

/* ── Panel footer ── */
.wo-panel-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px 20px;
  border-top: 1px solid var(--color-border, rgba(0,0,0,0.07));
}
.wo-powered-by {
  font-size: 11px;
  color: var(--color-text-secondary, #aaa);
}
.wo-gen-primary-btn {
  background: linear-gradient(135deg, #20a898, #0f7a6d);
  color: white;
  border: none;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  padding: 11px 28px;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
  letter-spacing: 0.3px;
}
.wo-gen-primary-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(32, 168, 152, 0.38);
}
.wo-gen-primary-btn:disabled { opacity: 0.65; cursor: not-allowed; transform: none; }

/* ── Spinner ── */
.wo-gen-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.35);
  border-top-color: white;
  border-radius: 50%;
  animation: woSpin 0.75s linear infinite;
  display: inline-block;
}
@keyframes woSpin { to { transform: rotate(360deg); } }

/* ── Generated image in chat ── */
.wo-gen-image-bubble {
  padding: 0 !important;
  overflow: hidden;
  border-radius: 14px !important;
  border: 1px solid rgba(32, 168, 152, 0.2) !important;
  background: var(--color-surface, #fff) !important;
  max-width: 420px;
}
.wo-gen-image-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-primary, #20a898);
  padding: 10px 14px 6px;
  letter-spacing: 0.5px;
}
.wo-gen-image-result {
  width: 100%;
  max-width: 420px;
  height: auto;
  display: block;
  border-top: 1px solid rgba(32,168,152,0.1);
  border-bottom: 1px solid rgba(32,168,152,0.1);
}
.wo-gen-image-prompt-text {
  font-size: 12px;
  color: var(--color-text-secondary, #888);
  padding: 8px 14px 4px;
  font-style: italic;
  line-height: 1.5;
}
.wo-gen-image-actions {
  display: flex;
  gap: 6px;
  padding: 8px 14px 12px;
}
.wo-gen-action-btn {
  background: rgba(32, 168, 152, 0.08);
  border: 1px solid rgba(32, 168, 152, 0.22);
  color: var(--color-primary, #20a898);
  font-size: 12px;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.wo-gen-action-btn:hover {
  background: rgba(32, 168, 152, 0.18);
}

/* ── Loading progress bar ── */
.wo-gen-progress {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.wo-gen-progress span {
  font-size: 13px;
  color: var(--color-text-secondary, #888);
}
.wo-gen-bar {
  height: 3px;
  background: rgba(32,168,152,0.15);
  border-radius: 3px;
  overflow: hidden;
  width: 200px;
}
.wo-gen-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #20a898, #0f7a6d);
  border-radius: 3px;
  animation: woProgress 3s ease-in-out infinite;
  width: 30%;
}
@keyframes woProgress {
  0%   { width: 10%; margin-left: 0; }
  50%  { width: 60%; margin-left: 20%; }
  100% { width: 10%; margin-left: 90%; }
}

/* ── Dark mode support ── */
body.dark-mode .wo-panel-card,
[data-theme="dark"] .wo-panel-card {
  background: #1a1a24;
  border-top-color: rgba(32,168,152,0.25);
}
body.dark-mode .wo-img-prompt-input,
[data-theme="dark"] .wo-img-prompt-input {
  background: #111118;
  border-color: rgba(255,255,255,0.1);
  color: #f0eeff;
}
body.dark-mode .wo-img-prompt-input::placeholder,
[data-theme="dark"] .wo-img-prompt-input::placeholder {
  color: #555;
}
body.dark-mode .wo-style-btn,
[data-theme="dark"] .wo-style-btn {
  background: #111118;
  border-color: rgba(255,255,255,0.1);
  color: #aaa;
}
body.dark-mode .wo-gen-image-bubble,
[data-theme="dark"] .wo-gen-image-bubble {
  background: #1a1a24 !important;
}
/* ============================================================
   AUTH GALLERY — SCROLL FIX
   Images from Supabase were pushing the brand panel taller
   than the viewport and cutting off all content.
   ============================================================ */

/* Brand side: scroll instead of clip when images load */
.auth-brand-side {
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    max-height: 100dvh;
    justify-content: flex-start !important;
}

/* Gallery wrapper */
.auth-gen-gallery-wrap {
    margin-top: 24px;
    width: 100%;
    flex-shrink: 0;
}

.auth-gen-gallery-label {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.6);
    margin-bottom: 10px;
}

.auth-gen-gallery-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: #20a898;
    display: inline-block;
    flex-shrink: 0;
}

/* Gallery strip: fixed height horizontal scroll — images NEVER expand vertically */
.auth-gen-gallery-strip {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    gap: 8px;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    padding-bottom: 6px;
    height: 110px; /* fixed — images can never push layout taller */
}

.auth-gen-gallery-strip::-webkit-scrollbar { height: 3px; }
.auth-gen-gallery-strip::-webkit-scrollbar-track { background: rgba(255,255,255,0.08); border-radius: 99px; }
.auth-gen-gallery-strip::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.25); border-radius: 99px; }

.auth-gen-gallery-loading {
    display: flex;
    align-items: center;
    gap: 8px;
    color: rgba(255,255,255,0.5);
    font-size: 12px;
    height: 100%;
}

.auth-gen-spinner {
    width: 14px; height: 14px;
    border: 2px solid rgba(255,255,255,0.2);
    border-top-color: rgba(255,255,255,0.7);
    border-radius: 50%;
    animation: genSpin 0.75s linear infinite;
    flex-shrink: 0;
}
@keyframes genSpin { to { transform: rotate(360deg); } }

/* Each image tile: fixed size, never expands */
.auth-gen-img-wrap {
    width: 100px !important;
    height: 100px !important;
    flex-shrink: 0;
    border-radius: 10px;
    overflow: hidden;
    scroll-snap-align: start;
    background: rgba(255,255,255,0.08);
    cursor: pointer;
}

.auth-gen-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.2s;
}
.auth-gen-img:hover { transform: scale(1.05); }
