/* =============================================================================
   Reputifly AI Portal — v4 (ChatGPT-style layout, Reputifly brand)
   Empty state: heading + composer centered.
   Conversation state: messages top, composer docks to bottom.
   ============================================================================= */

*, *::before, *::after { box-sizing: border-box; }

:root {
    --bg-deep:          #0B0A14;
    --bg-surface:       #0f0e1c;
    --glass-bg:         rgba(20, 20, 30, 0.6);
    --glass-border:     rgba(255, 255, 255, 0.08);
    --glass-border-br:  rgba(255, 255, 255, 0.15);
    --accent:           #E6397F;
    --accent-2:         #FF8A00;
    --text-main:        #F0F0F0;
    --text-muted:       rgba(240, 240, 240, 0.6);
    --text-dim:         rgba(240, 240, 240, 0.42);
    --text-faint:       rgba(240, 240, 240, 0.28);
    --success:          #4ADE80;
    --warn:             #F59E0B;
    --danger:           #EF4444;
    --radius:           14px;
    --radius-lg:        20px;
    --radius-btn:       9999px;
    --ease:             cubic-bezier(0.25, 0.8, 0.25, 1);
    --font:             'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

html, body { margin: 0; padding: 0; height: 100%; }

body {
    font-family: var(--font);
    background: var(--bg-deep);
    color: var(--text-main);
    letter-spacing: -0.005em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    position: relative;
    min-height: 100vh;
    min-height: 100dvh;
}

/* Very subtle ambient blobs — Reputifly brand character */
body.page-chat::before, body.page-chat::after {
    content: "";
    position: fixed;
    width: 560px;
    height: 560px;
    border-radius: 50%;
    filter: blur(90px);
    z-index: -2;
    will-change: transform;
    pointer-events: none;
    opacity: 0.55;
}
body.page-chat::before {
    top: -260px; left: -240px;
    background: radial-gradient(circle, rgba(230, 57, 127, 0.18) 0%, transparent 70%);
    animation: drift 26s infinite alternate var(--ease);
}
body.page-chat::after {
    bottom: -280px; right: -260px;
    background: radial-gradient(circle, rgba(255, 138, 0, 0.12) 0%, transparent 70%);
    animation: drift 30s infinite alternate-reverse var(--ease);
}
@keyframes drift {
    0%   { transform: translate(0, 0); }
    100% { transform: translate(40px, 60px); }
}
@media (max-width: 640px) {
    body.page-chat::before, body.page-chat::after { animation: none; opacity: 0.35; }
}
@media (prefers-reduced-motion: reduce) {
    body.page-chat::before, body.page-chat::after { animation: none; }
}

button { font-family: inherit; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.08); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.2); }

.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

h1, h2, h3 {
    font-family: var(--font);
    letter-spacing: -0.02em;
    font-weight: 600;
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 4px;
}
button:focus-visible, a:focus-visible { outline-offset: 2px; }

.text-gradient {
    background: linear-gradient(to right, #E6397F, #FF8A00);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

/* ==========================================================================
   Simple pages (login / activate / logged-out / expired)
   ========================================================================== */
.page-simple {
    display: grid;
    place-items: center;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 24px;
}
.simple {
    width: 100%;
    max-width: 480px;
    padding: 40px 32px;
    text-align: center;
    background: var(--glass-bg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--glass-border);
    border-top: 1px solid var(--glass-border-br);
    box-shadow:
        0 30px 60px -12px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-lg);
}
.simple__logo  { height: 32px; width: auto; opacity: 0.95; margin-bottom: 4px; }
.simple h1     { font-size: 26px; margin: 18px 0 10px; }
.simple__body  { color: var(--text-muted); font-size: 15px; line-height: 1.6; margin: 0 0 22px; }
.simple__hint  { color: var(--text-muted); font-size: 14px; margin: 20px 0 0; line-height: 1.55; }
.simple__note  { color: var(--text-dim); font-size: 13px; margin: 28px 0 0; }
.simple__cta   { margin-top: 24px; }
.simple__spinner {
    width: 34px; height: 34px; margin: 16px auto;
    border: 2px solid var(--glass-border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ==========================================================================
   Chat page — ChatGPT-style shell
   ========================================================================== */
.page-chat {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
}

/* Topbar — brand + usage + sign out */
.topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 24px;
    background: rgba(11, 10, 20, 0.72);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
    flex-shrink: 0;
}
.topbar__brand { display: flex; align-items: center; flex: 1; min-width: 0; }
.topbar__logo { height: 30px; width: auto; opacity: 0.98; }

.topbar__usage {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
    color: var(--text-main);
    padding: 7px 14px 7px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: var(--radius-btn);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    font-weight: 500;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.topbar__usage::before {
    content: "";
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 8px rgba(230, 57, 127, 0.55);
    flex-shrink: 0;
}

.topbar__logout {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.09);
    color: var(--text-main);
    padding: 7px 18px;
    border-radius: var(--radius-btn);
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s var(--ease);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.topbar__logout:hover {
    background: rgba(255, 255, 255, 0.09);
    border-color: rgba(255, 255, 255, 0.18);
    color: white;
    transform: translateY(-1px);
}

/* ==========================================================================
   Chat area — two states: "empty" (centered composer) and "conversation"
   ========================================================================== */
.chat {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    position: relative;
}

.chat__scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    scroll-behavior: smooth;
    display: flex;
    flex-direction: column;
    padding: 28px 20px 24px;
}

/* EMPTY STATE — vertically center welcome block + composer */
body[data-state="empty"] .chat { justify-content: center; }
body[data-state="empty"] .chat__scroll {
    flex: 0 0 auto;
    overflow: visible;
    padding: 0 20px;
    justify-content: center;
    align-items: center;
}
body[data-state="empty"] .chat__center {
    max-width: 720px;
    width: 100%;
    text-align: center;
    margin: 0 auto 28px;
}
body[data-state="empty"] .chat__centerTitle {
    font-size: 32px;
    font-weight: 600;
    letter-spacing: -0.02em;
    margin: 0;
    line-height: 1.25;
    color: var(--text-main);
}
body[data-state="empty"] .composerWrap {
    max-width: 720px;
    width: 100%;
    margin: 0 auto 32px;
    padding: 0 16px;
    flex-shrink: 0;
}
body[data-state="empty"] .composer2__footnote { display: none; }

/* CONVERSATION STATE — welcome hidden, messages top, composer docked */
body[data-state="conversation"] .chat__center { display: none; }
body[data-state="conversation"] .composerWrap {
    padding: 14px 20px 18px;
    background: linear-gradient(to top, var(--bg-deep) 40%, rgba(11, 10, 20, 0.0) 100%);
    flex-shrink: 0;
    padding-bottom: max(18px, env(safe-area-inset-bottom));
}
body[data-state="conversation"] .composer2 {
    max-width: 760px;
    margin: 0 auto;
}
body[data-state="conversation"] .composer2__footnote {
    max-width: 760px;
    margin: 10px auto 0;
    text-align: center;
}

/* ==========================================================================
   Messages (ChatGPT-style)
   ========================================================================== */
.msg {
    max-width: 760px;
    margin: 0 auto 18px;
    width: 100%;
    padding: 0 6px;
}
.msg--user {
    display: flex;
    justify-content: flex-end;
}
.msg--user .msg__text {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 20px;
    padding: 11px 16px;
    font-size: 15px;
    line-height: 1.55;
    color: var(--text-main);
    max-width: 80%;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* AI message — no avatar, plain text block (ChatGPT-style) */
.msg--ai {
    display: block;
    padding-left: 2px;
}
.msg--ai .msg__body {
    min-width: 0;
    padding-top: 0;
}

.msg__text {
    font-size: 15px;
    line-height: 1.65;
    color: var(--text-main);
    word-wrap: break-word;
    overflow-wrap: anywhere;
}

/* Markdown rendering inside AI messages (user bubbles keep pre-wrap) */
.msg--user .msg__text { white-space: pre-wrap; }

.msg--ai .msg__text > :first-child { margin-top: 0; }
.msg--ai .msg__text > :last-child  { margin-bottom: 0; }

.msg--ai .msg__text p {
    margin: 0 0 12px;
}
.msg--ai .msg__text strong, .msg--ai .msg__text b { color: white; font-weight: 600; }
.msg--ai .msg__text em, .msg--ai .msg__text i     { font-style: italic; color: var(--text-main); }
.msg--ai .msg__text h1, .msg--ai .msg__text h2, .msg--ai .msg__text h3,
.msg--ai .msg__text h4, .msg--ai .msg__text h5, .msg--ai .msg__text h6 {
    font-weight: 600;
    letter-spacing: -0.015em;
    color: white;
    margin: 18px 0 10px;
    line-height: 1.35;
}
.msg--ai .msg__text h1 { font-size: 22px; }
.msg--ai .msg__text h2 { font-size: 19px; }
.msg--ai .msg__text h3 { font-size: 16.5px; }
.msg--ai .msg__text h4,
.msg--ai .msg__text h5,
.msg--ai .msg__text h6 { font-size: 15px; }

.msg--ai .msg__text ul,
.msg--ai .msg__text ol {
    padding-left: 24px;
    margin: 8px 0 12px;
}
.msg--ai .msg__text li {
    margin: 4px 0;
    padding-left: 2px;
}
.msg--ai .msg__text li::marker { color: var(--text-muted); }

.msg--ai .msg__text a {
    color: var(--accent);
    text-decoration: underline;
    text-decoration-color: rgba(230, 57, 127, 0.4);
    text-underline-offset: 2px;
    word-break: break-all;
}
.msg--ai .msg__text a:hover {
    text-decoration-color: var(--accent);
}

.msg--ai .msg__text code {
    font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
    font-size: 13px;
    padding: 1px 6px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 6px;
    color: #ffdce9;
    word-break: break-all;
}
.msg--ai .msg__text pre {
    margin: 12px 0;
    padding: 14px 16px;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    overflow-x: auto;
    font-size: 13px;
    line-height: 1.55;
}
.msg--ai .msg__text pre code {
    padding: 0;
    background: transparent;
    border: none;
    color: var(--text-main);
    font-size: inherit;
}

.msg--ai .msg__text blockquote {
    margin: 12px 0;
    padding: 8px 14px;
    border-left: 3px solid var(--accent);
    background: rgba(230, 57, 127, 0.05);
    border-radius: 0 8px 8px 0;
    color: var(--text-muted);
    font-style: italic;
}

.msg--ai .msg__text hr {
    border: 0;
    border-top: 1px solid var(--glass-border);
    margin: 16px 0;
}

.msg--ai .msg__text table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
    font-size: 14px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--glass-border);
}
.msg--ai .msg__text thead {
    background: rgba(255, 255, 255, 0.04);
}
.msg--ai .msg__text th,
.msg--ai .msg__text td {
    text-align: left;
    padding: 8px 12px;
    border-bottom: 1px solid var(--glass-border);
    vertical-align: top;
}
.msg--ai .msg__text th {
    font-weight: 600;
    color: white;
    font-size: 13px;
    letter-spacing: 0.01em;
}
.msg--ai .msg__text tr:last-child td { border-bottom: none; }

.msg--ai .msg__text img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 6px 0;
}

/* Progress chip — current step + inline spinner, all left-aligned */
.msg__progress {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    color: var(--text-main);
    line-height: 1.6;
    font-weight: 500;
    padding-left: 22px;
    position: relative;
}
.msg__progress::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    margin-top: -7px;
    width: 14px; height: 14px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.12);
    border-top-color: var(--accent);
    animation: spin 0.8s linear infinite;
}

/* Completed step history — each with pink check, aligned to the progress text */
.msg__steps {
    margin: 6px 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    list-style: none;
}
.msg__steps li {
    list-style: none;
    padding: 3px 0 3px 22px;
    position: relative;
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
}
.msg__steps li::before {
    content: "";
    position: absolute;
    left: 2px;
    top: 50%;
    margin-top: -5px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: radial-gradient(circle at top, rgba(255,255,255,0.3) 0%, transparent 60%),
                linear-gradient(135deg, #E6397F, #FF8A00);
    box-shadow: 0 0 6px rgba(230, 57, 127, 0.35);
}
.msg__steps li::after {
    content: "";
    position: absolute;
    left: 5.5px;
    top: 50%;
    margin-top: -2.5px;
    width: 3px;
    height: 5px;
    border-right: 1.5px solid #fff;
    border-bottom: 1.5px solid #fff;
    transform: rotate(45deg) translateY(-1px);
}

.msg__changelog {
    margin-top: 12px;
    padding: 10px 14px;
    background: rgba(0, 0, 0, 0.28);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
    font-size: 12px;
    color: var(--text-dim);
    max-height: 140px;
    overflow-y: auto;
    line-height: 1.5;
    white-space: pre-wrap;
}

.msg__meta {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 10px;
    font-size: 12px;
    color: var(--text-faint);
    font-variant-numeric: tabular-nums;
}
.msg__tokens {
    color: var(--text-dim);
    letter-spacing: 0.01em;
}

.msg__actions {
    display: flex;
    gap: 4px;
    margin-top: 8px;
    flex-wrap: wrap;
}
.msg__actionBtn {
    display: inline-grid;
    place-items: center;
    width: 30px;
    height: 30px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s var(--ease);
}
.msg__actionBtn:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-main);
}
.msg__actionBtn svg {
    width: 15px;
    height: 15px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.msg__actionBtn.is-speaking {
    color: var(--accent);
    background: rgba(230, 57, 127, 0.1);
}

/* Cancel/Stop button (mounted while a job is running) */
.msg__cancelBtn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    margin-bottom: 10px;
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: #fca5a5;
    border-radius: 999px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s var(--ease);
}
.msg__cancelBtn:hover:not(:disabled) {
    background: rgba(239, 68, 68, 0.16);
    color: #fff;
    border-color: rgba(239, 68, 68, 0.45);
}
.msg__cancelBtn:disabled { opacity: 0.6; cursor: wait; }
.msg__cancelBtn svg { flex-shrink: 0; }
.msg__actionBtn.is-speaking svg {
    animation: pulse-soft 1.2s ease-in-out infinite;
}
@keyframes pulse-soft {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.55; }
}

/* ==========================================================================
   Scroll-to-bottom floating button
   ========================================================================== */
.scrollToBottom {
    position: fixed;
    left: 50%;
    /* Sit above the docked composer with clear space between it and the input bar */
    bottom: 155px;
    transform: translateX(-50%) translateY(8px);
    width: 36px;
    height: 36px;
    padding: 0;
    display: grid;
    place-items: center;
    background: rgba(22, 20, 34, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 50%;
    color: var(--text-main);
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    z-index: 20;
    transition: opacity 0.18s var(--ease), transform 0.18s var(--ease), background 0.15s var(--ease);
    box-shadow: 0 8px 24px -8px rgba(0, 0, 0, 0.7);
}
.scrollToBottom.is-visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
}
.scrollToBottom:hover {
    background: rgba(32, 30, 46, 0.98);
    border-color: rgba(255, 255, 255, 0.22);
    transform: translateX(-50%) translateY(-1px);
}
.scrollToBottom svg { width: 16px; height: 16px; }

/* On empty state there's no conversation, hide the button */
body[data-state="empty"] .scrollToBottom { display: none; }

@media (max-width: 640px) {
    .scrollToBottom { bottom: 135px; width: 34px; height: 34px; }
}

/* ==========================================================================
   Composer (ChatGPT-style pill)
   ========================================================================== */
.composerWrap {
    flex-shrink: 0;
}

.composer2 {
    display: flex;
    flex-direction: column;
    gap: 0;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 26px;
    padding: 10px 14px 10px;
    transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
    box-shadow: 0 20px 40px -24px rgba(0, 0, 0, 0.6);
}
.composer2:focus-within {
    border-color: rgba(230, 57, 127, 0.35);
    background: rgba(255, 255, 255, 0.055);
}

.composer2__input {
    width: 100%;
    min-height: 26px;
    max-height: 200px;
    padding: 6px 6px;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-main);
    font-family: inherit;
    font-size: 15.5px;
    line-height: 1.5;
    resize: none;
}
.composer2__input::placeholder { color: var(--text-faint); }

.composer2__bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding-top: 4px;
}

.composer2__left { display: flex; align-items: center; gap: 6px; position: relative; }
.composer2__right { display: flex; align-items: center; gap: 6px; }

/* Model pill (matches ChatGPT "Extended thinking ▾" style) */
.composer2__pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
    border-radius: 999px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s var(--ease);
    line-height: 1;
    position: relative;
}
.composer2__pill:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-main);
    border-color: rgba(255, 255, 255, 0.15);
}
.composer2__pill.is-active {
    color: var(--accent);
    border-color: rgba(230, 57, 127, 0.35);
    background: rgba(230, 57, 127, 0.08);
}
.composer2__pill svg { stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Model dropdown menu */
.composer2__menu {
    position: absolute;
    bottom: calc(100% + 6px);
    left: 0;
    min-width: 260px;
    padding: 6px;
    background: rgba(20, 20, 30, 0.92);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--glass-border);
    border-top: 1px solid var(--glass-border-br);
    box-shadow: 0 20px 50px -12px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    border-radius: 14px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.composer2__menuItem {
    display: block;
    width: 100%;
    text-align: left;
    padding: 10px 12px;
    background: transparent;
    border: none;
    color: var(--text-main);
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.12s var(--ease);
    font-family: inherit;
}
.composer2__menuItem:hover { background: rgba(255, 255, 255, 0.05); }
.composer2__menuItem.is-active { background: rgba(230, 57, 127, 0.1); }
.composer2__menuItemHead {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
}
.composer2__menuItemBadge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 600;
    color: var(--accent);
    background: rgba(230, 57, 127, 0.12);
    border: 1px solid rgba(230, 57, 127, 0.25);
    letter-spacing: 0.02em;
}
.composer2__menuItemSub {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Send button — circular white (matches ChatGPT right-side voice / send) */
.composer2__send {
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: grid;
    place-items: center;
    color: #0B0A14;
    font-family: inherit;
    background: #ffffff;
    transition: all 0.15s var(--ease);
    position: relative;
}
.composer2__send:hover:not(:disabled) {
    background: #f0f0f0;
    transform: scale(1.04);
}
.composer2__send:disabled { opacity: 0.4; cursor: not-allowed; }
.composer2__send svg { width: 16px; height: 16px; }

.composer2__sendSpinner {
    width: 16px; height: 16px;
    border: 2px solid rgba(11, 10, 20, 0.2);
    border-top-color: #0B0A14;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: none;
}
.composer2__stopIcon {
    display: none;
}
.composer2__stopIcon svg { width: 14px; height: 14px; display: block; }

/* Loading state (brief — just while portalChat fetch is in flight) */
.composer2__send.is-loading .composer2__sendIcon { display: none; }
.composer2__send.is-loading .composer2__sendSpinner { display: block; }

/* Stop state — monochrome (black square on white, subtle white pulse).
   No red: reserves red for destructive UX, avoids "recording" semantics. */
.composer2__send.is-stop {
    background: #ffffff;
    color: #0B0A14;
    animation: stopPulse 1.8s ease-in-out infinite;
}
.composer2__send.is-stop:hover:not(:disabled) {
    background: #f0f0f0;
    transform: scale(1.04);
}
.composer2__send.is-stop .composer2__sendIcon,
.composer2__send.is-stop .composer2__sendSpinner {
    display: none;
}
.composer2__send.is-stop .composer2__stopIcon {
    display: grid;
    place-items: center;
    width: 100%; height: 100%;
}
@keyframes stopPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.5),  0 0 10px -2px rgba(255, 255, 255, 0.25); }
    50%      { box-shadow: 0 0 0 10px rgba(255, 255, 255, 0.0), 0 0 14px 0 rgba(255, 255, 255, 0.35); }
}

.composer2__footnote {
    font-size: 12px;
    color: var(--text-faint);
    margin-top: 10px;
    text-align: center;
    padding: 0 8px;
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 640px) {
    .topbar { padding: 10px 14px; gap: 10px; }
    .topbar__usage { font-size: 11px; padding: 5px 12px; }
    .topbar__logout { font-size: 12px; padding: 6px 12px; }

    body[data-state="empty"] .chat__centerTitle { font-size: 22px; line-height: 1.3; padding: 0 12px; }
    body[data-state="empty"] .composerWrap { padding: 0 12px 16px; }
    body[data-state="empty"] .chat__scroll { padding-top: 20px; }
    body[data-state="conversation"] .composerWrap { padding: 10px 12px 12px; }
    body[data-state="conversation"] .chat__scroll { padding: 18px 14px 160px; }

    .composer2 { border-radius: 22px; padding: 8px 12px; }
    .composer2__input { font-size: 15px; }
    .composer2__pill { font-size: 12px; padding: 6px 10px; }
    .composer2__send { width: 32px; height: 32px; }
    .composer2__menu { min-width: 220px; left: -4px; }

    .msg { padding: 0; }
    .msg--user .msg__text { max-width: 85%; font-size: 14.5px; }
    .msg__text { font-size: 14.5px; }
    .msg__progress { font-size: 14.5px; }

    .composer2__footnote { font-size: 11px; margin-top: 8px; }
}

/* ==========================================================================
   Confirm dialog
   ========================================================================== */
.confirmDialog {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.72);  /* NO backdrop-filter on the backdrop */
    display: grid;
    place-items: center;
    padding: 20px;
    animation: fadeIn 0.2s var(--ease);
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.confirmDialog__card {
    width: 100%;
    max-width: 480px;
    padding: 28px;
    background: var(--glass-bg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--glass-border);
    border-top: 1px solid var(--glass-border-br);
    box-shadow:
        0 30px 60px -12px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-lg);
}
.confirmDialog__card h2 {
    margin: 0 0 16px;
    font-size: 18px;
    font-weight: 600;
    color: white;
}
.confirmDialog__summary {
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    font-size: 14px;
    line-height: 1.55;
    color: var(--text-main);
    margin: 0 0 14px;
}
.confirmDialog__countdown {
    color: var(--text-dim);
    font-size: 13px;
    margin: 0 0 20px;
    font-variant-numeric: tabular-nums;
}
.confirmDialog__actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-btn);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s var(--ease);
    text-decoration: none;
    line-height: 1;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-liquid-glow {
    background:
        radial-gradient(circle at top, rgba(255,255,255,0.4) 0%, transparent 60%),
        linear-gradient(90deg, #E6397F, #FF8A00);
    color: white;
    font-weight: 700;
    border: none;
    box-shadow:
        0 10px 30px -10px rgba(230, 57, 127, 0.6),
        inset 0 1px 0 rgba(255, 255, 255, 0.4),
        inset 0 -2px 0 rgba(0, 0, 0, 0.2);
}
.btn-liquid-glow:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow:
        0 20px 40px -10px rgba(255, 138, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.6);
}
.btn-hero-glass {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-main);
    border: 1px solid rgba(255, 255, 255, 0.12);
}
.btn-hero-glass:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.25);
}

/* Login page Google button (used by login.html) */
.google-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 14px 20px;
    background: #ffffff;
    color: #1f1f1f;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s var(--ease);
}
.google-btn:hover:not(:disabled) {
    background: #f6f6f6;
    transform: translateY(-1px);
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
}
.google-btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* ==========================================================================
   Toast
   ========================================================================== */
.toast {
    position: fixed;
    left: 50%;
    bottom: 140px;
    transform: translateX(-50%) translateY(20px);
    padding: 12px 20px;
    background: var(--glass-bg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--glass-border-br);
    border-radius: var(--radius);
    color: var(--text-main);
    font-size: 14px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
    z-index: 1001;
    max-width: 90vw;
    box-shadow: 0 12px 40px -12px rgba(0, 0, 0, 0.6);
}
.toast.is-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.toast.is-error { border-color: rgba(239, 68, 68, 0.5); }
