:root {
    color-scheme: light;
    --blue: #0055FF;
    --blue-deep: #0041CC;
    --ink: #1C2430;
    --ink-2: #4A5568;
    --ink-3: #8B95A5;
    --ink-4: #B0B8C4;
    --cream: #fdfdfd;
    --cream-deep: #f5f5f5;
    --paper: #fdfdfd;
    --line: rgba(28, 36, 48, 0.08);
    --line-strong: rgba(28, 36, 48, 0.12);
    --rail: 60px;
    --panel: 236px;
    --open: calc(var(--rail) + var(--panel));
    --closed: var(--rail);
    --wide: 680px;
    --chat: 48rem;
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
    --out: cubic-bezier(0.16, 1, 0.3, 1);
    --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

html,
body {
    width: 100%;
    min-height: 100%;
}

body {
    min-width: 320px;
    overflow: hidden;
    color: var(--ink);
    background: var(--cream);
    font-family: var(--font);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

button,
textarea {
    font: inherit;
}

button {
    color: inherit;
    -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
textarea:focus-visible {
    outline: 2px solid rgba(0, 85, 255, 0.32);
    outline-offset: 2px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ── Shell ─────────────────────────────────────────────── */

.chat-app {
    display: grid;
    grid-template-columns: var(--open) minmax(0, 1fr);
    width: 100vw;
    height: 100dvh;
    transition: grid-template-columns 440ms var(--ease);
}

.chat-app.sidebar-collapsed {
    grid-template-columns: var(--closed) minmax(0, 1fr);
}

.chat-app.sidebar-collapsed .sidebar {
    overflow: visible;
}

/* ── Sidebar ───────────────────────────────────────────── */

.sidebar {
    position: relative;
    z-index: 20;
    display: flex;
    width: 100%;
    min-width: 0;
    height: 100dvh;
    overflow: hidden;
    background: var(--cream);
}

.rail {
    display: flex;
    width: var(--rail);
    flex-shrink: 0;
    flex-direction: column;
    align-items: center;
    padding: 16px 0 18px;
    gap: 2px;
}

.rail-logo {
    position: relative;
    display: grid;
    width: 40px;
    height: 40px;
    margin-bottom: 10px;
    place-items: center;
    border: 0;
    border-radius: 0;
    background: transparent;
    cursor: pointer;
    transition: opacity 180ms ease, transform 220ms var(--ease);
}

.rail-logo:hover {
    background: transparent;
}

.rail-logo:hover img {
    opacity: 0.72;
}

.rail-logo:active {
    transform: scale(0.96);
}

.rail-logo:active img {
    opacity: 0.55;
}

.rail-logo img {
    width: 26px;
    height: 26px;
    object-fit: contain;
    display: block;
}

.rail-btn {
    position: relative;
    display: grid;
    width: 36px;
    height: 36px;
    place-items: center;
    border: 0;
    border-radius: 10px;
    color: var(--ink-2);
    background: transparent;
    cursor: pointer;
    transition: color 150ms ease, background 150ms ease;
}

.rail-btn:hover {
    color: var(--ink);
    background: rgba(28, 36, 48, 0.05);
}

.rail-btn svg {
    width: 17px;
    height: 17px;
    stroke-width: 1.65;
}

.rail-nav {
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: center;
    margin-top: 4px;
}

.rail-avatar {
    position: relative;
    display: grid;
    width: 28px;
    height: 28px;
    margin-top: auto;
    place-items: center;
    border: 0;
    border-radius: 50%;
    color: #fff;
    background: var(--blue);
    cursor: pointer;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    transition: transform 200ms var(--ease), background 160ms ease;
}

.rail-avatar:hover {
    background: var(--blue-deep);
    transform: scale(1.05);
}

.rail-avatar svg {
    display: block;
    width: 14px;
    height: 14px;
    stroke-width: 2.2;
}

.sidebar-panel {
    display: flex;
    width: var(--panel);
    min-width: 0;
    flex-direction: column;
    padding: 18px 14px 18px 0;
    overflow: hidden;
    opacity: 1;
    transform: none;
    transition: opacity 180ms ease 70ms, transform 400ms var(--ease);
}

.chat-app.sidebar-collapsed .sidebar-panel {
    width: 0;
    padding: 0;
    opacity: 0;
    pointer-events: none;
    transform: translateX(-10px);
    transition-delay: 0s;
}

.panel-top {
    display: flex;
    height: 40px;
    align-items: center;
    padding-left: 4px;
}

.brand-name {
    color: var(--ink);
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: -0.03em;
    white-space: nowrap;
}

.brand-ai {
    font-weight: 600;
    letter-spacing: -0.02em;
}

.history-panel {
    display: flex;
    flex: 1;
    min-height: 0;
    margin-top: 28px;
    flex-direction: column;
}

.search-wrap {
    display: flex;
    height: 34px;
    margin: 0 2px 12px;
    padding: 0 10px;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--line-strong);
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.7);
}

.search-wrap[hidden] {
    display: none;
}

.search-wrap svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    color: var(--ink-4);
    stroke-width: 1.8;
}

.search-wrap input {
    width: 100%;
    min-width: 0;
    border: 0;
    outline: 0;
    color: var(--ink);
    background: transparent;
    font-size: 0.8125rem;
}

.search-wrap input::placeholder {
    color: var(--ink-4);
}

.history-panel h2 {
    padding: 0 10px;
    color: var(--ink-4);
    font-size: 0.6875rem;
    font-weight: 500;
    letter-spacing: 0.02em;
}

.history-list {
    display: flex;
    flex: 1;
    min-height: 0;
    margin-top: 10px;
    flex-direction: column;
    gap: 1px;
    overflow-y: auto;
    scrollbar-width: none;
}

.history-list::-webkit-scrollbar {
    display: none;
}

.history-empty {
    margin-top: 10px;
    padding: 0 10px;
    color: var(--ink-4);
    font-size: 0.78rem;
}

.history-group {
    padding: 12px 10px 4px;
    color: var(--ink-4);
    font-size: 0.6875rem;
    font-weight: 500;
}

.history-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 0;
    width: 100%;
    height: 34px;
    align-items: center;
    border-radius: 8px;
    transition: background 140ms ease, grid-template-columns 140ms ease;
}

.history-row:hover,
.history-row.selected {
    background: rgba(28, 36, 48, 0.05);
}

.history-row:hover,
.history-row:focus-within {
    grid-template-columns: minmax(0, 1fr) 28px;
}

.history-row.selected {
    background: rgba(28, 36, 48, 0.06);
}

.history-item {
    display: block;
    width: 100%;
    height: 34px;
    padding: 0 10px;
    overflow: hidden;
    border: 0;
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
    color: var(--ink-2);
    font-size: 0.8125rem;
    font-weight: 400;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: color 140ms ease;
}

.history-row.selected .history-item {
    color: var(--ink);
    font-weight: 500;
}

.history-row:hover .history-item {
    color: var(--ink);
}

.history-delete {
    display: grid;
    width: 28px;
    height: 28px;
    place-items: center;
    border: 0;
    border-radius: 7px;
    color: var(--ink-3);
    background: transparent;
    cursor: pointer;
    opacity: 0;
    transition: opacity 120ms ease, color 120ms ease, background 120ms ease;
}

.history-row:hover .history-delete,
.history-row:focus-within .history-delete {
    opacity: 1;
}

.history-delete:hover {
    color: #c53030;
    background: rgba(197, 48, 48, 0.08);
}

.history-delete svg {
    width: 14px;
    height: 14px;
    stroke-width: 1.8;
}

[data-tooltip] {
    position: relative;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    z-index: 60;
    left: calc(100% + 10px);
    top: 50%;
    padding: 6px 9px;
    border-radius: 7px;
    color: #fff;
    background: var(--ink);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.14);
    font-size: 0.6875rem;
    font-weight: 500;
    opacity: 0;
    visibility: hidden;
    transform: translate(-4px, -50%);
    transition: opacity 120ms ease, transform 150ms ease, visibility 0s linear 150ms;
    white-space: nowrap;
    pointer-events: none;
}

.chat-app.sidebar-collapsed .rail [data-tooltip]:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translate(0, -50%);
    transition-delay: 260ms;
}

/* ── Main ──────────────────────────────────────────────── */

.main-panel {
    position: relative;
    display: flex;
    min-width: 0;
    height: 100dvh;
    flex-direction: column;
    overflow: hidden;
    background: var(--paper);
}

.drop-overlay {
    position: absolute;
    inset: 0;
    z-index: 40;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(253, 253, 253, 0.72);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    animation: drop-in 160ms var(--ease);
}

.drop-overlay[hidden] {
    display: none !important;
}

.drop-overlay-card {
    display: grid;
    justify-items: center;
    gap: 6px;
    width: min(320px, 100%);
    padding: 28px 24px;
    border: 1.5px dashed rgba(0, 85, 255, 0.35);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 18px 48px rgba(28, 36, 48, 0.08);
    text-align: center;
}

.drop-overlay-card svg {
    width: 28px;
    height: 28px;
    margin-bottom: 4px;
    color: var(--blue);
    stroke-width: 1.7;
}

.drop-overlay-title {
    color: var(--ink);
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.drop-overlay-sub {
    color: var(--ink-3);
    font-size: 0.88rem;
}

@keyframes drop-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.ambient {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    opacity: 1;
    transition: opacity 700ms var(--out);
}

.chat-app[data-state="active"] .ambient {
    opacity: 0;
}

.glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(70px);
    will-change: transform, opacity;
}

.glow-core {
    top: 38%;
    left: 50%;
    width: min(640px, 78vw);
    height: 280px;
    background: radial-gradient(closest-side, rgba(120, 175, 255, 0.55), transparent 74%);
    transform: translate(-50%, -50%);
    animation: breathe 10s ease-in-out infinite;
}

.glow-wash {
    top: 46%;
    left: 54%;
    width: min(420px, 55vw);
    height: 220px;
    background: radial-gradient(closest-side, rgba(0, 85, 255, 0.14), transparent 72%);
    transform: translate(-50%, -40%);
    animation: drift 13s ease-in-out infinite;
}

@keyframes breathe {
    0%, 100% { opacity: 0.68; transform: translate(-50%, -50%) scale(1); }
    50% { opacity: 0.95; transform: translate(-50%, -53%) scale(1.045); }
}

@keyframes drift {
    0%, 100% { transform: translate(-50%, -40%) translateX(0); }
    50% { transform: translate(-50%, -40%) translateX(-20px); }
}

.chat-header {
    position: relative;
    z-index: 5;
    display: flex;
    height: 56px;
    padding: 0 24px;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-shrink: 0;
}

.model-menu {
    position: relative;
    margin-right: auto;
}

.model-menu[hidden],
.model-list[hidden] {
    display: none;
}

.model-selector-btn {
    display: inline-flex;
    height: 34px;
    padding: 0 10px;
    align-items: center;
    gap: 6px;
    border: 1px solid transparent;
    border-radius: 9px;
    color: var(--ink-2);
    background: transparent;
    cursor: pointer;
    font-size: 0.8125rem;
    font-weight: 550;
    letter-spacing: -0.01em;
    transition: color 150ms ease, background 150ms ease, border-color 150ms ease;
}

.model-selector-btn:hover,
.model-selector-btn[aria-expanded="true"] {
    color: var(--ink);
    border-color: var(--line);
    background: rgba(28, 36, 48, 0.035);
}

.model-selector-btn svg {
    width: 13px;
    height: 13px;
    color: var(--ink-3);
    stroke-width: 2;
}

.model-list {
    position: absolute;
    top: calc(100% + 7px);
    left: 0;
    z-index: 12;
    width: min(286px, calc(100vw - 92px));
    padding: 6px;
    border: 1px solid var(--line-strong);
    border-radius: 13px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 16px 42px rgba(28, 36, 48, 0.13);
    list-style: none;
    animation: menu-down 160ms var(--out) both;
    backdrop-filter: blur(16px);
}

.model-option {
    display: flex;
    min-height: 56px;
    padding: 9px 10px;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    border-radius: 9px;
    color: var(--ink-2);
    cursor: pointer;
    transition: color 140ms ease, background 140ms ease, opacity 140ms ease;
}

.model-option:hover,
.model-option:focus-visible,
.model-option[aria-selected="true"] {
    color: var(--ink);
    background: rgba(0, 85, 255, 0.055);
}

.model-option:focus-visible {
    outline: 2px solid rgba(0, 85, 255, 0.28);
    outline-offset: -2px;
}

.model-option.is-locked {
    color: var(--ink-3);
    cursor: default;
    opacity: 0.58;
}

.model-option.is-locked:hover,
.model-option.is-locked:focus-visible {
    background: rgba(28, 36, 48, 0.035);
}

.model-option-copy {
    display: grid;
    min-width: 0;
    gap: 3px;
}

.model-option-copy strong {
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: -0.015em;
}

.model-option-copy > span {
    color: var(--ink-3);
    font-size: 0.72rem;
    font-weight: 400;
}

.model-option-access {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.model-plan {
    padding: 3px 6px;
    border: 1px solid rgba(0, 85, 255, 0.14);
    border-radius: 999px;
    color: var(--blue);
    background: rgba(0, 85, 255, 0.055);
    font-size: 0.61rem;
    font-weight: 650;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.model-lock,
.model-selected {
    width: 14px;
    height: 14px;
    flex: 0 0 auto;
    stroke-width: 2;
}

.model-option:not(.is-locked) .model-lock,
.model-option:not([aria-selected="true"]) .model-selected {
    display: none;
}

.chat-identity {
    max-width: min(420px, 45vw);
    margin-right: auto;
    overflow: hidden;
    color: var(--ink-2);
    font-size: 0.8125rem;
    font-weight: 500;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-identity[data-model="spark"]::before {
    content: "Expert · ";
    color: var(--blue);
    font-weight: 600;
}

.chat-identity[hidden] { display: none; }

.temp-chat-btn { position: relative; display: grid; width: 34px; height: 34px; place-items: center; border: 1px solid transparent; border-radius: 9px; color: var(--ink-3); background: transparent; cursor: pointer; }
.temp-chat-btn:hover { color: var(--ink); background: rgba(28, 36, 48, 0.045); }
.temp-chat-btn::after { content: attr(data-label); position: absolute; top: calc(100% + 8px); right: 0; width: max-content; padding: 6px 9px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink-2); background: rgba(255,255,255,.96); box-shadow: 0 6px 20px rgba(28,36,48,.08); font-size: .72rem; opacity: 0; transform: translateY(5px); transition: 150ms var(--out); pointer-events: none; }
.temp-chat-btn:hover::after { opacity: 1; transform: translateY(0); } .temp-chat-btn:disabled { cursor: default; }
.chat-app[data-state="active"]:not([data-temporary="true"]) .temp-chat-btn { display: none; }
.temp-chat-btn svg { width: 16px; height: 16px; stroke-width: 1.7; }
.chat-app[data-temporary="true"] .temp-chat-btn { color: #6658d9; border-color: rgba(102, 88, 217, 0.18); background: rgba(102, 88, 217, 0.07); }
.chat-app[data-temporary="true"] .glow-core { background: radial-gradient(closest-side, rgba(151, 132, 255, 0.4), transparent 74%); }

.toast {
    position: absolute;
    top: 12px;
    right: 24px;
    z-index: 6;
    max-width: min(320px, calc(100vw - 48px));
    padding: 12px 14px;
    border: 1px solid rgba(28, 36, 48, 0.1);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 10px 28px rgba(28, 36, 48, 0.1);
    color: var(--ink-2);
    font-size: 0.84rem;
    line-height: 1.45;
    animation: toast-in 180ms var(--ease);
}

.toast[hidden] {
    display: none !important;
}

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

.new-chat-btn {
    display: inline-flex;
    height: 34px;
    padding: 0 12px;
    align-items: center;
    gap: 7px;
    border: 1px solid var(--line-strong);
    border-radius: 9px;
    color: var(--ink);
    background: var(--paper);
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 500;
    transition: background 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.new-chat-btn[hidden] {
    display: none;
}

.new-chat-btn:hover {
    border-color: rgba(0, 85, 255, 0.25);
    box-shadow: 0 2px 10px rgba(0, 85, 255, 0.08);
}

.new-chat-btn svg {
    width: 14px;
    height: 14px;
    color: var(--blue);
    stroke-width: 1.8;
}

.workspace {
    position: relative;
    z-index: 2;
    display: flex;
    flex: 1;
    min-height: 0;
    flex-direction: column;
    align-items: center;
    padding: 0 24px;
}

.chat-app[data-state="empty"] .workspace {
    justify-content: center;
    padding-bottom: 10vh;
    gap: 0;
}

.chat-app[data-state="active"] .workspace {
    align-items: stretch;
    justify-content: flex-start;
    padding: 0;
    overflow: hidden;
}

/* ── Welcome ───────────────────────────────────────────── */

.welcome {
    width: min(560px, 100%);
    margin-bottom: 28px;
    text-align: center;
}

.chat-app[data-state="active"] .welcome {
    display: none;
}

.welcome-mark {
    display: inline-flex;
    margin-bottom: 3.6px;
    align-items: baseline;
    gap: 0.14em;
    color: var(--ink);
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: -0.03em;
    animation: rise 620ms var(--out) both;
}

.welcome-mark-ai {
    color: inherit;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.welcome-title {
    color: var(--ink);
    font-size: clamp(1.85rem, 3.4vw, 2.5rem);
    font-weight: 600;
    letter-spacing: -0.04em;
    line-height: 1.15;
    animation: rise 680ms var(--out) 60ms both;
}

.welcome-sub {
    margin-top: 10px;
    color: var(--ink-3);
    font-size: 1rem;
    font-weight: 400;
    letter-spacing: -0.01em;
    animation: rise 720ms var(--out) 110ms both;
}

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

/* ── Thread ────────────────────────────────────────────── */

.thread {
    width: min(var(--wide), 100%);
    flex: 1;
    min-height: 0;
    padding: 4px 0 16px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(28, 36, 48, 0.1) transparent;
}

.thread[hidden] {
    display: none;
}

/* Full-bleed scroll like ChatGPT / Claude — bar sits at the pane edge */
.chat-app[data-state="active"] .thread {
    width: 100%;
    padding: 8px 0 28px;
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-gutter: stable;
    scrollbar-width: thin;
    scrollbar-color: rgba(28, 36, 48, 0.18) transparent;
}

.chat-app[data-state="active"] .thread::-webkit-scrollbar {
    width: 8px;
}

.chat-app[data-state="active"] .thread::-webkit-scrollbar-track {
    background: transparent;
}

.chat-app[data-state="active"] .thread::-webkit-scrollbar-thumb {
    border: 2px solid transparent;
    border-radius: 999px;
    background: rgba(28, 36, 48, 0.14);
    background-clip: padding-box;
}

.chat-app[data-state="active"] .thread::-webkit-scrollbar-thumb:hover {
    background: rgba(28, 36, 48, 0.24);
    background-clip: padding-box;
}

.msg {
    display: grid;
    gap: 8px;
    width: min(var(--chat), calc(100% - 48px));
    margin: 0 auto 32px;
    animation: rise 360ms var(--out) both;
}

.chat-app[data-state="active"] .msg {
    width: min(var(--chat), calc(100% - 64px));
}

.msg--user {
    justify-items: end;
}

.msg-stack {
    position: relative;
    width: fit-content;
    max-width: 100%;
    /* Invisible hit bridge so cursor can reach actions without losing :hover */
    padding-bottom: 32px;
    margin-bottom: -32px;
}

.msg--user .msg-stack {
    max-width: min(42rem, 85%);
    justify-self: end;
}

.msg--assistant .msg-stack {
    width: 100%;
}

.msg-bubble {
    max-width: 100%;
    padding: 12px 16px;
    border-radius: 20px;
    font-size: 0.975rem;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
}

.msg--user .msg-bubble {
    max-width: 100%;
    color: var(--ink);
    background: #EFF1F4;
    border-bottom-right-radius: 6px;
}

.msg-bubble--clamp {
    max-height: 15.5em;
    overflow: hidden;
    -webkit-mask-image: linear-gradient(to bottom, #000 72%, transparent);
    mask-image: linear-gradient(to bottom, #000 72%, transparent);
}

.msg-bubble--clamp.is-expanded {
    max-height: none;
    -webkit-mask-image: none;
    mask-image: none;
}

.msg-expand {
    position: absolute;
    right: 2px;
    top: calc(100% - 28px);
    z-index: 1;
    display: inline-flex;
    align-items: center;
    height: 28px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--ink-3);
    font: inherit;
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
}

.msg-expand:hover {
    color: var(--ink);
}

.msg-stack:has(.msg-expand) {
    padding-bottom: 60px;
    margin-bottom: -60px;
}

.msg-stack:has(.msg-expand) .msg-expand {
    top: calc(100% - 56px);
}

.msg-stack:has(.msg-expand):hover,
.msg-stack:has(.msg-expand):focus-within {
    z-index: 5;
}

.msg:has(.msg-expand):hover,
.msg:has(.msg-expand):focus-within {
    position: relative;
    z-index: 5;
}

.msg-stack:has(.msg-expand) .msg-actions--user {
    transition-delay: 0s;
}

.msg-stack:has(.msg-expand):hover .msg-actions--user {
    transition-delay: 1s;
}

.msg--user.is-command .msg-bubble { display: inline-flex; align-items: center; gap: 7px; padding: 9px 12px; color: var(--blue); background: rgba(0, 85, 255, 0.06); border: 1px solid rgba(0, 85, 255, 0.16); }
.msg--user.is-command .msg-bubble svg { width: 14px; height: 14px; stroke-width: 1.8; }
.msg--user.is-command .msg-actions { display: none; }

.msg-actions {
    position: absolute;
    z-index: 2;
    top: calc(100% - 28px);
    display: flex;
    align-items: center;
    gap: 0;
    opacity: 0;
    transform: translateY(2px);
    transition: opacity 140ms ease, transform 150ms var(--ease);
    pointer-events: none;
}

.msg-actions--user {
    right: 2px;
}

.msg-actions--assistant {
    left: 0;
}

.msg-stack:hover .msg-actions,
.msg-stack:focus-within .msg-actions,
.msg-actions.is-pinned {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.msg-action {
    display: inline-flex;
    height: 28px;
    min-width: 28px;
    padding: 0;
    align-items: center;
    justify-content: center;
    gap: 5px;
    border: 0;
    border-radius: 7px;
    color: var(--ink-3);
    background: transparent;
    cursor: pointer;
    font: inherit;
    font-size: 0.75rem;
    font-weight: 500;
    transition: color 120ms ease, background 120ms ease;
}

.msg-actions--assistant .msg-action {
    padding: 0 8px 0 6px;
}

.msg-action:hover {
    color: var(--ink);
    background: rgba(28, 36, 48, 0.06);
}

.msg-action.is-copied {
    color: var(--blue);
}

.msg-action svg {
    width: 14px;
    height: 14px;
    stroke-width: 1.8;
}

.review-control { position: relative; }
.review-popover {
    position: absolute;
    z-index: 10;
    bottom: calc(100% + 6px);
    left: 0;
    width: 184px;
    padding: 5px;
    border: 1px solid var(--line-strong);
    border-radius: 12px;
    background: var(--paper);
    box-shadow: 0 12px 32px rgba(28, 36, 48, 0.12);
    animation: menu-up 160ms var(--out) both;
}

.review-popover[hidden] { display: none; }
.review-popover button { display: block; width: 100%; padding: 8px 10px; border: 0; border-radius: 8px; color: var(--ink-2); background: transparent; cursor: pointer; font-size: 0.78rem; font-weight: 500; text-align: left; }
.review-popover button:hover { color: var(--ink); background: rgba(0, 85, 255, 0.06); }
.chat-app[data-sending="true"] .msg-actions--assistant { opacity: 0; pointer-events: none; }

.msg-edit {
    width: min(42rem, 100%);
    max-width: 85%;
    padding: 12px 14px 10px;
    border: 1px solid rgba(28, 36, 48, 0.1);
    border-radius: 20px;
    border-bottom-right-radius: 6px;
    background: #EFF1F4;
    box-shadow: none;
    animation: rise 180ms var(--out) both;
    transition: border-color 140ms ease;
}

.msg-edit:focus-within {
    border-color: rgba(28, 36, 48, 0.16);
}

.msg-edit-input {
    display: block;
    width: 100%;
    min-height: 44px;
    max-height: 180px;
    padding: 2px 2px;
    resize: none;
    border: 0;
    outline: none;
    box-shadow: none;
    color: var(--ink);
    background: transparent;
    font: inherit;
    font-size: 0.975rem;
    line-height: 1.5;
    caret-color: var(--ink);
}

.msg-edit-input:focus,
.msg-edit-input:focus-visible {
    outline: none;
    box-shadow: none;
    border: 0;
}

.msg-edit-bar {
    display: flex;
    justify-content: flex-end;
    gap: 4px;
    margin-top: 10px;
}

.msg-edit-cancel,
.msg-edit-send {
    height: 30px;
    padding: 0 12px;
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    font: inherit;
    font-size: 0.78rem;
    font-weight: 500;
    transition: background 140ms ease, color 140ms ease;
}

.msg-edit-cancel {
    color: var(--ink-2);
    background: transparent;
}

.msg-edit-cancel:hover {
    color: var(--ink);
    background: rgba(28, 36, 48, 0.06);
}

.msg-edit-cancel:focus-visible,
.msg-edit-send:focus-visible {
    outline: none;
}

.msg-edit-send {
    color: #fff;
    background: var(--blue);
}

.msg-edit-send:hover {
    background: var(--blue-deep);
}

.chat-app[data-sending="true"] .msg-actions--user {
    opacity: 0 !important;
    pointer-events: none !important;
}

@media (hover: none) {
    .msg-actions {
        opacity: 1;
        transform: none;
        pointer-events: auto;
    }
}

.msg--assistant {
    gap: 10px;
}

.msg--assistant .msg-bubble {
    max-width: 100%;
    padding: 0;
    color: var(--ink);
    background: transparent;
    font-size: 1rem;
    line-height: 1.7;
    letter-spacing: -0.011em;
    white-space: normal;
}

.msg-bubble.md.is-revealed {
    animation: md-rise 320ms var(--out) both;
}

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

.msg-bubble.md > :first-child {
    margin-top: 0;
}

.msg-bubble.md > :last-child {
    margin-bottom: 0;
}

.msg-bubble.md p {
    margin: 0.55em 0;
}

.msg-bubble.md hr {
    margin: calc(1.1em + 1px) 0;
    border: 0;
    border-top: 1px solid var(--line);
}

.msg-bubble.md h1,
.msg-bubble.md h2,
.msg-bubble.md h3,
.msg-bubble.md h4,
.msg-bubble.md h5,
.msg-bubble.md h6 {
    color: var(--ink);
    font-weight: 600;
    letter-spacing: -0.03em;
    line-height: 1.3;
}

.msg-bubble.md h1 {
    margin: 1em 0 0.4em;
    font-size: 1.35rem;
}

.msg-bubble.md h2 {
    margin: 0.95em 0 0.35em;
    font-size: 1.18rem;
}

.msg-bubble.md h3 {
    margin: 0.85em 0 0.3em;
    font-size: 1.05rem;
}

.msg-bubble.md h4 {
    margin: 0.8em 0 0.28em;
    font-size: 1rem;
}

.msg-bubble.md h5,
.msg-bubble.md h6 {
    margin: 0.75em 0 0.25em;
    font-size: 0.95rem;
}

.msg-bubble.md ul,
.msg-bubble.md ol {
    margin: 0.55em 0;
    padding-left: 1.35em;
}

.msg-bubble.md li {
    margin: 0.28em 0;
}

.msg-bubble.md li > ul,
.msg-bubble.md li > ol {
    margin: 0.22em 0 0.12em;
}

.msg-bubble.md li > ul > li,
.msg-bubble.md li > ol > li {
    margin: 0.12em 0;
}

.msg-bubble.md li p {
    margin: 0.2em 0;
}

.msg-bubble.md blockquote {
    margin: 0.75em 0;
    padding: 0.15em 0 0.15em 1em;
    border-left: 3px solid rgba(0, 85, 255, 0.24);
    color: var(--ink-2);
}

.msg-bubble.md table {
    display: block;
    width: max-content;
    max-width: 100%;
    margin: 0.85em 0;
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 12px;
    border-collapse: collapse;
    border-spacing: 0;
    font-size: 0.9rem;
}

.msg-bubble.md th,
.msg-bubble.md td {
    padding: 8px 14px;
    text-align: left;
    border-bottom: 1px solid var(--line);
    border-right: 1px solid var(--line);
    vertical-align: top;
}

.msg-bubble.md th:last-child,
.msg-bubble.md td:last-child {
    border-right: 0;
}

.msg-bubble.md tbody tr:last-child td {
    border-bottom: 0;
}

.msg-bubble.md thead th {
    font-weight: 600;
    color: var(--ink);
    background: rgba(28, 36, 48, 0.035);
    white-space: nowrap;
}

.msg-bubble.md tbody tr:nth-child(even) td {
    background: rgba(28, 36, 48, 0.015);
}

.msg-bubble.md strong {
    font-weight: 600;
    color: var(--ink);
}

.msg-bubble.md em {
    font-style: italic;
}

.msg-bubble.md code {
    padding: 0.04em 0.28em 0.07em;
    border: 1px solid rgba(28, 36, 48, 0.1);
    border-radius: 4px;
    color: #3b4656;
    background: rgba(28, 36, 48, 0.035);
    box-shadow: inset 0 -1px 0 rgba(28, 36, 48, 0.025);
    font-family: "SF Mono", "Menlo", "Monaco", "Consolas", monospace;
    font-size: 0.84em;
    font-weight: 450;
    letter-spacing: -0.01em;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
}

.msg-bubble.md pre {
    margin: 0.75em 0;
    padding: 14px 16px;
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #f6f7f9;
    font-family: "SF Mono", "Menlo", "Monaco", "Consolas", monospace;
    font-size: 0.875rem;
    line-height: 1.55;
}

.msg-bubble.md pre code {
    padding: 0;
    border: 0;
    border-radius: 0;
    color: inherit;
    background: transparent;
    box-shadow: none;
    font-size: inherit;
    font-weight: inherit;
    letter-spacing: normal;
}

.msg-bubble.md .ask-math {
    display: block;
    margin: 1.35em 0;
    padding: 0.2em 0.1em;
    overflow-x: auto;
    overflow-y: hidden;
    text-align: center;
    color: var(--ink);
    border: 0;
    background: transparent;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(28, 36, 48, 0.18) transparent;
}

.msg-bubble.md .ask-math::-webkit-scrollbar {
    height: 4px;
}

.msg-bubble.md .ask-math::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: rgba(28, 36, 48, 0.16);
}

.msg-bubble.md .ask-math.inline {
    display: inline;
    margin: 0 0.02em;
    padding: 0;
    overflow: visible;
    vertical-align: baseline;
    text-align: inherit;
    color: inherit;
}

.msg-bubble.md p + .ask-math,
.msg-bubble.md ul + .ask-math,
.msg-bubble.md ol + .ask-math {
    margin-top: 1.15em;
}

.msg-bubble.md .ask-math + p,
.msg-bubble.md .ask-math + ul,
.msg-bubble.md .ask-math + ol {
    margin-top: 1.15em;
}

.msg-bubble.md .ask-math + .ask-math {
    margin-top: 0.85em;
}

.msg-bubble.md li .ask-math {
    margin: 0.55em 0;
    padding: 0;
    text-align: center;
}

.msg-bubble.md li > .ask-math:first-child {
    margin-top: 0.2em;
}

.msg-bubble.md ul:has(.ask-math),
.msg-bubble.md ol:has(.ask-math) {
    margin: 0.85em 0;
    padding-left: 1.2em;
}

.msg-bubble.md li:has(.ask-math) {
    margin: 0.65em 0;
    padding-left: 0.15em;
}

/* Gemini-scale display math; prose text inside math stays on Quietly Inter */
.msg-bubble.md .ask-math .katex {
    font-size: 1.42em;
    color: var(--ink);
    line-height: 1.5;
    text-rendering: auto;
    -webkit-font-smoothing: antialiased;
}

.msg-bubble.md .ask-math.inline .katex {
    font-size: 1.12em;
    line-height: inherit;
}

.msg-bubble.md .ask-math .katex .text,
.msg-bubble.md .ask-math .katex .textrm,
.msg-bubble.md .ask-math .katex .textup,
.msg-bubble.md .ask-math .katex .textmd {
    font-family: var(--font);
    font-style: normal;
    letter-spacing: -0.01em;
}

.msg-bubble.md .ask-math .katex-display {
    margin: 0;
    display: block;
}

.msg-bubble.md .ask-math .katex-display > .katex {
    display: inline-block;
    max-width: 100%;
    text-align: center;
    white-space: nowrap;
}

.msg-bubble.md .ask-math .katex .base {
    color: var(--ink);
}

.msg-bubble.md .ask-math .katex-error {
    color: var(--ink-2);
}

/* Quietly-soft \boxed{} instead of harsh KaTeX default */
.msg-bubble.md .ask-math .katex .enclosing {
    border-color: var(--line-strong) !important;
    border-radius: 0.4em;
    padding: 0.32em 0.5em !important;
    background: rgba(28, 36, 48, 0.03);
}

.thinking {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 2px 0;
}

.thinking-label {
    position: relative;
    color: var(--ink-3);
    font-size: 0.975rem;
    font-weight: 500;
    letter-spacing: -0.02em;
    background: linear-gradient(
        100deg,
        var(--ink-4) 0%,
        var(--ink-4) 28%,
        var(--ink) 50%,
        var(--ink-4) 72%,
        var(--ink-4) 100%
    );
    background-size: 220% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: thinking-shimmer 1.7s ease-in-out infinite;
}

.thinking-label::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -5px;
    height: 1px;
    border-radius: 1px;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(0, 85, 255, 0.35) 35%,
        rgba(0, 85, 255, 0.55) 50%,
        rgba(0, 85, 255, 0.35) 65%,
        transparent 100%
    );
    background-size: 220% 100%;
    opacity: 0.7;
    animation: thinking-shimmer 1.7s ease-in-out infinite;
}

@keyframes thinking-shimmer {
    0% { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}

.msg--assistant.is-error .msg-bubble {
    color: #c53030;
    font-size: 0.95rem;
    line-height: 1.55;
}

.msg--assistant.is-error .msg-upgrade-link {
    color: #0055ff;
    font-weight: 600;
}

.msg--assistant.is-empty .msg-bubble { color: var(--ink-4); font-size: 0.875rem; font-style: italic; }
.msg--assistant.is-empty .msg-actions { display: none; }

.composer.is-sending {
    border-color: rgba(0, 85, 255, 0.18);
    box-shadow:
        0 1px 2px rgba(28, 36, 48, 0.03),
        0 10px 28px rgba(0, 85, 255, 0.06);
}

.composer.is-sending .send-btn {
    background: var(--ink);
}

.composer.is-sending .send-btn:hover {
    background: #0f1620;
    transform: none;
}

.composer.is-sending .send-icon--submit { opacity: 0; transform: scale(0.65); }
.composer.is-sending .send-icon--stop { opacity: 1; transform: scale(1); }

.msg-meta {
    color: var(--ink-4);
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: -0.01em;
}

.msg--assistant.is-stopped .msg-meta { color: #887db5; }

/* ── Composer cluster ──────────────────────────────────── */

.composer-dock {
    position: relative;
    z-index: 8;
    display: grid;
    width: min(var(--wide), 100%);
    justify-items: center;
    flex-shrink: 0;
    animation: rise 760ms var(--out) 160ms both;
}

.chat-app[data-state="active"] .composer-dock {
    width: 100%;
    padding: 0 0 18px;
    animation: none;
}

.chat-app[data-state="active"] .composer-dock::before {
    content: "";
    position: absolute;
    z-index: -1;
    right: 0;
    bottom: 0;
    left: 0;
    height: 100px;
    background: linear-gradient(to top, #fdfdfd 55%, transparent);
    pointer-events: none;
}

.chat-app[data-state="active"] .composer {
    width: min(var(--chat), calc(100% - 64px));
}

.chat-app[data-state="active"] .starters {
    display: none;
}

.composer {
    position: relative;
    width: 100%;
    padding: 14px 14px 11px;
    border: 1px solid rgba(28, 36, 48, 0.1);
    border-radius: 22px;
    background: #fff;
    box-shadow:
        0 1px 2px rgba(28, 36, 48, 0.03),
        0 10px 28px rgba(28, 36, 48, 0.05);
    transition: border-color 180ms ease, box-shadow 220ms ease;
}

.composer:hover {
    border-color: rgba(28, 36, 48, 0.14);
    box-shadow:
        0 1px 2px rgba(28, 36, 48, 0.04),
        0 12px 32px rgba(28, 36, 48, 0.07);
}

.composer:focus-within {
    border-color: rgba(28, 36, 48, 0.2);
    box-shadow:
        0 1px 2px rgba(28, 36, 48, 0.04),
        0 14px 36px rgba(28, 36, 48, 0.09);
}

.composer:focus-within:hover {
    border-color: rgba(28, 36, 48, 0.2);
}

.composer textarea {
    display: block;
    width: 100%;
    height: 28px;
    max-height: min(40vh, 320px);
    padding: 2px 6px;
    resize: none;
    border: 0;
    outline: 0;
    color: var(--ink);
    background: transparent;
    font-size: 0.975rem;
    line-height: 1.5;
    overflow-y: hidden;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: rgba(28, 36, 48, 0.25) transparent;
}

.attach-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 6px 8px;
}

.attach-chips[hidden] {
    display: none !important;
}

.attach-preview {
    position: relative;
    width: 72px;
    height: 72px;
    overflow: hidden;
    border: 1px solid rgba(28, 36, 48, 0.1);
    border-radius: 14px;
    background: rgba(28, 36, 48, 0.04);
}

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

.attach-preview-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    display: grid;
    width: 22px;
    height: 22px;
    place-items: center;
    border: 0;
    border-radius: 50%;
    color: #fff;
    background: rgba(28, 36, 48, 0.55);
    cursor: pointer;
}

.attach-preview-remove:hover {
    background: rgba(28, 36, 48, 0.72);
}

.attach-preview-remove svg {
    width: 12px;
    height: 12px;
    stroke-width: 2.2;
}

.attach-chip {
    display: inline-flex;
    max-width: min(220px, 70vw);
    align-items: center;
    gap: 8px;
    min-height: 34px;
    padding: 4px 8px 4px 6px;
    border: 1px solid rgba(28, 36, 48, 0.1);
    border-radius: 12px;
    background: rgba(28, 36, 48, 0.04);
    color: var(--ink-2);
    font-size: 0.78rem;
    line-height: 1.2;
}

.attach-chip svg {
    width: 15px;
    height: 15px;
    flex: 0 0 auto;
    stroke-width: 1.8;
    color: var(--ink-3);
}

.attach-chip-thumb {
    width: 24px;
    height: 24px;
    flex: 0 0 auto;
    border-radius: 6px;
    object-fit: cover;
    background: rgba(28, 36, 48, 0.06);
}

.attach-chip-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.attach-chip-remove {
    display: grid;
    width: 20px;
    height: 20px;
    flex: 0 0 auto;
    place-items: center;
    margin-left: 2px;
    border: 0;
    border-radius: 50%;
    color: var(--ink-3);
    background: transparent;
    cursor: pointer;
}

.attach-chip-remove:hover {
    color: var(--ink);
    background: rgba(28, 36, 48, 0.08);
}

.attach-chip-remove svg {
    width: 13px;
    height: 13px;
}

.attach-chip--static {
    padding-right: 10px;
}

button.attach-chip--paste {
    font-family: inherit;
    font-size: 0.78rem;
    line-height: 1.2;
    letter-spacing: -0.01em;
    color: var(--ink-2);
    cursor: pointer;
    transition: background 140ms ease, border-color 140ms ease;
}

button.attach-chip--paste:focus-visible {
    outline: 2px solid var(--accent, rgba(28, 36, 48, 0.35));
    outline-offset: 2px;
}

.attach-chip--paste svg {
    color: var(--accent, var(--ink-2));
}

.paste-dialog {
    margin: auto;
    border: 0;
    border-radius: 18px;
    padding: 0;
    width: min(680px, calc(100vw - 32px));
    max-height: min(80vh, 720px);
    overflow: hidden;
    box-shadow:
        0 1px 2px rgba(28, 36, 48, 0.04),
        0 24px 56px rgba(28, 36, 48, 0.16);
    color: var(--ink);
    font-family: var(--font);
    background: #fff;
}

.paste-dialog::backdrop {
    background: rgba(28, 36, 48, 0.28);
    backdrop-filter: blur(2px);
}

.paste-dialog-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 20px 22px 14px;
}

.paste-dialog-head h2 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.paste-dialog-close {
    display: grid;
    width: 30px;
    height: 30px;
    flex: 0 0 auto;
    place-items: center;
    border: 0;
    border-radius: 9px;
    color: var(--ink-3);
    background: transparent;
    cursor: pointer;
    transition: background 140ms ease, color 140ms ease;
}

.paste-dialog-close:hover {
    color: var(--ink);
    background: rgba(28, 36, 48, 0.06);
}

.paste-dialog-close svg {
    width: 17px;
    height: 17px;
}

.paste-dialog-body {
    margin: 0;
    padding: 16px 22px 22px;
    max-height: calc(min(80vh, 720px) - 64px);
    overflow-y: auto;
    overscroll-behavior: contain;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.8125rem;
    line-height: 1.6;
    color: var(--ink-2);
    border-top: 1px solid rgba(28, 36, 48, 0.08);
}

.msg-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
    margin-bottom: 8px;
}

.msg-attach-image {
    overflow: hidden;
    max-width: min(280px, 72vw);
    border: 1px solid rgba(28, 36, 48, 0.08);
    border-radius: 16px;
    background: rgba(28, 36, 48, 0.04);
}

.msg-attach-image img {
    display: block;
    width: 100%;
    height: auto;
    vertical-align: middle;
}

.msg-attach-stack {
    position: relative;
    width: 88px;
    height: 88px;
    overflow: hidden;
    border: 1px solid rgba(28, 36, 48, 0.1);
    border-radius: 16px;
    background: rgba(28, 36, 48, 0.04);
    box-shadow: 4px 4px 0 rgba(28, 36, 48, 0.06);
}

.msg-attach-stack img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.msg-attach-count {
    position: absolute;
    right: 6px;
    bottom: 6px;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 999px;
    background: rgba(28, 36, 48, 0.78);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 22px;
    text-align: center;
}

.msg--user .msg-attachments .attach-chip {
    background: rgba(255, 255, 255, 0.72);
    border-color: rgba(28, 36, 48, 0.08);
}

.composer textarea::placeholder {
    color: var(--ink-4);
}

.composer-bar {
    display: flex;
    margin-top: 10px;
    align-items: center;
    justify-content: space-between;
}

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

.icon-btn {
    display: grid;
    width: 32px;
    height: 32px;
    place-items: center;
    border: 0;
    border-radius: 50%;
    color: var(--ink-3);
    background: transparent;
    cursor: pointer;
    transition: color 140ms ease, background 140ms ease;
}

.icon-btn:hover {
    color: var(--ink);
    background: rgba(28, 36, 48, 0.05);
}

.icon-btn svg {
    width: 18px;
    height: 18px;
    stroke-width: 1.7;
}

.mode-menu {
    position: relative;
}

body.is-style-open {
    overflow: hidden;
}

.write-tools {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.write-tools[hidden] {
    display: none !important;
}

.write-pill {
    display: inline-flex;
    height: 32px;
    padding: 0 11px;
    align-items: center;
    gap: 6px;
    border: 1px solid rgba(0, 85, 255, 0.18);
    border-radius: 16px;
    background: rgba(0, 85, 255, 0.05);
    color: var(--blue);
    font-size: 0.72rem;
    font-weight: 550;
    cursor: pointer;
    transition: background 140ms ease, border-color 140ms ease, color 140ms ease;
}

.write-pill svg { width: 14px; height: 14px; stroke-width: 1.8; }
.write-pill.has-style { background: rgba(0, 85, 255, 0.08); border-color: rgba(0, 85, 255, 0.28); }

.write-pill:hover,
.write-pill[aria-expanded="true"] {
    background: rgba(0, 85, 255, 0.09);
    border-color: rgba(0, 85, 255, 0.32);
    color: var(--blue-deep);
}

.write-tip {
    position: absolute;
    right: 0;
    bottom: calc(100% + 12px);
    width: min(260px, 76vw);
    padding: 12px 13px;
    border-radius: 12px;
    background: var(--ink);
    color: #f4f7ff;
    font-size: 0.78rem;
    line-height: 1.35;
    box-shadow: 0 12px 28px rgba(28, 36, 48, 0.18);
    z-index: 5;
}

.write-tip[hidden] {
    display: none !important;
}

.write-tip strong { display: block; margin-bottom: 3px; color: #fff; }

.write-tip-arrow {
    position: absolute;
    right: 28px;
    bottom: -6px;
    width: 12px;
    height: 12px;
    background: var(--ink);
    transform: rotate(45deg);
}

.write-tip button {
    display: block;
    margin-top: 8px;
    border: 0;
    background: rgba(0, 85, 255, 0.9);
    color: #fff;
    border-radius: 999px;
    padding: 5px 11px;
    font-size: 0.72rem;
    cursor: pointer;
}

.write-tip button:hover {
    background: var(--blue);
}

.slash-menu {
    position: absolute;
    left: 14px;
    bottom: calc(100% - 8px);
    min-width: 200px;
    padding: 5px;
    border: 1px solid var(--line-strong);
    border-radius: 12px;
    background: var(--paper);
    box-shadow: 0 12px 32px rgba(28, 36, 48, 0.12);
    z-index: 6;
}

.slash-menu[hidden] {
    display: none !important;
}

.slash-menu button {
    display: block;
    width: 100%;
    text-align: left;
    border: 0;
    background: transparent;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 0.82rem;
    color: var(--ink);
    cursor: pointer;
}

.slash-menu button:hover,
.slash-menu button[aria-selected="true"] {
    background: rgba(28, 36, 48, 0.05);
}

.slash-menu .slash-hint {
    display: block;
    margin-top: 2px;
    font-size: 0.72rem;
    color: var(--ink-3);
}

.style-panel {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: grid;
    place-items: center;
    padding: 24px;
    border: 0;
    border-radius: 0;
    background: rgba(28, 36, 48, 0.28);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    overflow: auto;
    overscroll-behavior: contain;
    animation: style-backdrop-in 160ms var(--out) both;
}

.style-panel[hidden],
.style-panel [hidden] {
    display: none !important;
}

.style-panel-card {
    display: flex;
    flex-direction: column;
    width: min(680px, calc(100vw - 48px));
    max-height: min(720px, calc(100dvh - 48px));
    overflow: hidden;
    border: 1px solid var(--line-strong);
    border-radius: 20px;
    background: #fff;
    box-shadow:
        0 1px 2px rgba(28, 36, 48, 0.04),
        0 24px 56px rgba(28, 36, 48, 0.16);
    animation: menu-down 180ms var(--out) both;
}

.style-panel-head,
.style-footer,
.style-composer-bar,
.style-sample-card {
    display: flex;
    align-items: center;
}

.style-panel-head {
    flex: 0 0 auto;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 20px 0;
}

.style-step {
    color: var(--blue);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.style-close {
    display: grid;
    width: 28px;
    height: 28px;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: rgba(28, 36, 48, 0.05);
    color: var(--ink-2);
    cursor: pointer;
}

.style-close:hover {
    background: rgba(28, 36, 48, 0.09);
    color: var(--ink);
}

.style-close svg {
    width: 15px;
    height: 15px;
}

.style-view {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
}

.style-panel-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 12px 20px 8px;
    scrollbar-width: thin;
}

.style-panel-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--ink);
}

.style-panel-sub {
    margin: 5px 0 14px;
    font-size: 0.77rem;
    line-height: 1.5;
    color: var(--ink-2);
}

.style-composer {
    overflow: hidden;
    border: 1px solid rgba(0, 85, 255, 0.2);
    border-radius: 14px;
    background: linear-gradient(145deg, rgba(0, 85, 255, 0.035), rgba(125, 89, 255, 0.025));
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.7);
}

.style-panel textarea {
    width: 100%;
    resize: none;
    border: 0;
    padding: 12px 13px;
    font: inherit;
    font-size: 0.82rem;
    line-height: 1.5;
    background: transparent;
    color: var(--ink);
}

#style-sample-input {
    height: 168px;
    min-height: 168px;
    max-height: 168px;
    padding: 15px 16px;
    overflow-y: auto;
    white-space: pre-wrap;
}

.style-panel textarea:focus {
    outline: none;
}

.style-composer:focus-within {
    border-color: rgba(0, 85, 255, 0.42);
    box-shadow: 0 0 0 3px rgba(0, 85, 255, 0.08);
}

.style-composer-bar {
    justify-content: space-between;
    padding: 8px 9px 9px 13px;
    border-top: 1px solid rgba(0, 85, 255, 0.08);
    color: var(--ink-3);
    font-size: 0.69rem;
}

.style-composer-bar button,
.style-primary,
.style-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 0;
    border-radius: 999px;
    cursor: pointer;
}

.style-composer-bar button {
    min-height: 32px;
    padding: 0 12px;
    border-radius: 10px;
    background: var(--ink);
    color: #fff;
    box-shadow: 0 4px 10px rgba(28, 36, 48, 0.13);
    font-size: 0.71rem;
    font-weight: 650;
}

.style-composer-bar button:hover:not(:disabled) {
    background: #0d131d;
}

.style-composer-bar button:disabled {
    opacity: 0.4;
    cursor: default;
}

.style-composer-bar svg,
.style-primary svg {
    width: 13px;
    height: 13px;
}

.style-samples {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 0 0 14px;
}

.style-samples:empty {
    display: none;
}

.style-sample-card {
    width: 100%;
    min-width: 0;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fafbfc;
}

.style-sample-card:hover,
.style-sample-card:focus-within {
    border-color: var(--line-strong);
    background: #fff;
}

.style-sample-index {
    display: grid;
    flex: 0 0 26px;
    height: 26px;
    place-items: center;
    border: 1px solid rgba(0, 85, 255, 0.18);
    border-radius: 8px;
    background: #fff;
    color: var(--blue);
    font-size: 0.65rem;
    font-weight: 700;
}

.style-sample-copy {
    min-width: 0;
    flex: 1;
    overflow: hidden;
}

.style-sample-copy strong,
.style-sample-copy span {
    display: block;
}

.style-sample-copy strong {
    display: -webkit-box;
    overflow: hidden;
    color: var(--ink);
    font-size: 0.78rem;
    font-weight: 550;
    line-height: 1.45;
    overflow-wrap: anywhere;
    word-break: break-word;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.style-sample-copy span {
    margin-top: 3px;
    color: var(--ink-3);
    font-size: 0.65rem;
}

.style-sample-card button {
    display: grid;
    flex: 0 0 28px;
    width: 28px;
    height: 28px;
    place-items: center;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--ink-3);
    cursor: pointer;
}

.style-sample-card button:hover {
    background: rgba(28, 36, 48, 0.06);
    color: var(--ink);
}

.style-sample-card button svg {
    width: 14px;
    height: 14px;
}

.style-error {
    margin: 10px 2px 0;
    color: #b42318;
    font-size: 0.7rem;
    line-height: 1.4;
}

.style-footer {
    flex: 0 0 auto;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 20px 18px;
    border-top: 1px solid rgba(28, 36, 48, 0.06);
}

.style-footer > span {
    color: var(--ink-2);
    font-size: 0.72rem;
}

.style-footer > span strong {
    color: var(--ink);
}

.style-footer small {
    display: block;
    margin-top: 2px;
    color: var(--ink-3);
    font-size: 0.62rem;
}

.style-primary,
.style-secondary {
    min-height: 34px;
    padding: 0 13px;
    font-size: 0.72rem;
    font-weight: 650;
    transition: opacity 140ms ease, background 140ms ease;
}

.style-primary {
    background: var(--blue);
    color: #fff;
    box-shadow: 0 6px 14px rgba(0, 85, 255, 0.18);
}

.style-primary:hover:not(:disabled) {
    background: var(--blue-deep);
}

.style-primary:disabled {
    opacity: 0.35;
    cursor: default;
    box-shadow: none;
}

.style-secondary {
    background: rgba(28, 36, 48, 0.05);
    color: var(--ink-2);
}

.style-secondary:hover {
    background: rgba(28, 36, 48, 0.09);
    color: var(--ink);
}

.style-loading {
    padding: 0;
}

.style-skel {
    border-radius: 10px;
    background: linear-gradient(
        90deg,
        #f0f2f5 0%,
        #ffffff 50%,
        #f0f2f5 100%
    );
    background-size: 200% 100%;
    background-position: 100% 0;
    animation: style-shimmer 1.4s ease-in-out infinite both;
}

.style-skel--title {
    width: 58%;
    height: 22px;
    margin-bottom: 10px;
    border-radius: 8px;
}

.style-skel--sub {
    width: 84%;
    height: 14px;
    margin-bottom: 18px;
    border-radius: 7px;
    animation-delay: 80ms;
}

.style-skel--block {
    width: 100%;
    height: 220px;
    border-radius: 13px;
    animation-delay: 140ms;
}

.style-skel--btn {
    display: inline-block;
    width: 108px;
    height: 34px;
    border-radius: 999px;
    animation-delay: 200ms;
}

.style-skel--btn-primary {
    width: 120px;
    animation-delay: 260ms;
}

.style-loading .style-footer {
    justify-content: flex-end;
}

#style-result textarea {
    height: 220px;
    min-height: 180px;
    max-height: 280px;
    overflow-y: auto;
    border: 1px solid var(--line-strong);
    border-radius: 13px;
    background: rgba(0, 85, 255, 0.025);
}

#style-result textarea:focus {
    border-color: rgba(0, 85, 255, 0.35);
    box-shadow: 0 0 0 3px rgba(0, 85, 255, 0.08);
}

@keyframes style-shimmer {
    0% {
        background-position: 100% 0;
    }
    100% {
        background-position: -100% 0;
    }
}

@keyframes style-backdrop-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.mode-btn {
    display: inline-flex;
    height: 32px;
    padding: 0 11px;
    align-items: center;
    gap: 5px;
    border: 1px solid var(--line);
    border-radius: 16px;
    color: var(--ink-2);
    background: transparent;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 500;
    transition: background 140ms ease, border-color 140ms ease, color 140ms ease;
}

.mode-reasoning {
    color: var(--ink-3);
    font-weight: 450;
}

.mode-btn:hover,
.mode-btn[aria-expanded="true"] {
    color: var(--ink);
    border-color: var(--line-strong);
    background: rgba(28, 36, 48, 0.03);
}

.mode-btn svg {
    width: 12px;
    height: 12px;
    color: var(--ink-3);
    stroke-width: 2;
}

.mode-list {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    bottom: auto;
    min-width: 128px;
    padding: 5px;
    border: 1px solid var(--line-strong);
    border-radius: 12px;
    background: var(--paper);
    box-shadow: 0 12px 32px rgba(28, 36, 48, 0.12);
    list-style: none;
    animation: menu-down 160ms var(--out) both;
}

.chat-app[data-state="active"] .mode-list {
    top: auto;
    bottom: calc(100% + 8px);
    animation-name: menu-up;
}

@keyframes menu-down {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes menu-up {
    from {
        opacity: 0;
        transform: translateY(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.mode-list[hidden] {
    display: none;
}

.mode-list li {
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    color: var(--ink-2);
    font-size: 0.8125rem;
    font-weight: 500;
}

.mode-list li:hover,
.mode-list li[aria-selected="true"] {
    color: var(--ink);
    background: rgba(0, 85, 255, 0.06);
}

.send-btn {
    display: grid;
    width: 32px;
    height: 32px;
    place-items: center;
    border: 0;
    border-radius: 50%;
    color: #fff;
    background: var(--blue);
    cursor: pointer;
    transition: background 150ms ease, opacity 150ms ease, transform 200ms var(--ease);
}

.send-btn:hover:not(:disabled) {
    background: var(--blue-deep);
    transform: scale(1.05);
}

.send-btn:disabled {
    opacity: 0.28;
    cursor: default;
}

.send-btn svg {
    grid-area: 1 / 1;
    width: 16px;
    height: 16px;
    stroke-width: 2.2;
    transition: opacity 120ms ease, transform 160ms var(--ease);
}

.send-btn .send-icon--stop { width: 11px; height: 11px; opacity: 0; transform: scale(0.65); fill: currentColor; stroke-width: 2.5; }

.starters {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px 18px;
    margin-top: 18px;
}

.starters button {
    border: 0;
    background: transparent;
    cursor: pointer;
    color: var(--ink-3);
    font-size: 0.8125rem;
    font-weight: 400;
    transition: color 150ms ease;
}

.starters button:hover {
    color: var(--blue);
}

.composer-note {
    margin-top: 14px;
    color: var(--ink-4);
    font-size: 0.6875rem;
    text-align: center;
}

.chat-app[data-state="active"] .composer-note {
    margin-top: 10px;
}

.sidebar-scrim {
    display: none;
}

/* ── Responsive ────────────────────────────────────────── */

@media (max-width: 860px) {
    .chat-app,
    .chat-app.sidebar-collapsed {
        display: block;
    }

    .sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        width: var(--open);
        box-shadow: 20px 0 48px rgba(28, 36, 48, 0.08);
        transform: translateX(0);
        transition: transform 400ms var(--ease), box-shadow 200ms ease;
    }

    .chat-app.sidebar-collapsed .sidebar {
        transform: translateX(calc(-1 * var(--panel)));
        box-shadow: none;
    }

    .chat-app.sidebar-collapsed .sidebar-panel {
        width: var(--panel);
        padding: 18px 14px 18px 0;
        opacity: 1;
        pointer-events: auto;
        transform: none;
    }

    .main-panel {
        width: calc(100vw - var(--rail));
        margin-left: var(--rail);
    }

    .sidebar-scrim {
        position: fixed;
        z-index: 15;
        inset: 0 0 0 var(--open);
        display: block;
        border: 0;
        background: rgba(28, 36, 48, 0.16);
        opacity: 1;
        visibility: visible;
        transition: opacity 200ms ease, visibility 0s linear;
    }

    .chat-app.sidebar-collapsed .sidebar-scrim {
        opacity: 0;
        visibility: hidden;
        transition-delay: 0s, 200ms;
    }

    .workspace {
        padding-inline: 16px;
    }

    .chat-app[data-state="active"] .workspace {
        padding-inline: 0;
    }

    .chat-app[data-state="active"] .msg,
    .chat-app[data-state="active"] .composer {
        width: min(var(--chat), calc(100% - 32px));
    }

    .chat-app[data-state="active"] .composer-dock {
        padding-bottom: max(12px, env(safe-area-inset-bottom));
    }
}

@media (max-width: 640px) {
    :root {
        --rail: 54px;
    }

    .welcome-title {
        font-size: clamp(1.55rem, 7vw, 1.9rem);
    }

    .chat-app[data-state="empty"] .workspace {
        justify-content: flex-start;
        padding-top: 8vh;
        padding-bottom: 4vh;
    }

    .new-chat-btn span {
        display: none;
    }

    .new-chat-btn {
        width: 34px;
        padding: 0;
        justify-content: center;
    }

    .composer-note {
        display: none;
    }

    .starters {
        gap: 8px 14px;
    }

    .style-panel {
        padding: 12px;
    }

    .style-panel-card {
        width: min(680px, calc(100vw - 24px));
        max-height: calc(100dvh - 24px);
    }

    .style-panel-head {
        padding: 14px 16px 0;
    }

    .style-panel-scroll {
        padding: 10px 16px 8px;
    }

    .style-footer {
        padding: 12px 16px 16px;
    }

    #style-sample-input {
        height: 140px;
        min-height: 140px;
        max-height: 140px;
    }
}

@media (max-height: 680px) {
    .welcome-sub {
        display: none;
    }

    .welcome {
        margin-bottom: 18px;
    }

    .chat-app[data-state="empty"] .workspace {
        padding-bottom: 4vh;
    }
}

.confirm-dialog,
.auth-dialog {
    margin: auto;
    border: 0;
    border-radius: 18px;
    padding: 26px 24px 22px;
    width: min(420px, calc(100vw - 32px));
    box-shadow:
        0 1px 2px rgba(28, 36, 48, 0.04),
        0 24px 56px rgba(28, 36, 48, 0.16);
    color: var(--ink);
    font-family: var(--font);
    background: #fff;
}

.confirm-dialog::backdrop,
.auth-dialog::backdrop {
    background: rgba(28, 36, 48, 0.28);
    backdrop-filter: blur(2px);
}

.confirm-dialog p {
    margin: 0 0 18px;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.confirm-dialog form {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
}

.confirm-dialog button,
.auth-dialog button {
    height: 40px;
    padding: 0 15px;
    border: 0;
    border-radius: 11px;
    background: transparent;
    cursor: pointer;
    font: inherit;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--ink-2);
    transition: background 140ms ease, color 140ms ease;
}

.confirm-dialog button:hover,
.auth-dialog .auth-cancel:hover {
    color: var(--ink);
    background: rgba(28, 36, 48, 0.05);
}

.confirm-dialog button:focus,
.auth-dialog button:focus {
    outline: none;
}

.confirm-dialog .confirm-delete,
.auth-dialog .auth-submit {
    color: #fff;
    background: var(--blue);
}

.confirm-dialog .confirm-delete:hover,
.auth-dialog .auth-submit:hover {
    color: #fff;
    background: var(--blue-deep);
}

.confirm-dialog .confirm-delete {
    background: #de3b3b;
}

.confirm-dialog .confirm-delete:hover {
    background: #c53030;
}

.auth-form {
    display: grid;
    gap: 12px;
}

.auth-brand {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
    color: var(--ink);
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: -0.03em;
}

.account-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 4px;
}

.account-header .auth-brand {
    margin-bottom: 0;
}

.account-dismiss {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    color: var(--ink-3);
    background: transparent;
    cursor: pointer;
    flex-shrink: 0;
    line-height: 0;
    transition: background 140ms ease, color 140ms ease;
}

.account-dismiss:hover {
    color: var(--ink);
    background: rgba(28, 36, 48, 0.06);
}

.account-dismiss:focus {
    outline: none;
}

.account-dismiss svg {
    display: block;
    width: 16px;
    height: 16px;
    stroke-width: 2.2;
}

.auth-dialog .account-dismiss {
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 8px;
    color: var(--ink-3);
    background: transparent;
}

.auth-dialog .account-dismiss:hover {
    color: var(--ink);
    background: rgba(28, 36, 48, 0.06);
}

.auth-brand img {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

.auth-brand em {
    color: var(--blue);
    font-style: normal;
    letter-spacing: -0.02em;
}

.auth-form h2 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 650;
    letter-spacing: -0.03em;
}

.auth-sub {
    margin: -4px 0 2px;
    color: var(--ink-3);
    font-size: 0.8rem;
    line-height: 1.35;
    letter-spacing: -0.01em;
}

.account-actions {
    padding-bottom: 0;
    border-bottom: 0;
}

.auth-actions.account-actions {
    margin-top: 4px;
    padding-bottom: 0;
    border-bottom: 0;
}

.account-manage-tip {
    margin: 0;
    padding: 2px 2px 0;
    color: var(--ink-3);
    font-size: 0.8rem;
    line-height: 1.45;
    letter-spacing: -0.01em;
}

.account-manage-tip[hidden] {
    display: none;
}

.account-manage-tip strong {
    color: var(--ink-2);
    font-weight: 550;
}

.account-support {
    margin: 4px 0 0;
    padding-top: 14px;
    border-top: 1px solid var(--line);
    text-align: center;
    color: var(--ink-3);
    font-size: 0.72rem;
    line-height: 1.45;
    letter-spacing: -0.01em;
}

.account-support a {
    color: var(--ink-2);
    text-decoration: none;
    font-weight: 500;
}

.account-support a:hover {
    color: var(--blue);
    text-decoration: underline;
}

.auth-field {
    display: grid;
    gap: 6px;
}

.auth-field span {
    color: var(--ink-2);
    font-size: 0.75rem;
    font-weight: 500;
}

.auth-field input {
    height: 42px;
    padding: 0 13px;
    border: 1px solid var(--line-strong);
    border-radius: 11px;
    color: var(--ink);
    background: #fff;
    font: inherit;
    font-size: 0.9rem;
}

.auth-field input:focus {
    outline: none;
    border-color: rgba(0, 85, 255, 0.35);
    box-shadow: 0 0 0 3px rgba(0, 85, 255, 0.1);
}

.auth-error {
    margin: 0;
    color: #c53030;
    font-size: 0.78rem;
}

.auth-error[hidden] {
    display: none;
}

.auth-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 4px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--line);
}

.auth-actions button {
    width: 100%;
    height: 42px;
    border-radius: 999px;
    font-weight: 550;
}

.auth-dialog .auth-submit {
    position: relative;
    overflow: hidden;
}

.auth-submit-label {
    display: inline-block;
    transition:
        opacity 280ms ease,
        transform 280ms ease,
        letter-spacing 280ms ease,
        filter 280ms ease;
}

.auth-submit-check {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    opacity: 0;
    transform: scale(0.55);
    pointer-events: none;
    transition:
        opacity 280ms ease 80ms,
        transform 320ms cubic-bezier(0.2, 0.9, 0.2, 1.15) 80ms;
}

.auth-dialog .auth-submit.is-success .auth-submit-label {
    opacity: 0;
    letter-spacing: -0.18em;
    transform: scaleX(0.55);
    filter: blur(1px);
}

.auth-dialog .auth-submit.is-success .auth-submit-check {
    opacity: 1;
    transform: scale(1);
}

.auth-dialog .auth-submit:disabled {
    opacity: 1;
    color: #fff;
    background: var(--blue);
    cursor: default;
}

.auth-dialog .auth-cancel {
    color: var(--ink-2);
    background: rgba(28, 36, 48, 0.05);
}

.auth-dialog .auth-cancel:hover {
    color: var(--ink);
    background: rgba(28, 36, 48, 0.09);
}

.auth-dialog .auth-cancel:disabled {
    opacity: 0.55;
    cursor: default;
}

.auth-footnote {
    margin: 14px 0 0;
    text-align: center;
    color: var(--ink-3);
    font-size: 0.78rem;
    line-height: 1.45;
}

.auth-footnote a {
    color: var(--blue);
    text-decoration: none;
    font-weight: 500;
}

.auth-footnote a:hover {
    text-decoration: underline;
}

.auth-dialog .auth-signout {
    background: rgba(28, 36, 48, 0.06);
    color: var(--ink);
}

.auth-dialog .auth-signout:hover {
    background: rgba(28, 36, 48, 0.1);
    color: var(--ink);
}

/* First-run card — anchored inside .main-panel so it tracks the sidebar for free */
.launch-card {
    position: absolute;
    z-index: 9;
    bottom: 18px;
    left: 18px;
    width: 340px;
    max-width: calc(100% - 36px);
    padding: 16px 17px 13px;
    border: 1px solid var(--line-strong);
    border-radius: 16px;
    background: #fff;
    /* Negative spread pulls the shadow off the sides so it only falls below */
    box-shadow: 0 14px 30px -12px rgba(28, 36, 48, 0.22);
    animation: launch-in 460ms cubic-bezier(0.34, 1.3, 0.64, 1) both;
}

.launch-card[hidden] {
    display: none !important;
}

@keyframes launch-in {
    from { opacity: 0; transform: translateY(16px) scale(0.97); }
    to { opacity: 1; transform: none; }
}

.launch-eyebrow {
    margin: 0 0 7px;
    color: var(--blue);
    font-size: 0.64rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.launch-step {
    animation: launch-step-in 180ms ease both;
}

@keyframes launch-step-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.launch-step h2 {
    margin: 0 0 6px;
    padding-right: 22px;
    font-size: 1rem;
    font-weight: 650;
    line-height: 1.3;
    letter-spacing: -0.025em;
    text-wrap: balance;
}

.launch-step > p {
    margin: 0;
    color: var(--ink-2);
    font-size: 0.8125rem;
    line-height: 1.5;
    letter-spacing: -0.01em;
    text-wrap: pretty;
}

.launch-note {
    margin: 10px 0 0 !important;
    padding-top: 9px;
    border-top: 1px solid var(--line);
    color: var(--ink-3) !important;
    font-size: 0.74rem !important;
}

.launch-dismiss {
    position: absolute;
    /* Above the step's compositing layer, which the crossfade animation creates */
    z-index: 1;
    top: 10px;
    right: 10px;
    display: grid;
    width: 24px;
    height: 24px;
    padding: 0;
    place-items: center;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--ink-4);
    cursor: pointer;
    transition: color 140ms ease, background 140ms ease;
}

.launch-dismiss:hover {
    color: var(--ink);
    background: rgba(28, 36, 48, 0.06);
}

.launch-dismiss svg {
    width: 14px;
    height: 14px;
}

/* Step art, built from real product chrome rather than stock illustration */
.launch-art {
    display: flex;
    gap: 5px;
    margin-top: 12px;
}

.launch-art--modes span,
.launch-art--actions span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 9px;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    color: var(--ink-3);
    font-size: 0.7rem;
    font-weight: 500;
    white-space: nowrap;
}

.launch-art--modes span.is-on {
    border-color: rgba(0, 85, 255, 0.22);
    background: rgba(0, 85, 255, 0.07);
    color: var(--blue);
}

.launch-art--actions span {
    border-radius: 9px;
    background: var(--cream-deep);
}

.launch-art--actions svg {
    width: 13px;
    height: 13px;
    color: var(--ink-4);
}

.launch-art--voice {
    flex-direction: column;
    gap: 7px;
}

.launch-voice {
    margin: 0;
    padding: 8px 10px;
    border-radius: 10px;
    font-size: 0.74rem;
    line-height: 1.4;
}

.launch-voice span {
    display: block;
    margin-bottom: 2px;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.launch-voice--generic {
    background: var(--cream-deep);
    color: var(--ink-4);
}

.launch-voice--generic span {
    color: var(--ink-4);
}

.launch-voice--you {
    background: rgba(0, 85, 255, 0.06);
    color: var(--ink-2);
}

.launch-voice--you span {
    color: var(--blue);
}

.launch-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 15px;
}

.launch-dots {
    display: flex;
    gap: 5px;
}

.launch-dot {
    width: 6px;
    height: 6px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(28, 36, 48, 0.16);
    cursor: pointer;
    transition: background 160ms ease, width 220ms var(--ease);
}

.launch-dot.is-active {
    width: 15px;
    border-radius: 999px;
    background: var(--blue);
}

.launch-next {
    height: 34px;
    padding: 0 14px;
    border: 0;
    border-radius: 10px;
    background: var(--blue);
    color: #fff;
    font: inherit;
    font-size: 0.8rem;
    font-weight: 550;
    cursor: pointer;
    transition: background 140ms ease;
}

.launch-next:hover {
    background: var(--blue-deep);
}

/* The composer owns the bottom of the screen on phones, so dock it full width */
@media (max-width: 640px) {
    .launch-card {
        right: 12px;
        bottom: 12px;
        left: 12px;
        width: auto;
        max-width: none;
    }
}

@media (hover: none) {
    .rail-avatar:hover,
    .send-btn:hover:not(:disabled) {
        transform: none;
    }

    [data-tooltip]::after {
        display: none;
    }
}

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

    .glow,
    .thinking-label,
    .thinking-label::after {
        animation: none !important;
    }

    .thinking-label {
        color: var(--ink-3);
        background: none;
        -webkit-background-clip: unset;
        background-clip: unset;
    }

    .thinking-label::after {
        display: none;
    }
}
