/* The composer is a single surface, with its tools inside the input bar. */
#workspace #chatPanel > .composer-wrap {
    position: relative;
    flex: 0 0 auto;
    padding: 12px 16px max(12px, env(safe-area-inset-bottom, 0px));
    border: 0;
    background: var(--surface);
}

#workspace #conversation { padding-bottom: 24px; }

#workspace #chatComposer {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    grid-template-rows: auto auto;
    align-items: end;
    gap: 4px 8px;
    width: min(100%, 760px);
    padding: 12px 10px 8px;
    border: 1px solid var(--border);
    border-radius: 24px;
    background: var(--surface-soft);
    box-shadow: none;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
}

#workspace #chatComposer:focus-within {
    border-color: var(--border);
}

#workspace #chatComposer .math-editor:focus { outline: none; box-shadow: none; }

#workspace #chatComposer .composer-input-wrap {
    grid-column: 1 / -1;
    grid-row: 1;
    padding: 0 6px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

#workspace #chatComposer .math-editor {
    min-height: 36px;
    max-height: min(144px, calc(var(--chat-viewport-height, 100dvh) * .24));
    padding: 4px 0 8px;
    font-size: 16px;
    line-height: 24px;
    background: transparent;
}

#workspace #chatComposer.is-expanded .math-editor {
    height: auto;
    max-height: min(320px, calc(var(--chat-viewport-height, 100dvh) * .4));
}

#workspace #chatComposer.is-expanded { height: auto; min-height: 0; }
#workspace #chatComposer.is-expanded .composer-input-wrap { height: auto; }
#workspace #chatComposer.can-expand .math-editor { padding-right: 36px; }
#workspace #chatComposer .composer-expand-button { top: 0; right: 0; width: 36px; height: 36px; border-radius: 8px; }

#workspace #chatComposer .composer-tool-button {
    position: static;
    grid-column: 1;
    grid-row: 2;
    width: 44px;
    height: 44px;
    margin: 0;
    padding: 11px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--muted);
}

#workspace #chatComposer .send-button {
    position: static;
    display: grid;
    place-items: center;
    grid-column: 3;
    grid-row: 2;
    width: 44px;
    height: 44px;
    margin: 0;
    padding: 12px;
    border: 0;
    border-radius: 50%;
    background: var(--text) !important;
    color: var(--surface);
    clip-path: none;
    filter: none;
}

#workspace #chatComposer .send-button .icon {
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    transform: none;
}

#workspace #chatComposer :is(.send-button, .composer-tool-button):hover:not(:disabled) {
    opacity: .75;
}

#workspace #chatComposer :is(.send-button, .composer-tool-button):focus-visible {
    outline: 2px solid var(--muted);
    outline-offset: 2px;
}

#statusLine { display: none !important; }

@media (max-width: 759px) {
    html[data-app-starting], html[data-app-starting] body,
    html:has(#workspace.chat-only:not([hidden])),
    html:has(#workspace.chat-only:not([hidden])) body {
        height: 100%;
        overflow: hidden;
        overscroll-behavior: none;
    }

    /* visualViewport includes the space lost to the iOS keyboard and browser chrome. */
    body.mobile-dashboard-active:has(#workspace.chat-only:not([hidden])) .app-shell {
        position: fixed;
        top: 0;
        transform: translateY(calc(var(--chat-viewport-top, 0px) / 1.05));
        left: 0;
        /* body is zoomed 1.05, so divide to land exactly on the visible viewport */
        height: calc(var(--chat-viewport-height, 100dvh) / 1.05) !important;
        min-height: 0 !important;
        overflow: hidden;
    }

    body.mobile-dashboard-active:has(#workspace.chat-only:not([hidden])) .app-shell .main {
        height: 100% !important;
        min-height: 0 !important;
    }

    /* Safari's bottom bar / home indicator sits over the page (viewport-fit=cover): lift the input above it. */
    body.mobile-dashboard-active #workspace.chat-only .composer-wrap {
        padding-bottom: max(10px, env(safe-area-inset-bottom, 0px));
    }

    body.mobile-dashboard-active .main > #workspace.chat-only:not([hidden]) {
        display: flex !important;
        flex-direction: column;
        overflow: hidden;
    }

    body.mobile-dashboard-active #workspace.chat-only > #chatPanel {
        flex: 1 1 0;
        width: 100%;
        min-height: 0;
        overflow: hidden;
    }

    #workspace.chat-only #conversation {
        padding: 20px 14px 24px;
        overscroll-behavior-y: contain;
        scroll-padding-block: 20px;
        -webkit-overflow-scrolling: touch;
    }

    #workspace.chat-only .conversation-inner { gap: 24px; }
    #workspace.chat-only .message-row { gap: 10px; min-width: 0; }
    #workspace.chat-only .message-content { min-width: 0; overflow-wrap: anywhere; }
    #workspace.chat-only #chatPanel > .composer-wrap { padding: 8px 12px max(10px, env(safe-area-inset-bottom, 0px)); }
    #workspace.chat-only #chatComposer .math-palette { left: 0; max-width: 100%; }
}

/* Atlas chat composer: no outline or border on the box, and a softer placeholder that says "Message Atlas". */
#workspace.chat-only #chatComposer,
#workspace.chat-only #chatComposer:focus-within { border-color: transparent; outline: none; box-shadow: none; }
#workspace.chat-only #chatComposer .math-editor:empty::before { color: #a8aeb7; font-family: Inter, Arial, sans-serif; font-weight: 600; }

/* Quick chat starter questions: plain rows with a grey icon, medium-weight Inter text and a soft chevron. */
.chat-panel[data-chat-context="quick"] .prompt-cards { gap: 4px; }
.chat-panel[data-chat-context="quick"] .prompt-card { min-height: 44px; padding: 8px 12px; border-radius: 10px; text-align: left; }
.chat-panel[data-chat-context="quick"] .prompt-card:hover, .chat-panel[data-chat-context="quick"] .prompt-card:focus-visible { background: #f4f5f7; }
.chat-panel[data-chat-context="quick"] .prompt-card__copy strong { display: block; margin: 0; color: #50565f; font: 500 15px/1.35 Inter, Arial, sans-serif; letter-spacing: 0; }
.chat-panel[data-chat-context="quick"] .prompt-card__icon { color: #9aa1ab; }
.chat-panel[data-chat-context="quick"] .prompt-card__chevron { color: #b9bec6; }
.chat-panel[data-chat-context="quick"] .prompt-card__icon--filled { display: block; width: 22px; height: 22px; object-fit: contain; }

/* Quick chat welcome: scale the mascot and spacing with the window height so a short window (or a high browser zoom) never needs scrolling. */
@media (max-height: 760px) {
    .chat-panel[data-chat-context="quick"] .welcome { gap: 8px; padding-top: clamp(6px, 3vh, 40px); padding-bottom: 6px; }
    .chat-panel[data-chat-context="quick"] .welcome-assistant-mark { width: clamp(52px, 12vh, 100px); height: clamp(52px, 12vh, 100px); margin-bottom: clamp(2px, 1vh, 10px); }
    .chat-panel[data-chat-context="quick"] .prompt-cards { margin-top: clamp(4px, 1.6vh, 16px); }
    .chat-panel[data-chat-context="quick"] .prompt-card { min-height: 36px; padding-top: 4px; padding-bottom: 4px; }
    .chat-panel[data-chat-context="quick"] .welcome-usage { min-height: 18px; margin-top: 0; }
}

/* Phones and narrow windows: centre the whole welcome (mascot, title, starter questions) in the space between the top bar and the message box. */
@media (max-width: 700px) {
    .chat-panel[data-chat-context="quick"] .welcome { align-content: center; padding-top: 8px; padding-bottom: 8px; }
}
@media (max-width: 700px) and (max-height: 640px) {
    .chat-panel[data-chat-context="quick"] .welcome { gap: 6px; padding-top: 4px; padding-bottom: 4px; }
}
