/* ==========================================================================
   General Chat — layout, sidebar, responsive
   plans.css provides chat component styles (messages, input, welcome, etc.)
   ========================================================================== */

/* ── Page-level override: flex column from body so main fills exactly ── */
body.gchat-page {
    height: 100vh !important;
    max-height: 100vh !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
}

body.gchat-page .app-header {
    flex-shrink: 0 !important;
}

body.gchat-page .app-main {
    flex: 1 !important;
    min-height: 0 !important;
    height: auto !important;
    padding: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
    overflow: hidden !important;
    display: block !important;
}

body.gchat-page .app-footer {
    display: none !important;
}

/* ── Layout: sidebar + chat (flexbox) ── */
.gchat-layout {
    display: flex;
    height: 100%;
    overflow: hidden;
    position: relative;
}

/* ── Sidebar ── */
.gchat-sidebar {
    width: 280px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: #0a0f24;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    z-index: 51;
}

.gchat-layout.gchat-sidebar-collapsed .gchat-sidebar {
    margin-left: -280px;
}

/* When sidebar is collapsed, add left breathing room so messages aren't flush to screen edge */
.gchat-layout.gchat-sidebar-collapsed .gchat-root {
    padding-left: 3.5rem;
    transition: padding-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.gchat-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}

.gchat-new-chat-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0.5rem 1rem;
    background: rgba(255, 201, 85, 0.1);
    border: 1px solid rgba(255, 201, 85, 0.2);
    border-radius: 10px;
    color: var(--plans-accent, #ffc955);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.gchat-new-chat-btn:hover {
    background: rgba(255, 201, 85, 0.18);
    border-color: rgba(255, 201, 85, 0.35);
}

.gchat-sidebar-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--plans-muted, rgba(246, 247, 255, 0.45));
    cursor: pointer;
    border-radius: 8px;
    padding: 0;
    transition: color 0.15s, background 0.15s;
}

.gchat-sidebar-close:hover {
    color: var(--plans-text, #f6f7ff);
    background: rgba(255, 255, 255, 0.06);
}

.gchat-sidebar-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

.gchat-sidebar-empty {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--plans-muted, rgba(246, 247, 255, 0.35));
    font-size: 0.82rem;
    line-height: 1.6;
}

.gchat-sidebar-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0.6rem 0.75rem;
    border-radius: 10px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background 0.15s;
    position: relative;
    margin-bottom: 2px;
}

.gchat-sidebar-item:hover {
    background: rgba(255, 255, 255, 0.04);
}

.gchat-sidebar-item.is-active {
    background: rgba(91, 156, 244, 0.08);
    border-color: rgba(91, 156, 244, 0.12);
}

.gchat-sidebar-item-content {
    flex: 1;
    min-width: 0;
}

.gchat-sidebar-item-preview {
    font-size: 0.82rem;
    color: var(--plans-text, #f6f7ff);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
}

.gchat-sidebar-item-meta {
    font-size: 0.7rem;
    color: var(--plans-muted, rgba(246, 247, 255, 0.35));
    margin-top: 2px;
}

.gchat-sidebar-item-delete {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    color: var(--plans-muted, rgba(246, 247, 255, 0.3));
    cursor: pointer;
    border-radius: 6px;
    padding: 0;
    opacity: 0;
    transition: opacity 0.15s, color 0.15s, background 0.15s;
    flex-shrink: 0;
}

.gchat-sidebar-item:hover .gchat-sidebar-item-delete {
    opacity: 1;
}

.gchat-sidebar-item-delete:hover {
    color: #f87171;
    background: rgba(248, 113, 113, 0.1);
}

/* ── Mobile sidebar backdrop ── */
.gchat-sidebar-backdrop {
    display: none;
}

/* ── Hamburger toggle ── */
.gchat-hamburger {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(255, 255, 255, 0.04);
    color: var(--plans-muted, rgba(246, 247, 255, 0.55));
    cursor: pointer;
    border-radius: 8px;
    padding: 0;
    transition: opacity 0.2s, color 0.15s, background 0.15s;
}

.gchat-hamburger:hover {
    color: var(--plans-text, #f6f7ff);
    background: rgba(255, 255, 255, 0.08);
}

/* Hide hamburger when sidebar is open (desktop only) */
.gchat-layout:not(.gchat-sidebar-collapsed) .gchat-hamburger {
    opacity: 0;
    pointer-events: none;
}

/* ── Main chat area ── */
.gchat-root {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    position: relative;
    padding: 0;
    transition: flex-basis 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Chat card (fills root, scrollbar hugs right edge) ── */
.gchat-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: 100% !important;
    max-height: none !important;
    width: 100%;
    padding: 0 !important;
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
    position: relative !important;
    overflow: hidden !important;
    align-self: stretch !important;
    border-radius: 0 !important;
}

/* ── Sidebar mobile nav + profile (hidden on desktop, shown on mobile) ── */
.gchat-sidebar-nav {
    display: none;
}
.gchat-sidebar-profile {
    display: none;
}

/* ── Tablet / Vertical monitor: sidebar overlay ── */
@media (max-width: 768px) {
    /* Hide the header on mobile for chat page */
    body.gchat-page .app-header {
        display: none !important;
    }

    /* Chat layout takes full viewport height */
    body.gchat-page .app-main {
        height: 100vh !important;
    }

    .gchat-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: 280px;
        margin-left: 0 !important;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .gchat-layout.gchat-sidebar-collapsed .gchat-sidebar {
        transform: translateX(-100%);
        margin-left: 0 !important;
    }

    /* When sidebar collapsed on mobile, no left padding — full width */
    .gchat-layout.gchat-sidebar-collapsed .gchat-root {
        padding-left: 0 !important;
    }

    .gchat-layout:not(.gchat-sidebar-collapsed) .gchat-sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.55);
        z-index: 50;
    }

    /* Always show hamburger on mobile/tablet */
    .gchat-layout:not(.gchat-sidebar-collapsed) .gchat-hamburger {
        opacity: 1;
        pointer-events: auto;
    }

    /* Hide the input row when sidebar is open on mobile */
    .gchat-layout:not(.gchat-sidebar-collapsed) .plans-chat-input-row {
        display: none !important;
    }

    /* Show sidebar nav + profile sections on mobile */
    .gchat-sidebar-nav {
        display: flex;
        flex-direction: column;
        gap: 2px;
        padding: 0.5rem 0.65rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    }

    .gchat-sidebar-nav-link {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 0.55rem 0.75rem;
        border-radius: 10px;
        color: rgba(246, 247, 255, 0.7);
        text-decoration: none;
        font-size: 0.88rem;
        font-weight: 500;
        transition: background 0.15s, color 0.15s;
    }

    .gchat-sidebar-nav-link:hover {
        background: rgba(255, 255, 255, 0.06);
        color: #f6f7ff;
    }

    .gchat-sidebar-nav-link.gchat-sidebar-nav-active {
        background: rgba(91, 156, 244, 0.1);
        color: #8abcff;
    }

    .gchat-sidebar-nav-link svg {
        opacity: 0.7;
        flex-shrink: 0;
    }

    .gchat-sidebar-nav-link.gchat-sidebar-nav-active svg {
        opacity: 1;
    }

    /* Profile section at bottom */
    .gchat-sidebar-profile {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        padding: 0.75rem;
        border-top: 1px solid rgba(255, 255, 255, 0.06);
        margin-top: auto;
        flex-shrink: 0;
    }

    .gchat-sidebar-profile-info {
        display: flex;
        flex-direction: column;
        gap: 4px;
    }

    .gchat-sidebar-profile-badge {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        font-size: 0.78rem;
        font-weight: 600;
        padding: 3px 8px;
        border-radius: 6px;
        width: fit-content;
    }

    .gchat-sidebar-profile-badge.plan-tier-badge--elite {
        background: rgba(255, 201, 85, 0.12);
        color: #ffc955;
    }

    .gchat-sidebar-profile-badge.plan-tier-badge--pro {
        background: rgba(91, 156, 244, 0.12);
        color: #8abcff;
    }

    .gchat-sidebar-profile-badge.plan-tier-badge--free {
        background: rgba(255, 255, 255, 0.06);
        color: rgba(246, 247, 255, 0.6);
    }

    .gchat-sidebar-profile-badge-icon {
        font-size: 0.85rem;
    }

    .gchat-sidebar-profile-email {
        font-size: 0.78rem;
        color: rgba(246, 247, 255, 0.45);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .gchat-sidebar-logout,
    .gchat-sidebar-login-link {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 0.5rem 0.75rem;
        border-radius: 8px;
        color: rgba(246, 247, 255, 0.55);
        text-decoration: none;
        font-size: 0.82rem;
        transition: background 0.15s, color 0.15s;
    }

    .gchat-sidebar-logout:hover {
        background: rgba(248, 113, 113, 0.1);
        color: #f87171;
    }

    .gchat-sidebar-login-link:hover {
        background: rgba(91, 156, 244, 0.1);
        color: #8abcff;
    }
}

.gchat-card .plans-chat-body {
    flex: 1;
    display: flex !important;
    flex-direction: column;
    min-height: 0;
    overflow: hidden !important;
    padding-bottom: 0 !important;
    grid-template-rows: none !important;
}

.gchat-card .plans-chat-stage {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    scroll-behavior: smooth;
    /* scrollbar sits flush against right edge */
}

.gchat-card .plans-chat-messages {
    min-height: 100%;
    max-height: none;
    max-width: 1200px;
    margin: 0 auto !important;
    padding: 56px 1.5rem 1rem !important;
    width: 100%;
    box-sizing: border-box;
    overflow: visible !important;
    overscroll-behavior: unset !important;
}

.gchat-card .plans-chat-input-row {
    padding-top: 0.5rem;
    padding-bottom: 0.75rem;
    background: transparent;
    /* Center the input shell within full-width row */
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
    flex-shrink: 0 !important;
    position: relative;
    z-index: 5;
}

/* Inner input shell stays centered with max-width */
.gchat-card .plans-chat-input-shell {
    max-width: 1200px;
    width: 100%;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
    box-sizing: border-box;
    background: transparent !important;
}

/* ── Typing indicator shimmer ── */
.gchat-card .plans-chat-typing-label {
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.35) 0%,
        rgba(255, 255, 255, 0.35) 40%,
        rgba(255, 201, 85, 0.9) 50%,
        rgba(255, 255, 255, 0.35) 60%,
        rgba(255, 255, 255, 0.35) 100%
    );
    background-size: 200% 100%;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gchatTextShimmer 2s ease-in-out infinite;
    font-weight: 500;
    font-size: 0.92rem;
    letter-spacing: 0.02em;
}

@keyframes gchatTextShimmer {
    0% { background-position: 100% 50%; }
    100% { background-position: -100% 50%; }
}

/* ── Upload nudge ── */
.gchat-upload-nudge {
    margin-top: 1.5rem;
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, rgba(91, 156, 244, 0.08), rgba(139, 92, 246, 0.06));
    border: 1px solid rgba(91, 156, 244, 0.18);
    border-radius: var(--plans-radius-sm, 12px);
    max-width: 640px;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.gchat-upload-nudge-icon {
    font-size: 1.6rem;
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(91, 156, 244, 0.12);
    border-radius: 10px;
}

.gchat-upload-nudge-content {
    flex: 1;
    min-width: 0;
}

.gchat-upload-nudge-title {
    color: #e2e8f0 !important;
    font-size: 0.9rem;
    font-weight: 600;
    margin: 0 0 0.15rem 0;
}

.gchat-upload-nudge-desc {
    color: var(--plans-muted, rgba(246, 247, 255, 0.55)) !important;
    font-size: 0.8rem;
    margin: 0;
    line-height: 1.45;
}

.gchat-upload-nudge-btn {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #60a5fa, #818cf8);
    color: #fff !important;
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none !important;
    border-radius: 8px;
    transition: transform 0.15s, box-shadow 0.15s, background 0.2s;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(96, 165, 250, 0.25);
}

.gchat-upload-nudge-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(96, 165, 250, 0.35);
    background: linear-gradient(135deg, #7bb5fb, #9ba3fc);
    text-decoration: none !important;
    color: #fff !important;
}

/* ── Desktop Connect feature promo ── */
.gchat-feature-promo {
    margin-top: 1rem;
    padding: 1rem 1.25rem;
    background: rgba(16, 185, 129, 0.06);
    border: 1px solid rgba(16, 185, 129, 0.18);
    border-radius: var(--plans-radius-sm, 12px);
    max-width: 640px;
    text-align: left;
}

.gchat-feature-promo-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.gchat-feature-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #fff;
    background: linear-gradient(135deg, #10b981, #059669);
    border-radius: 999px;
    line-height: 1.4;
}

.gchat-feature-promo-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
}

.gchat-feature-promo-desc {
    font-size: 0.82rem;
    color: rgba(148, 163, 184, 0.8);
    line-height: 1.5;
    margin: 0 0 0.75rem;
}

.gchat-feature-promo-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem 1rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: #fff;
    background: linear-gradient(135deg, #10b981, #059669);
    border: none;
    border-radius: 8px;
    text-decoration: none;
    cursor: pointer;
    transition: filter 0.15s ease, transform 0.1s ease;
}

.gchat-feature-promo-btn:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

.gchat-feature-promo-btn:active {
    transform: translateY(0);
}

/* ── Tool activity (uses plans-tool styles from plans.css, but simple fallback for general chat) ── */
.gchat-tool-activity {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    font-size: 0.78rem;
    color: #cbd5e1;
    animation: gchatSlideIn 0.3s ease-out;
}

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

.gchat-tool-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(91, 156, 244, 0.2);
    border-top-color: #5b9cf4;
    border-radius: 50%;
    animation: gchatSpin 0.8s linear infinite;
}

@keyframes gchatSpin {
    to { transform: rotate(360deg); }
}

/* ── PDF / live preview cards ── */
.gchat-pdf-preview {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.75rem 1rem;
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.25);
    border-radius: var(--plans-radius-sm, 12px);
    margin: 8px 0;
}

.gchat-pdf-preview-icon { font-size: 1.3rem; }
.gchat-pdf-preview-info { flex: 1; }
.gchat-pdf-preview-title { font-weight: 600; font-size: 0.88rem; color: var(--plans-text, #f6f7ff); }
.gchat-pdf-preview-type { font-size: 0.72rem; color: var(--plans-muted); text-transform: capitalize; }
.gchat-pdf-preview a { color: #34d399; text-decoration: none; font-size: 0.84rem; font-weight: 500; }
.gchat-pdf-preview a:hover { text-decoration: underline; }

.gchat-live-preview {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.6rem 0.9rem;
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.25);
    border-radius: var(--plans-radius-sm, 12px);
    margin: 8px 0;
}

.gchat-live-preview-dot {
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    animation: gchatPulse 2s ease-in-out infinite;
}

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

.gchat-live-preview a {
    color: #34d399;
    text-decoration: none;
    font-size: 0.85rem;
}

/* ── Terminal output ── */
.gchat-terminal-output {
    background: #0d1117;
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
    font-size: 0.8rem;
    line-height: 1.5;
    color: #c9d1d9;
    min-height: 48px;
    max-height: 260px;
    overflow-y: auto;
    margin: 8px 0 4px;
    white-space: pre-wrap;
    word-break: break-word;
    width: 100%;
    box-sizing: border-box;
}

/* ── Code blocks in chat responses (hljs) ── */
.gchat-bubble pre {
    background: #0d1117;
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 8px;
    padding: 1rem 1.15rem;
    margin: 0.6rem 0;
    overflow-x: auto;
    font-size: 0.82rem;
    line-height: 1.55;
}
.gchat-bubble pre code {
    font-family: 'Cascadia Code', 'Fira Code', 'Consolas', 'Monaco', monospace;
    background: transparent;
    padding: 0;
    border-radius: 0;
    color: #c9d1d9;
    white-space: pre;
    word-break: normal;
}
.gchat-bubble code {
    font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
    background: rgba(255, 166, 87, 0.12);
    padding: 0.15em 0.4em;
    border-radius: 4px;
    font-size: 0.88em;
    color: #ffa657;
    border: 1px solid rgba(255, 166, 87, 0.15);
}
.gchat-bubble pre code.hljs {
    background: transparent;
    padding: 0;
}
/* Language label on code blocks */
.gchat-bubble pre {
    position: relative;
}
.gchat-bubble pre code[class*="language-"]::before {
    content: attr(class);
    position: absolute;
    top: 0.35rem;
    right: 0.65rem;
    font-size: 0.65rem;
    color: rgba(139, 148, 158, 0.6);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    pointer-events: none;
}

/* Terminal syntax colors — GitHub dark theme palette */
.term-prompt    { color: #79c0ff; font-weight: 600; }        /* blue bold */
.term-error     { color: #ff7b72; font-weight: 600; }        /* red bold */
.term-warn      { color: #e3b341; font-weight: 600; }        /* amber bold */
.term-success   { color: #7ee787; }                          /* green */
.term-keyword   { color: #ff7b72; }                          /* red (if/def/class/return) */
.term-builtin   { color: #d2a8ff; }                          /* purple (True/False/print) */
.term-decorator { color: #d2a8ff; font-style: italic; }      /* purple italic (@app.route) */
.term-string    { color: #a5d6ff; }                          /* light blue */
.term-num       { color: #56d4dd; }                          /* cyan (distinct from prompt) */
.term-path      { color: #ffa657; }                          /* orange */
.term-url       { color: #58a6ff; text-decoration: underline; } /* blue underlined */
.term-flag      { color: #ffa657; }                          /* orange */
.term-op        { color: #ff7b72; }                          /* red (=, ==, =>) */
.term-bracket   { color: #e3b341; }                          /* amber ({, [, () */
.term-comment   { color: #8b949e; font-style: italic; }      /* gray italic */

/* When terminal lives inside a tool step, span full width below the step content */
.plans-tool-step .gchat-terminal-output {
    margin: 6px 0 2px 28px;
    flex-basis: 100%;
    min-width: 0;
}

/* ── Desktop screenshot ── */
.gchat-screenshot-inline {
    max-width: 100%;
    border-radius: var(--plans-radius-sm, 12px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    margin: 8px 0;
}

/* ── File download card ── */
.gchat-file-download {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.75rem 1rem;
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.25);
    border-radius: var(--plans-radius-sm, 12px);
    margin: 8px 0;
}
.gchat-file-download-icon { font-size: 1.5rem; flex-shrink: 0; }
.gchat-file-download-info { flex: 1; min-width: 0; }
.gchat-file-download-name {
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--plans-text, #f6f7ff);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.gchat-file-download-size { font-size: 0.72rem; color: var(--plans-muted); margin-top: 2px; }
.gchat-file-download-btn {
    flex-shrink: 0;
    padding: 6px 16px;
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.15s;
}
.gchat-file-download-btn:hover {
    background: rgba(59, 130, 246, 0.25);
    text-decoration: none;
}

/* ── Reasoning (lives inside assistant bubble) ── */
.gchat-reasoning {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    width: 100%;
    padding: 0.75rem 1rem;
    margin-bottom: 0.75rem;
    border-radius: 12px;
    background: rgba(91, 156, 244, 0.06);
    border: 1px solid rgba(91, 156, 244, 0.10);
    font-size: 0.85rem;
    color: rgba(200, 210, 240, 0.78);
    line-height: 1.55;
    max-height: none;
    overflow-y: visible;
    animation: gchatSlideIn 0.2s ease-out;
}

/* ── Inline reasoning step (inside tool timeline) ── */
.gchat-reasoning-step {
    background: transparent !important;
}

.gchat-reasoning-step-dot {
    background: rgba(140, 180, 255, 0.5) !important;
}

.gchat-reasoning-step-label {
    color: rgba(140, 180, 255, 0.75) !important;
    font-weight: 500 !important;
    font-size: 0.80rem !important;
}

.gchat-reasoning-step-text {
    font-size: 0.78rem;
    color: rgba(190, 205, 235, 0.7);
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 80px;
    overflow-y: auto;
    margin-top: 2px;
}

.gchat-reasoning-step-done .gchat-reasoning-step-text {
    max-height: 260px;
}

.gchat-reasoning-step .gchat-reasoning-chevron {
    font-size: 0.55rem;
    margin-left: 0.15rem;
    opacity: 0.7;
}

.gchat-reasoning-step-done:hover .gchat-reasoning-step-label {
    color: rgba(170, 205, 255, 1) !important;
}

.gchat-reasoning-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: rgba(91, 156, 244, 0.65);
}

.gchat-reasoning-dots {
    display: inline-flex;
    gap: 0.25rem;
    align-items: center;
    flex-shrink: 0;
}

.gchat-reasoning-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: rgba(91, 156, 244, 0.6);
    animation: gchatDotPulse 1s infinite ease-in-out;
}

.gchat-reasoning-dot:nth-child(2) { animation-delay: 0.15s; }
.gchat-reasoning-dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes gchatDotPulse {
    0%, 100% { opacity: 0.4; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.2); }
}

.gchat-reasoning-text {
    white-space: pre-wrap;
    word-break: break-word;
}

/* ── Collapsed state — small inline toggle at top of message ── */
.gchat-reasoning-collapsed {
    cursor: pointer;
    max-height: none;
    overflow: visible;
    display: inline-flex;
    padding: 0;
    margin-bottom: 0.5rem;
    background: transparent;
    border: none;
    border-radius: 0;
    transition: none;
}
.gchat-reasoning-collapsed .gchat-reasoning-text {
    display: none;
}
.gchat-reasoning-collapsed .gchat-reasoning-header {
    gap: 0.35rem;
    color: rgba(140, 180, 255, 0.75);
    font-size: 0.82rem;
    font-weight: 500;
}
.gchat-reasoning-collapsed:hover {
    background: transparent;
    border: none;
}
.gchat-reasoning-collapsed:hover .gchat-reasoning-header {
    color: rgba(170, 205, 255, 1);
}

/* Chevron */
.gchat-reasoning-chevron {
    font-size: 0.55rem;
    margin-left: 0.15rem;
    transition: transform 0.2s ease;
    opacity: 0.7;
}

/* ── Expanded state — reveals text inside the toggle ── */
.gchat-reasoning-expanded {
    display: inline-flex;
    flex-direction: column;
    padding: 0.5rem 0.75rem;
    margin-top: 0.25rem;
    background: rgba(91, 156, 244, 0.06);
    border: 1px solid rgba(91, 156, 244, 0.10);
    border-radius: 10px;
}
.gchat-reasoning-expanded .gchat-reasoning-text {
    display: block;
    margin-top: 0.4rem;
    font-size: 0.82rem;
    color: rgba(190, 205, 235, 0.8);
    line-height: 1.55;
    max-height: 260px;
    overflow-y: auto;
}
.gchat-reasoning-expanded .gchat-reasoning-header {
    color: rgba(91, 156, 244, 0.6);
}

/* ── Login overlay ── */
.gchat-login-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
}
.gchat-login-overlay.is-visible {
    display: flex;
}

.gchat-login-card {
    background: var(--plans-panel, #0d1122);
    border: 1px solid var(--plans-border-strong, rgba(255, 255, 255, 0.16));
    border-radius: var(--plans-radius-lg, 28px);
    padding: 2.5rem 2rem;
    text-align: center;
    max-width: 400px;
    width: 90%;
}

.gchat-login-card img { margin-bottom: 16px; }
.gchat-login-card h3 { color: var(--plans-text, #f6f7ff); font-size: 1.3rem; margin: 0 0 8px; }
.gchat-login-card p { color: var(--plans-muted); font-size: 0.9rem; margin: 0 0 24px; line-height: 1.5; }

.gchat-login-btn {
    display: block;
    padding: 0.75rem 1.5rem;
    border-radius: var(--plans-radius-sm, 12px);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    text-align: center;
    margin-bottom: 10px;
    transition: all 0.15s;
}

.gchat-login-primary {
    background: var(--plans-accent, #ffc955);
    color: #0c1324;
}

.gchat-login-primary:hover {
    filter: brightness(1.1);
}

.gchat-login-secondary {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--plans-border-strong, rgba(255, 255, 255, 0.16));
    color: var(--plans-text, #f6f7ff);
}

.gchat-login-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* ── Mobile ── */
@media (max-width: 640px) {
    .gchat-root {
        padding: 0 !important;
    }

    .gchat-card {
        padding: 0 0.5rem;
    }

    .gchat-card .plans-chat-input-row {
        padding-bottom: max(env(safe-area-inset-bottom, 0px), 0.5rem);
    }

    .gchat-upload-nudge {
        max-width: 100%;
        flex-direction: column;
        text-align: center;
        gap: 0.75rem;
    }

    .gchat-feature-promo {
        display: none !important;
    }

    .gchat-sidebar {
        width: 280px;
    }

    .gchat-hamburger {
        top: 6px;
        left: 6px;
        width: 32px;
        height: 32px;
    }

    .gchat-card .plans-chat-messages {
        padding: 48px 0.75rem 1rem !important;
    }
}

/* ── Free tier usage counter ── */
.gchat-usage-counter {
    text-align: center;
    font-size: 0.78rem;
    color: var(--plans-muted, rgba(246,247,255,0.45));
    padding: 4px 0 2px;
    letter-spacing: 0.01em;
    transition: color 0.2s;
}

.gchat-usage-counter.gchat-usage-low {
    color: #f59e0b;
}

.gchat-usage-counter.gchat-usage-exhausted {
    color: #f87171;
    font-weight: 600;
}

/* ── Upgrade CTA button in chat ── */
.gchat-upgrade-btn {
    display: inline-block;
    padding: 0.6rem 1.4rem;
    background: var(--plans-accent, #ffc955);
    color: #0c1324;
    border: none;
    border-radius: var(--plans-radius-sm, 12px);
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: filter 0.15s, transform 0.1s;
}

.gchat-upgrade-btn:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

/* ── Photo upload button ── */
.plans-chat-photo-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    border: none;
    background: transparent;
    color: var(--plans-muted, rgba(246, 247, 255, 0.55));
    cursor: pointer;
    border-radius: 8px;
    padding: 0;
    transition: color 0.15s, background 0.15s;
}

.plans-chat-photo-btn:hover {
    color: var(--plans-text, #f6f7ff);
    background: rgba(255, 255, 255, 0.06);
}

.plans-chat-photo-btn svg {
    width: 20px;
    height: 20px;
}

/* ── Photo preview strip (above input) ── */
.gchat-photo-preview-strip {
    display: flex;
    gap: 8px;
    padding: 8px 12px 4px;
    overflow-x: auto;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.gchat-photo-preview-item {
    position: relative;
    flex-shrink: 0;
    width: 64px;
    height: 64px;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.04);
    animation: gchatSlideIn 0.2s ease-out;
}

.gchat-photo-preview-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.gchat-photo-preview-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 20px;
    height: 20px;
    border: none;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    font-size: 14px;
    line-height: 1;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.15s;
    padding: 0;
}

.gchat-photo-preview-item:hover .gchat-photo-preview-remove {
    opacity: 1;
}

/* ── Photo thumbnails in sent user messages ── */
.gchat-msg-photos {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.gchat-msg-photo-thumb {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
}

.gchat-msg-photo-thumb:hover {
    border-color: var(--plans-accent, #ffc955);
}

/* ── Drag-and-drop active state ── */
.gchat-drag-active {
    outline: 2px dashed var(--plans-accent, #ffc955);
    outline-offset: -4px;
    background: rgba(255, 201, 85, 0.03) !important;
}

/* ── Photo welcome chip ── */
.gchat-photo-chip {
    cursor: pointer;
}

/* ── Mobile touch: always show remove button ── */
@media (max-width: 640px) {
    .gchat-photo-preview-remove {
        opacity: 1;
    }
    .gchat-photo-preview-item {
        width: 56px;
        height: 56px;
    }
}

/* ═══════════════════════════════════════════════
   Guest header — logo auth dropdown + CTA
   ═══════════════════════════════════════════════ */

/* Make logo button look like the normal link */
.app-logo-auth-trigger {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: inherit;
    font: inherit;
    text-decoration: none;
}

/* Dropdown panel under logo */
.app-logo {
    position: relative;
}
.app-logo-auth-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 180px;
    background: var(--plans-panel, #1e293b);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
    padding: 0.5rem 0;
    z-index: 1000;
    flex-direction: column;
}
.app-logo-auth-dropdown.is-open {
    display: flex;
}
.app-logo-auth-item {
    display: block;
    padding: 0.65rem 1.1rem;
    color: #ffffff !important;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    transition: background 0.15s, color 0.15s;
}
.app-logo-auth-item:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff !important;
}
.app-logo-auth-item--signup {
    color: #ffd86b !important;
    font-weight: 700;
}
.app-logo-auth-item--signup:hover {
    color: #ffe999 !important;
    background: rgba(255, 201, 85, 0.14);
}

/* Sign Up Free CTA in header nav */
.app-nav .gchat-signup-cta,
.gchat-signup-cta {
    background: var(--plans-accent, #ffc955);
    color: #0f172a !important;
    opacity: 1 !important;
    padding: 0.4rem 1rem;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.85rem;
    text-decoration: none;
    transition: background 0.15s;
    white-space: nowrap;
}
.app-nav .gchat-signup-cta:hover,
.gchat-signup-cta:hover {
    background: #ffe088;
    color: #0f172a !important;
}

/* Guest remaining-prompts hint */
.gchat-guest-remaining-hint {
    text-align: center;
    padding: 8px 16px;
    margin: 8px auto;
    font-size: 0.82rem;
    color: #94a3b8;
    background: rgba(255, 201, 85, 0.08);
    border: 1px solid rgba(255, 201, 85, 0.18);
    border-radius: 8px;
    max-width: 420px;
}
