/*
 * SO AI Bot — chat transcript styling.
 *
 * grep marker: SO_AI v1
 *
 * SCOPE: deliberately limited to the chat transcript (message bubbles, the
 * welcome state, the result card shell), which has no SO component equivalent.
 * Everything else in the widget — buttons, table, pagination, alerts, spinner,
 * drawer, badges — uses stock SO classes and is NOT restyled here.
 *
 * All colours come from SO theme tokens so light/dark follow the app theme.
 * No hardcoded palette values.
 */

/* ---- Drawer layout: body scrolls, composer pinned ---------------------- */

#soAiDrawer .so-drawer-body {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    overflow-y: auto;
}/* Flex items shrink by default. In this scrolling column that squeezed every
   message and result card below its content once the transcript outgrew the
   panel: tables showed one row, charts were cut in half, and the card's
   overflow: hidden hid the rest (pager included). They keep their height;
   the body scrolls instead. */
#soAiDrawer .so-drawer-body > * {
    flex-shrink: 0;
}/* Composer: the textarea and the send button must be exactly the same height,
   or bottom-aligning them leaves a visible step. The bundle sizes
   .so-btn-icon.so-btn-sm at 32px while the textarea lands near 39px
   (8px padding x2 + 1.5 line-height + borders), so both are pinned to one
   shared value here instead of relying on those two numbers agreeing.

   flex-end, not center: as the textarea grows it should extend upward while
   the button stays put on the baseline. */
/* ---- Composer ---------------------------------------------------------
   Supplied entirely by SOComposer (see docs/agent/frontend/composer.md in
   so-framework). The ~130 lines that used to live here were a local
   reimplementation of it; the only thing still needed is the footer padding
   and the brand accent, handed to the component via its `accent` option.
   ---------------------------------------------------------------------- */

#soAiDrawer .so-ai-footer {
    display: block;
    padding: 12px 16px 16px;
}/* Hand the component the brand accent as a variable rather than via its
   `accent` option: the option writes an inline style, which cannot follow a
   theme switch, whereas this inherits --so-ai-accent and does. */
#soAiComposer {
    --so-composer-accent: var(--so-ai-accent);
}/* The quota text sits in the component's meta slot. */
.so-ai-quota-turn {
    color: var(--so-ai-accent);
    font-weight: 600;
}.so-ai-quota-bar {
    display: inline-block;
    width: 56px;
    height: 3px;
    border-radius: 2px;
    overflow: hidden;
    flex-shrink: 0;
}.so-ai-quota-bar .so-progress-bar {
    display: block;
    height: 100%;
}/* ---- Messages ---------------------------------------------------------- */

.so-ai-msg {
    display: flex;
    max-width: 100%;
}.so-ai-msg-user {
    justify-content: flex-end;
}.so-ai-msg-assistant,
.so-ai-msg-error {
    justify-content: flex-start;
}.so-ai-bubble {
    padding: 0.5rem 0.75rem;
    border-radius: 0.75rem;
    max-width: 85%;
    /* Matches the chat titles in the sidebar, so the panel reads at one size
       throughout rather than shifting between its surfaces. */
    font-size: 13px;
    line-height: 1.5;
    word-wrap: break-word;
    overflow-wrap: anywhere;
}.so-ai-msg-user .so-ai-bubble {
    background: var(--so-primary-bg-subtle);
    color: var(--so-primary-text-emphasis);
    border-bottom-right-radius: 0.25rem;
}.so-ai-msg-assistant .so-ai-bubble {
    background: var(--so-bg-secondary);
    color: var(--so-text-primary);
    border-bottom-left-radius: 0.25rem;
}.so-ai-msg-error .so-ai-bubble {
    background: var(--so-danger-bg-subtle, var(--so-bg-secondary));
    color: var(--so-danger-text-emphasis, var(--so-text-primary));
    border-bottom-left-radius: 0.25rem;
}/* ---- Typing indicator --------------------------------------------------
   Three dots drifting in sequence, in place of a spinner and a caption. It
   deliberately does not sit in a message bubble: the assistant has not said
   anything yet, and a bubble reads as though it had.
   ---------------------------------------------------------------------- */

/* ---- SO_AI_PROGRESS v1: the live status line ------------------------
   One line of text with a light travelling through the words. The words come
   from the server and are real steps - see SOAiProgress.

   The sweep is a gradient clipped to the glyphs, animated by moving its
   background. That is why this needs real CSS rather than a component: there
   is no so- utility for text-clipped animation.

   Tokens are defined on :root and redefined for dark, per the house rule, so
   the line reads on both themes without a second selector in every rule.
   -------------------------------------------------------------------- */

:root {
    --so-ai-work-base: #64748b;
    --so-ai-work-lit: #0f172a;
    --so-ai-work-meta: #94a3b8;
}

:root[data-theme="dark"] {
    --so-ai-work-base: #64748b;
    --so-ai-work-lit: #e2e8f0;
    --so-ai-work-meta: #64748b;
}

.so-ai-working {
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
    padding: 0.5rem 0.25rem;
    font-size: 0.875rem;
    line-height: 1.4;
}

.so-ai-working-text {
    /* The gradient is three times the width of the text box and slides across
       it, so the highlight reads as one pass rather than a pulse. */
    background: linear-gradient(
        90deg,
        var(--so-ai-work-base) 0%,
        var(--so-ai-work-base) 35%,
        var(--so-ai-work-lit) 50%,
        var(--so-ai-work-base) 65%,
        var(--so-ai-work-base) 100%
    );
    background-size: 300% 100%;
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
    animation: so-ai-work-sweep 2s linear infinite;
    transition: opacity 0.15s ease;
    font-weight: 500;
}

/* The 150ms cross-fade when the step changes. The sweep keeps running
   underneath it, so four tool calls read as one continuous line. */
.so-ai-working-text.so-ai-working-swap {
    opacity: 0.35;
}

@keyframes so-ai-work-sweep {
    0%   { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}

/* The elapsed clock sits OUTSIDE the sweep: a moving highlight over a number
   that is also changing is unreadable. */
.so-ai-working-meta {
    color: var(--so-ai-work-meta);
    font-size: 0.8125rem;
}

/* A stated preference for less motion: the travel goes, a gentle pulse stays,
   so the line still reads as busy. The text has to get its colour back, since
   the sweep was the only thing painting it. */
@media (prefers-reduced-motion: reduce) {
    .so-ai-working-text {
        animation: so-ai-work-fade 1.6s ease-in-out infinite;
        background: none;
        -webkit-text-fill-color: var(--so-ai-work-base);
        color: var(--so-ai-work-base);
    }
    @keyframes so-ai-work-fade {
        0%, 100% { opacity: 0.45; }
        50%      { opacity: 1; }
    }
}

/* ---- SO_AI_FALLBACK v1: a general answer ---------------------------
   Deliberately NOT styled like a reply. A tinted block with its own heading,
   because the one risk worth designing against is somebody reading a
   general-knowledge sentence as a figure out of their own system.
   -------------------------------------------------------------------- */

.so-ai-fallback {
    border-radius: 0.5rem;
    padding: 0.625rem 0.75rem;
    background: var(--so-bg-subtle, rgba(100, 116, 139, 0.08));
}

.so-ai-fallback-head {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--so-ai-work-meta);
    margin-bottom: 0.35rem;
}

.so-ai-fallback-body {
    font-size: 0.875rem;
    line-height: 1.5;
}

/* ---- SO_AI_SKILL v1: requests ------------------------------------- */

/* SO_AI_SKILL v2: the offer card.
 *
 * Replaces .so-ai-skill-note, which said "I have asked for this to be added"
 * after the request had already gone. This asks first.
 *
 * Same surface as .so-ai-skill-ready on purpose - the two are the bookends of
 * one story ("shall I?" ... "here it is") and should read as the same object.
 *
 * EVERY framework-class override below carries #soAiDrawer. sixorbit-ui.css is
 * added AFTER this file (Theme.php:260 vs :204), so an equal-specificity rule
 * here loses on source order and silently does nothing. That has cost an
 * afternoon twice.
 */
.so-ai-skill-offer {
    border-radius: 0.5rem;
    padding: 0.75rem;
    background: var(--so-bg-subtle, rgba(100, 116, 139, 0.08));
}

.so-ai-skill-offer-head {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    margin-bottom: 0.3rem;
}

/* The question, quoted back. break-word, NOT anywhere: `anywhere` counts in
   intrinsic sizing, which makes min-content one character wide and stacks the
   whole question into a vertical column of letters inside a flex parent. */
.so-ai-skill-offer-q {
    font-size: 0.875rem;
    font-style: italic;
    margin: 0 0 0.6rem;
    overflow-wrap: break-word;
}

#soAiDrawer .so-ai-skill-offer textarea.so-form-control {
    width: 100%;
    margin-top: 0.2rem;
    resize: vertical;
}

.so-ai-skill-offer-act {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin-top: 0.6rem;
}

/* What happened, once they have answered. Replaces nothing - it is appended
   under the disabled buttons, so the card still shows what was asked and what
   they said to it. */
.so-ai-skill-offer-done {
    font-size: 0.8125rem;
    margin: 0.6rem 0 0;
    color: var(--so-ai-work-meta);
}

.so-ai-skill-ready {
    border-radius: 0.5rem;
    padding: 0.75rem;
    background: var(--so-bg-subtle, rgba(100, 116, 139, 0.08));
}

.so-ai-skill-ready-head {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    margin-bottom: 0.3rem;
}

.so-ai-skill-ready-title {
    font-size: 0.875rem;
    margin: 0 0 0.5rem;
}

.so-ai-skill-ready-ask {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
    font-size: 0.8125rem;
}

/* SO_AI_SKILL v2: Requests is a sub-view of the Assistant, not a tab.
 *
 * The head is a page header: the way back - without it the panel is a dead
 * end, because the tab bar no longer has an entry to return from - and then
 * what the view is, because the drawer header above says "SixOrbit AI", which
 * is true of every view in the panel.
 *
 * The drawer body's own 12px is already above this, so the strip adds nothing
 * at the top; and it adds nothing at the SIDES either, because the list below
 * is a .so-list-group sitting directly in that same body. Padding here would
 * push the button's box further in than the cards and the column would read
 * as two different left edges.
 */
#soAiDrawer #soAiSkillsBody {
    padding-top: 0.5rem;
}

.so-ai-skills-head {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0 0 0.5rem;
    margin-bottom: 0.25rem;
    border-bottom: 1px solid var(--so-border-color);
}

/* Beside the arrow, not under it: the drawer header is already two rows tall
   and a third full-width line for three words would push the first card off
   the fold on a laptop. h6 for the outline, sized here - the framework's
   heading scale is for pages, and this is a strip inside a drawer. */
.so-ai-skills-head .so-ai-skills-title {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--so-text-heading);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* The lit state of the header's Requests icon while its list is open. Scoped
   to #soAiDrawer because it overrides so-btn-ghost, and sixorbit-ui.css is
   added AFTER this file (Theme.php:260 vs :204) - an equal-specificity rule
   here would lose on source order and do nothing at all. */
#soAiDrawer .so-ai-skill-entry.so-ai-skill-entry-on {
    background: var(--so-primary-bg-emphasis, rgba(37, 99, 235, 0.12));
    color: var(--so-accent-primary, #2563eb);
}

/* The badge rides on this icon as well as the navbar launcher: once the
   drawer is open the launcher is behind it, so the count would vanish at the
   moment it is telling somebody where to look. */
#soAiDrawer .so-ai-skill-entry {
    position: relative;
}

.so-ai-skills-list {
    padding: 0.75rem;
}

/* Each row is a question, a meta line and a four-step stepper, so it needs
   real vertical room - the list-group default (12px/16px) is sized for one
   line of text and left the stepper crammed against the row below. */
#soAiDrawer .so-ai-skill-row.so-list-group-item {
    padding: 0.75rem;
}

/* BLOCK, not the list group's flex row.
   A list-group-item is a flex row because its usual job is text + a control
   on one line. These rows are three stacked blocks and no longer have the
   status dot that needed a row, and as a flex item the content box collapsed
   to its min-content width, so the question wrapped a letter per line and the
   stepper spilled out of a 20px box with its labels overlapping.

   SCOPED TO #soAiDrawer, and that is not decoration. sixorbit-ui.css is
   added AFTER so-ai.css (themes/default/Theme.php:260 vs :204), so
   `.so-list-group-item { display: flex }` and a bare `.so-ai-skill-row`
   rule have the SAME specificity and the framework wins on source order.
   Every override of a framework class in this file needs the id, or it
   silently does nothing. */
#soAiDrawer .so-ai-skill-row.so-list-group-item {
    display: block;
}

.so-ai-skill-row-title {
    font-size: 0.875rem;
    line-height: 1.4;
    margin: 0;
    color: var(--so-text-primary);
    /* break-word, NOT anywhere. Both break a long unbroken string, but
       `anywhere` also counts in intrinsic sizing, so it reports a min-content
       width of one character and any shrink-to-fit ancestor believes it.
       `break-word` breaks the same strings and keeps the real min-content. */
    overflow-wrap: break-word;
}

.so-ai-skill-meta {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin: 0.15rem 0 0;
    font-size: 0.75rem;
    color: var(--so-ai-work-meta);
}

/* The status WORD stays muted like the date beside it. The colour is carried
   by the dot; colouring both says the same thing twice and turns a quiet meta
   line into something that competes with the question above it. */
.so-ai-skill-state { font-weight: 500; }

/* The date never wraps: it is three short tokens and breaking it was the
   single ugliest thing on this panel. */
.so-ai-skill-when,
.so-ai-skill-sep {
    white-space: nowrap;
}

/* The category chip. The badge supplies its colour, radius and padding; only
   the scale is set here, because so-badge is sized for a grid cell and this
   sits in a 0.75rem meta line. #soAiDrawer because a bare class would tie
   with so-badge in sixorbit-ui.css, which loads afterwards and wins. */
#soAiDrawer .so-ai-skill-cat {
    font-size: 0.625rem;
    /* A touch more weight than the badge default: at this size a solid chip
       with light text needs it to stay legible. */
    font-weight: 600;
    letter-spacing: 0.01em;
    padding: 0.1rem 0.5rem;
    white-space: nowrap;
    /* Nudged off the baseline of the text it follows, which is a shade
       taller. */
    margin-left: 0.15rem;
}

/* The meta line is three items now, so it may need a second line in a narrow
   drawer rather than pushing the row wider. */
.so-ai-skill-meta {
    flex-wrap: wrap;
}

.so-ai-skill-row-reason {
    font-size: 0.75rem;
    color: var(--so-ai-work-meta);
    margin: 0.25rem 0 0;
}

.so-ai-skill-row .so-ai-skill-try,
.so-ai-skill-row .so-ai-offer-open {
    margin-top: 0.5rem;
}

/* SO_AI_SKILL v4 - the strip labels. The view carries two lists that mean
   different things - offers nobody has answered, and requests that are on
   their way - and a label is a cheaper way to say which is which than a card
   header around each. */
.so-ai-skills-section {
    margin: 0.75rem 0 0.375rem;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--so-text-secondary);
}

.so-ai-skills-section:first-child {
    margin-top: 0;
}

/* The stepper, sized for a drawer.
   so-stepper-sm is still built for a page: 28px icons and sm titles across
   four steps overflow the panel once the row's own padding is taken off it.
   Only the measurements that do not fit are overridden - the states, the
   connectors and the palette are the component's.

   EVERY RULE BELOW CARRIES #soAiDrawer. Without it each one ties with its
   so-stepper-sm counterpart in sixorbit-ui.css, which is loaded afterwards
   and therefore wins - so the sizing silently did nothing and the stepper
   rendered at page scale inside a drawer. */
.so-ai-skill-steps {
    margin-top: 0.6rem;
}

#soAiDrawer .so-ai-skill-steps .so-step-icon {
    width: 20px;
    height: 20px;
    border-width: 1px;
    font-size: 0.625rem;
}

#soAiDrawer .so-ai-skill-steps .so-step-icon .material-symbols-rounded {
    font-size: 13px;
}

#soAiDrawer .so-ai-skill-steps .so-step-content {
    margin-top: 0.25rem;
}

/* Each step gets an equal share and may shrink. Without min-width:0 a step
   is never smaller than its label, so four nowrap labels set a floor the
   drawer cannot meet and the stepper overflows instead of compressing. */
#soAiDrawer .so-ai-skill-steps .so-step {
    min-width: 0;
}

#soAiDrawer .so-ai-skill-steps .so-step-title {
    font-size: 0.6875rem;
    line-height: 1.2;
    /* Clipped with an ellipsis rather than allowed to run into the label
       beside it: four labels reading as one word was the whole problem. */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    padding: 0 2px;
}

/* The connector is positioned against the 28px icon the component expects;
   a 20px one leaves it floating above the row and starting too far out. */
#soAiDrawer .so-ai-skill-steps.so-stepper-horizontal .so-step:not(:last-child)::after {
    top: 10px;
    left: calc(50% + 14px);
    width: calc(100% - 28px);
}

.so-ai-skills-empty-icon {
    font-size: 1.75rem;
    color: var(--so-ai-work-meta);
    margin-bottom: 0.5rem;
    display: block;
}

.so-ai-typing {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 0.5rem 0.25rem;
}.so-ai-typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--so-ai-accent);
    opacity: 0.35;
    animation: so-ai-typing-wave 1.2s ease-in-out infinite;
}.so-ai-typing span:nth-child(2) { animation-delay: 0.15s; }.so-ai-typing span:nth-child(3) { animation-delay: 0.3s; }@keyframes so-ai-typing-wave {
    0%, 60%, 100% { opacity: 0.35; transform: translateY(0); }
    30%           { opacity: 1;    transform: translateY(-4px); }
}/* Respect a stated preference for less motion: keep the pulse, drop the
   travel, so the indicator still reads as "busy". */
@media (prefers-reduced-motion: reduce) {
    .so-ai-typing span {
        animation: so-ai-typing-fade 1.4s ease-in-out infinite;
    }
    @keyframes so-ai-typing-fade {
        0%, 100% { opacity: 0.3; }
        50%      { opacity: 0.9; }
    }
}/* ---- Message actions --------------------------------------------------
   Copy and share sit under the reply, muted until the message is hovered or a
   button is focused — present when wanted, not competing with the answer.
   Kept visible on touch, where there is no hover to reveal them with.
   ---------------------------------------------------------------------- */

/* Always visible, not revealed on hover: copy is the action people reach for
   most, hiding it makes it undiscoverable, and on touch there is no hover to
   reveal it with. Muted instead, so it sits under the answer without competing
   with it. */
.so-ai-msg-actions {
    display: flex;
    align-items: center;
    gap: 0.15rem;
    margin-top: 0.15rem;
    opacity: 0.6;
    transition: opacity 0.12s ease;
}.so-ai-msg:hover .so-ai-msg-actions,
.so-ai-msg-actions:focus-within {
    opacity: 1;
}/* Rating sits apart from copy/share: those act on the text, these say
   something about it. */
.so-ai-msg-rate {
    display: inline-flex;
    gap: 0.15rem;
    margin-left: 0.35rem;
    padding-left: 0.35rem;
    border-left: 1px solid var(--so-border-color);
}/* .so-btn is repeated here on purpose. The generic
   `.so-ai-msg-actions .so-btn { color: var(--so-text-muted) }` below has the
   SAME specificity (0,2,0) as a plain `.so-ai-rated`, and it comes later in
   the file - so source order won and a rated thumb snapped straight back to
   muted grey. The class was applied, the colour never showed, and clicking
   helpful looked like it had done nothing. `.so-btn.so-ai-rated` is (0,3,0)
   and wins wherever it sits. */
.so-ai-msg-actions .so-btn.so-ai-rated {
    color: var(--so-ai-accent);
    opacity: 1;
}
/* A chosen thumb is FILLED, not just tinted. Material Symbols is a variable
   font and FILL is one of its axes, so this is the SAME glyph solid rather
   than a second icon name - which is how the framework's own rating marks a
   selected star (_rating.scss). Colour alone was doing all the work, and an
   outline in an accent colour reads as "hovered", not "chosen". */
.so-ai-msg-actions .so-btn.so-ai-rated .material-symbols-rounded {
    font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 24;
}.so-ai-msg-assistant {
    flex-direction: column;
    align-items: flex-start;
}@media (hover: none) {
    .so-ai-msg-actions { opacity: 1; }
}.so-ai-msg-actions .so-btn {
    width: 26px;
    height: 26px;
    color: var(--so-text-muted);
}/* ---- Empty state ------------------------------------------------------- */

.so-ai-welcome {
    text-align: center;
    padding: 2rem 1rem;
    margin: auto 0;
}/* Explicit sizes rather than inheriting: this panel is read on its own, and
   the surrounding page's body size leaves the heading no larger than the copy
   under it. */
.so-ai-welcome-title {
    margin: 0 0 0.35rem;
    font-size: 15px;
    font-weight: 600;
    color: var(--so-text-heading);
}.so-ai-welcome-sub {
    margin: 0 0 1rem;
    font-size: 13px;
    line-height: 1.5;
    color: var(--so-text-muted);
}.so-ai-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
}/* ---- Result card ------------------------------------------------------- */

.so-ai-result {
    border: 1px solid var(--so-border-color);
    border-radius: 0.5rem;
    padding: 0.5rem;
    overflow: hidden;
}

/* SO_BI v1 - the widget preview is the one result card that must NOT clip.
   It carries a dashboard chooser, and SOSelect opens its panel inside the card
   rather than portalling it to <body> (SOModal portals; SOSelect does not), so
   overflow: hidden cuts the options off at the card's edge.

   Scoped to the preview rather than lifted from .so-ai-result, because the
   clipping is wanted everywhere else: a wide table or a chart in a result card
   is meant to be contained by it. */
.so-ai-result-bi {
    overflow: visible;
}

/* ---- The widget preview's colour row ---------------------------------------
 * Mirrors the dashboard's own design panel (.so-bi-design-swatch in
 * so-bi.css), but lives here because the assistant opens on every page and
 * so-bi.css is only loaded on the BI page. Kept to the same size and the same
 * inside-the-circle tick, so choosing a colour here and changing it later on
 * the board are visibly the same control.
 *
 * It wraps: thirty-three swatches do not fit a chat panel's width, and a row
 * that scrolls sideways hides colours behind an edge nobody thinks to drag.
 * -------------------------------------------------------------------------- */
.so-ai-bi-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
}

.so-ai-bi-swatch {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 50%;
    cursor: pointer;
    /* The swatch IS the colour. The variable comes from the catalogue the
       server publishes, so a colour added there appears here with no CSS. */
    background: var(--so-ai-bi-swatch, var(--so-accent-primary));
}

/* The tick sits inside the circle and only on the chosen one, so the row never
   shifts and selection does not read as focus. */
.so-ai-bi-swatch .material-symbols-rounded {
    font-size: 16px;
    line-height: 1;
    color: #fff;
    opacity: 0;
}

.so-ai-bi-swatch.is-on .material-symbols-rounded {
    opacity: 1;
}

.so-ai-bi-swatch:focus-visible {
    outline: 2px solid var(--so-accent-primary);
    outline-offset: 2px;
}.so-ai-result-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}.so-ai-result-meta {
    font-size: var(--so-text-xs, 0.75rem);
    color: var(--so-text-muted);
}/* Wide results scroll inside the card rather than stretching the drawer. */
.so-ai-result .so-table-responsive {
    overflow-x: auto;
}/* The framework gives .so-table a 16px bottom margin for page layouts; inside
   the card it showed as an empty strip under the last row. */
.so-ai-result .so-table {
    margin-bottom: 0;
}.so-ai-chart {
    width: 100%;
    min-height: 260px;
}/* The empty state deliberately carries NO background mark: at watermark
   opacity the logo read as a smudge behind the copy, and at a legible opacity
   it competed with it. The sparkle in the halo carries the identity instead. */

/* ---- Token quota strip ------------------------------------------------- */

/* One quiet line under the composer rather than a banner above it: the
   allowance is reference information, not something to look at every turn. */
.so-ai-quota {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.4rem;
    padding: 0 0.25rem;
    font-size: var(--so-text-xs, 0.75rem);
    color: var(--so-text-muted);
    min-height: 1rem;
}.so-ai-quota:empty {
    display: none;
}.so-ai-quota-turn {
    color: var(--so-ai-accent);
    font-weight: 600;
}.so-ai-quota-bar {
    display: inline-block;
    width: 64px;
    height: 3px;
    border-radius: 2px;
    overflow: hidden;
}.so-ai-quota-bar .so-progress-bar {
    display: block;
    height: 100%;
}/* ---- Layout ------------------------------------------------------------
   Narrow drawer: a column — header, conversation, composer — with the sidebar
   overlaying it when history is opened, because there is no room for two.

   Full screen: a ROW. The sidebar becomes a full-height column and the title
   bar belongs to the conversation beside it, rather than a strip across the
   top with everything hanging below.
   ---------------------------------------------------------------------- */

#soAiDrawer .so-ai-main {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-width: 0;       /* without this a wide table forces the column open */
    min-height: 0;      /* lets the body scroll instead of stretching */
}.so-ai-sidebar {
    display: none;
    overflow-y: auto;
    padding: 0.75rem;
}/* Narrow: overlay the conversation. */
#soAiDrawer.so-ai-history-open .so-ai-sidebar {
    display: block;
    position: absolute;
    inset: 0;
    z-index: 2;
    background: var(--so-card-bg, #fff);
    border-radius: 12px;    /* follows the floating drawer it covers */
}/* Full screen: a real column, top to bottom, beside everything else. */
#soAiDrawer.so-drawer-expanded {
    flex-direction: row;
}#soAiDrawer.so-drawer-expanded .so-ai-sidebar {
    display: block;
    position: static;
    inset: auto;
    z-index: auto;
    flex: 0 0 300px;
    max-width: 300px;
    border-right: 1px solid var(--so-border-color);
    background: var(--so-bg-secondary, transparent);
    border-top-left-radius: 12px;      /* the floating drawer is rounded and the */
    border-bottom-left-radius: 12px;   /* sidebar paints its own ground over it  */
}/* The conversation reads better at a measure than stretched across a 27-inch
   monitor, so it is capped and centred rather than filling the width. */
#soAiDrawer.so-drawer-expanded .so-drawer-body,
#soAiDrawer.so-drawer-expanded .so-ai-footer {
    max-width: 900px;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
}/* ---- Empty state: placement --------------------------------------------
   With nothing said yet, the welcome and composer sit in the vertical middle:
   on a wide screen a bottom-pinned composer is far from the eye with a blank
   expanse above it. The body stops flexing so the pair can centre as a group;
   once there is a transcript the body takes the space again and the composer
   returns to the bottom, under what it answered.
   ---------------------------------------------------------------------- */

/* Scoped to #soAiBody, not .so-drawer-body: the Manager tab has a body of its
   own, and an empty chat would otherwise centre that one too, leaving its
   content sitting at the bottom of the panel.

   Auto margins, not justify-content: the header is a sibling of the body and
   would be dragged into the middle with them. These split the free space above
   the body and below the footer, so the pair centres and the title bar stays
   pinned to the top where it belongs. */
#soAiDrawer.so-ai-empty #soAiBody {
    flex: 0 1 auto;
    min-height: 0;          /* may shrink below its content ...            */
    overflow-y: auto;       /* ... and then scrolls, rather than clipping   */
    margin-top: auto;
}/* Not on the Manager or Requests tabs: the chat being empty says nothing
   about either of them. These rules pair padding-bottom: 0 with
   margin-bottom: auto to centre the composer against #soAiBody - and on the
   other tabs that body is hidden, so the pair takes the footer's bottom
   padding away and gives nothing back, leaving the composer flush against
   the drawer's edge. */
#soAiDrawer.so-ai-empty:not(.so-ai-on-manager):not(.so-ai-on-skills) .so-ai-footer {
    margin-bottom: auto;
    border-top: 0;              /* nothing above it to divide from */
    padding-bottom: 0;
}/* Equal auto margins centre the BOXES, but the eye centres on the ink. The
   welcome's 2rem and the body's 12px sit inside the top box and the footer's
   16px inside the bottom one, so the group reads ~28px low. Zeroing the outer
   padding in this state makes the blank above the icon and the blank below the
   composer identical. The footer keeps its padding-top: that gap is interior,
   between the welcome and the composer, and should stay. */
#soAiDrawer.so-ai-empty #soAiBody {
    padding-top: 0;
    padding-bottom: 0;
}#soAiDrawer.so-ai-empty .so-ai-welcome {
    padding-top: 0;
    padding-bottom: 0;
}/* With no composer (switched off, or not configured) the footer is hidden, so
   its margin-bottom: auto no longer balances the body's margin-top: auto and
   the content would sink to the bottom. The body carries both instead. */
#soAiDrawer.so-ai-empty.so-ai-no-composer #soAiBody {
    margin-bottom: auto;
    /* The zeroed padding above is for optical centring against a composer.
       Without one the body is the whole panel and scrolls on a short screen,
       so it gets its breathing room back: equal top and bottom, which keeps
       the centring exact. */
    padding-top: 1.5rem;
    padding-bottom: 1.5rem;
}/* ---- Showcase: SixOrbit AI switched off ----------------------------------
   What this user would get, shown instead of a chat. Chips, not buttons:
   there is nothing to send them to.
   ---------------------------------------------------------------------- */

#soAiDrawer .so-ai-showcase > .so-badge {
    margin-bottom: 1.25rem;
}#soAiDrawer .so-ai-showcase-groups,
#soAiDrawer .so-ai-showcase-points,
#soAiDrawer .so-ai-showcase > .so-alert {
    max-width: 34rem;
    margin-left: auto;
    margin-right: auto;
    text-align: left;
}#soAiDrawer .so-ai-showcase-groups {
    display: grid;
    gap: 0.9rem;
    margin-bottom: 1.5rem;
}#soAiDrawer .so-ai-showcase-head {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0 0 0.45rem;
    font-size: 13px;
    font-weight: 600;
    color: var(--so-text-heading);
}#soAiDrawer .so-ai-showcase-head .material-symbols-rounded,
#soAiDrawer .so-ai-showcase-points .material-symbols-rounded {
    font-size: 18px;
    color: var(--so-ai-accent);
}#soAiDrawer .so-ai-showcase-asks {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}#soAiDrawer .so-ai-showcase-points {
    list-style: none;
    padding: 0;
    margin-top: 0;
    margin-bottom: 1.25rem;
    display: grid;
    gap: 0.65rem;
}#soAiDrawer .so-ai-showcase-points li {
    display: grid;
    grid-template-columns: 22px minmax(0, 1fr);
    gap: 0.6rem;
    font-size: 13px;
    line-height: 1.45;
    color: var(--so-text-muted);
}#soAiDrawer .so-ai-showcase-points strong {
    display: block;
    font-weight: 600;
    color: var(--so-text-heading);
}.so-ai-sidebar-label {
    letter-spacing: 0.04em;
}/* New chat stays put while the list scrolls under it. The negative margins
   bleed the row to the sidebar's edges so nothing scrolls past beside it, and
   `inherit` takes whichever background the sidebar has in this mode — a card
   in the narrow panel, a secondary surface in full screen. */
#soAiDrawer .so-ai-history-actions {
    position: sticky;
    top: -0.75rem;
    z-index: 3;
    margin: -0.75rem -0.75rem 0.75rem;
    padding: 0.75rem;
    background: inherit;
}/* The list's action row. In the narrow drawer the list overlays the whole
   panel, header included, so its own buttons are the only way out: Back to
   chat on the left, New chat and New group on the right. In full screen the
   conversation sits beside the list, so Back has nowhere to go back to, and
   New chat takes the row's width as it did before. flex-grow is set here
   rather than with so-flex-grow-1, which is !important and could not be
   switched off for the narrow drawer. */
#soAiDrawer.so-drawer-expanded #soAiSidebarBack {
    display: none;
}#soAiDrawer.so-drawer-expanded #soAiSidebarNew {
    flex-grow: 1;
}#soAiDrawer:not(.so-drawer-expanded) #soAiSidebarNew {
    margin-left: auto;
}.so-ai-group {
    margin-bottom: 0.9rem;
}/* A heading for the chats under it: a hairline ties the two together, and the
   group's own actions stay out of the way until the group is hovered. */
.so-ai-group-head {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin-bottom: 0.25rem;
    padding: 0.1rem 0.15rem 0.25rem;
    border-bottom: 1px solid var(--so-border-color);
    color: var(--so-text-heading);
}.so-ai-group-name {
    font-size: 13px;
    font-weight: 600;
}.so-ai-group-count {
    flex-shrink: 0;
    min-width: 20px;
    padding: 0 0.35rem;
    border-radius: 999px;
    background: var(--so-bg-secondary);
    color: var(--so-text-muted);
    font-size: 11px;
    line-height: 17px;
    text-align: center;
}/* The menu inside the heading must not inherit its weight — that is what made
   "Delete group" read as bold. */
.so-ai-group-head .so-dropdown-menu {
    font-weight: 400;
}.so-ai-group-head .so-ai-row-menu {
    opacity: 0;
    transition: opacity 0.12s ease;
}.so-ai-group:hover .so-ai-group-head .so-ai-row-menu,
.so-ai-group-head:focus-within .so-ai-row-menu {
    opacity: 1;
}@media (hover: none) {
    .so-ai-group-head .so-ai-row-menu { opacity: 1; }
}/* Colour comes from an SO background utility (so-bg-success etc.), so the
   group palette is theme tokens rather than stored hex values. */
.so-ai-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}.so-ai-dot-none {
    border: 1px dashed var(--so-border-color);
}.so-ai-chat-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}/* A shade tighter again than so-list-group-sm: these rows are one line of
   text with a menu button, and the sidebar's job is to show as many as fit. */
#soAiDrawer .so-ai-chat-row.so-list-group-item {
    /* The extra left padding is for the open-chat bar: every row carries it,
       so a title does not shift sideways when its chat is opened. */
    padding: 6px 10px 6px 17px;
}/* The conversation currently on screen. */
.so-ai-chat-current {
    position: relative;
    background: color-mix(in srgb, var(--so-ai-accent) 10%, transparent);
}/* A short rounded bar rather than a full-height edge: it marks the row it
   belongs to, instead of reading as a border drawn down the whole list. */
.so-ai-chat-current::before {
    content: "";
    position: absolute;
    /* Set in from the edge, not on it: flush against the row's border the bar
       reads as a stray line rather than a marker. */
    left: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    min-height: 14px;
    border-radius: 999px;
    background: var(--so-ai-accent);
}@supports not (background: color-mix(in srgb, red 10%, transparent)) {
    .so-ai-chat-current { background: var(--so-primary-bg-subtle); }
}/* A button, not a link: it opens a chat in place rather than navigating.
   One line — the message count that used to sit under the title doubled every
   row's height for a number nobody acts on. */
.so-ai-chat-open {
    display: block;
    width: 100%;
    background: none;
    border: 0;
    padding: 0.15rem 0;
    text-align: left;
    cursor: pointer;
    color: inherit;
    /* `font: inherit` first, to pick up the family and weight from the button
       reset, then the size on its own — a chat title inheriting the body's
       12px sat a notch smaller than everything around it. Declared after,
       because the `font` shorthand would otherwise reset size back. */
    font: inherit;
    font-size: 13px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}.so-ai-chat-open:hover {
    color: var(--so-primary-text-emphasis);
}/* The pin leans, the way a real one pushed into a board does — and it is a
   button, so pressing it takes the chat off the top of the list. */
.so-ai-pin-mark {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    padding: 0;
    border: 0;
    background: none;
    color: var(--so-ai-accent);
    cursor: pointer;
}.so-ai-pin-mark .material-symbols-rounded {
    font-size: 15px;
    transform: rotate(45deg);
}.so-ai-pin-mark:hover,
.so-ai-pin-mark:focus-visible {
    opacity: 0.7;
}/* Menu labels stay on one line. The framework's submenu item is a flex row
   with space-between and its own ::after chevron, so a label that wraps pushes
   the arrow onto a second line and the row reads as two entries. */
.so-ai-row-menu .so-dropdown-item {
    white-space: nowrap;
    text-align: left;
}/* Every label starts at the same x, whether its row leads with an icon or with
   the submenu chevron.

   Material Symbols are inline glyphs of differing widths — push_pin, edit and
   delete are not the same width as chevron_left — so with a plain flex gap the
   text lands a couple of pixels apart per row and "Move to group" reads as
   indented. Fixing the leading slot's width makes the column exact. */
#soAiDrawer .so-ai-row-menu .so-dropdown-item > .material-symbols-rounded:first-child {
    width: 18px;
    min-width: 18px;
    font-size: 18px;
    text-align: center;
    flex-shrink: 0;
}/* The row's action menu: a 28px trigger instead of the full-width select that
   used to sit here and dominate the row it was annotating. */
.so-ai-row-menu {
    flex-shrink: 0;
}.so-ai-menu-check {
    font-size: 16px;
    color: var(--so-ai-accent);
}/* The section header shares the items' leading-icon column, so its label lines
   up with the group names underneath rather than sitting a few pixels off. */
#soAiDrawer .so-ai-row-menu .so-ai-menu-section {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}#soAiDrawer .so-ai-row-menu .so-ai-menu-section .material-symbols-rounded {
    width: 18px;
    min-width: 18px;
    font-size: 16px;
    text-align: center;
    flex-shrink: 0;
}/* Dropdown items carry a colour dot, so they need to lay out as a row. */
.so-ai-row-menu .so-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}.so-ai-row-menu .so-dropdown-menu {
    min-width: 210px;
}/* The row menu scrolls rather than growing out of the sidebar, which is a
   scroll container and would clip it. */
#soAiDrawer .so-ai-row-menu > .so-dropdown-menu {
    max-height: 320px;
    overflow-y: auto;
}/* ---- Colour swatches (new-group modal) --------------------------------
   Bigger circles than a typical form control, because they ARE the control:
   there is no label beside them, so the colour has to carry the meaning.
   Selection is a tick inside the swatch rather than a ring around it — on a
   circle this size a ring reads as part of the colour and fights it.
   ---------------------------------------------------------------------- */

.so-ai-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}.so-ai-swatch {
    cursor: pointer;
    line-height: 0;
}/* The radio keeps its place in the accessibility tree and stays keyboard
   reachable; only its default rendering is replaced. */
.so-ai-swatch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}.so-ai-swatch-dot {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
    transition: transform 0.12s ease;
}.so-ai-swatch:hover .so-ai-swatch-dot {
    transform: scale(1.08);
}/* "No colour": an empty outlined circle, so the absence is a visible choice
   rather than a missing swatch. */
.so-ai-swatch-none .so-ai-swatch-dot {
    background: transparent;
    box-shadow: inset 0 0 0 2px var(--so-border-color);
}.so-ai-swatch-tick {
    font-size: 20px;
    color: #fff;
    opacity: 0;
    transform: scale(0.6);
    transition: opacity 0.12s ease, transform 0.12s ease;
}.so-ai-swatch input:checked + .so-ai-swatch-dot .so-ai-swatch-tick {
    opacity: 1;
    transform: scale(1);
}/* On the empty circle a white tick would vanish. */
.so-ai-swatch-none .so-ai-swatch-tick {
    color: var(--so-text-primary);
}.so-ai-swatch input:focus-visible + .so-ai-swatch-dot {
    outline: 2px solid var(--so-primary-focus-ring, currentColor);
    outline-offset: 3px;
}/* ---- Brand identity ---------------------------------------------------
   The product page presents SixOrbit AI with a violet accent and a sparkle
   mark, neither of which exists in the SO palette (--so-primary-rgb is
   26,115,232 — Google blue). This is the one place a colour is defined
   outside the theme, and it is scoped to this feature's identity elements
   only: the sparkle and the panel title. Every other control in the widget
   still uses stock SO tokens, so buttons, tables and alerts continue to
   follow the app theme.
   ---------------------------------------------------------------------- */

/* The accent is the framework's own primary, not a colour belonging to this
   feature. --so-accent-primary is already redefined under the dark theme, so
   pointing at it means light/dark follows the app with no override here. */
#soAiDrawer,
#soAiBotBtn,
#soAiBtn {
    --so-ai-accent: var(--so-accent-primary);
    --so-ai-composer-h: 40px;
}/* A ring, so the mark reads as a control rather than as decoration parked
   between two glyph buttons. Drawn with box-shadow, not a border: a border
   adds to the button's box and knocks it a pixel out of line with the icons
   either side, which is the alignment this is meant to help. Framework
   tokens, so it follows the theme with no dark override. */
#soAiBtn {
    box-shadow: 0 0 0 1px var(--so-primary-border-subtle);
    background: var(--so-primary-bg-subtle);
}#soAiBtn:hover:not(:disabled),
#soAiBtn:focus-visible {
    box-shadow: 0 0 0 1px var(--so-accent-primary);
    background: var(--so-primary-bg-emphasis);
}/* Present from first paint but not yet usable, so it holds its place in the
   navbar without inviting a click that would do nothing. */
#soAiBtn.so-ai-launcher-loading {
    opacity: 0.45;
    cursor: default;
    pointer-events: none;
}

/* SO_AI_SKILL v2: the launcher badge - "there is something here for you".
 *
 * #soAiBtn carries it, so this is already more specific than anything in
 * sixorbit-ui.css and does not need the drawer prefix the in-drawer overrides
 * do (that file is added AFTER this one - Theme.php:260 vs :204 - so an
 * equal-specificity rule here would lose on source order).
 *
 * The button itself is NOT given position: relative here - it is already
 * positioned as a circle icon button by the framework, and re-declaring it
 * would be an override of framework layout for no gain. If a theme ever ships
 * it static this badge will sit at the navbar's corner, which is visibly wrong
 * rather than quietly wrong, and that is the right failure.
 */
#soAiBtn {
    position: relative;
}

/* THE BADGE SITS ON THE CORNER, SO THE BUTTON MUST LET IT OUT.
 *
 * .so-btn is `overflow: hidden` for its ripple (the ::after that grows from
 * the centre on press), and so-btn-circle makes that clip a CIRCLE - so a
 * badge at top:-1px/right:-1px was sliced along the button's curve and came
 * out as a flat-topped red smear. Both buttons that carry the count are
 * .so-btn, so both need this.
 *
 * The ripple goes with it: it is rgba(255,255,255,0.3) over a ghost button,
 * which is invisible on every theme we ship, and letting it paint outside a
 * round button would be worse than not having it. Dropped here only - every
 * other button in the panel keeps it.
 *
 * Id-led selectors on purpose: sixorbit-ui.css is added AFTER this file
 * (Theme.php:260 vs :204), so a plain .so-btn-class rule would lose on source
 * order and change nothing. */
#soAiBtn,
#soAiDrawer .so-ai-skill-entry {
    /* !important, and it has to be. SORipple (sixorbit-ui.js, selector
       ".so-btn") writes `element.style.overflow = "hidden"` INLINE on every
       click and never takes it off again, so the badge survived page load and
       was cut the moment anybody pressed the button - which is exactly how it
       was reported. An author !important beats an inline normal declaration,
       which is the only thing that can reach a style attribute from here. */
    overflow: visible !important;
}

/* The CSS ripple (so-btn's own ::after) and the JS one (the span SORipple
   appends). Both are dropped on these two buttons: with the clip gone, a
   circle that grows from the press point would paint outside a round button
   and spill into the navbar. Nothing is lost - the ripple is
   rgba(255,255,255,0.3) over a ghost button, invisible on every theme we
   ship. Every other button in the panel keeps it. */
#soAiBtn::after,
#soAiDrawer .so-ai-skill-entry::after,
#soAiBtn .so-ripple-effect,
#soAiDrawer .so-ai-skill-entry .so-ripple-effect {
    display: none !important;
}

#soAiBtn .so-ai-launcher-badge,
#soAiDrawer .so-ai-skill-entry .so-ai-launcher-badge {
    position: absolute;
    top: -1px;
    right: -1px;
    min-width: 1rem;
    height: 1rem;
    padding: 0 0.2rem;
    border-radius: 0.5rem;
    background: var(--so-danger, #dc2626);
    color: #fff;
    font-size: 0.625rem;
    font-weight: 600;
    line-height: 1rem;
    text-align: center;
    /* The badge is decoration over a button that already says what it does;
       the count is in the button's own tooltip and aria-label, so a screen
       reader hears it there once rather than twice. */
    pointer-events: none;
}.so-drawer-title.so-ai-title {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--so-ai-accent);
}/* ---- Brand marks -------------------------------------------------------
   Both artworks ship in the markup and CSS picks the one the theme needs;
   see brandMark() in so-ai.js for why this is not done in JS.
   ---------------------------------------------------------------------- */

/* Header actions: Chats, New chat and setup are so-btn-sm icon buttons
   (16px glyph); full screen and close are the drawer's own controls (20px).
   Same 32px buttons, so give them the same 20px glyph and the row reads as
   one set. */
#soAiDrawer .so-drawer-header .so-btn-icon.so-btn-sm .material-symbols-rounded {
    font-size: 20px;
    width: 20px;
    min-width: 20px;
    height: 20px;
}

#soAiDrawer .so-ai-mark,
#soAiBtn .so-ai-mark {
    width: 20px;
    height: 20px;
    display: block;
    flex: 0 0 auto;
}#soAiDrawer .so-ai-mark-dark,
#soAiBtn .so-ai-mark-dark { display: none; }[data-theme="dark"] #soAiDrawer .so-ai-mark-light,
[data-theme="dark"] #soAiBtn .so-ai-mark-light { display: none; }[data-theme="dark"] #soAiDrawer .so-ai-mark-dark,
[data-theme="dark"] #soAiBtn .so-ai-mark-dark { display: block; }.so-ai-welcome-logo {
    margin-bottom: 0.75rem;
}/* The lockup is about 2.5:1, so a width is the only dimension worth stating. */
#soAiDrawer .so-ai-lockup {
    width: 150px;
    height: auto;
    display: inline-block;
}#soAiDrawer .so-ai-lockup-dark { display: none; }[data-theme="dark"] #soAiDrawer .so-ai-lockup-light { display: none; }[data-theme="dark"] #soAiDrawer .so-ai-lockup-dark { display: inline-block; }/* ---- Skills: "/name [option] question" ----------------------------------
   The hint above the composer, the badge on a sent message, the /help card
   and the note on a result that could not be charted.
   ---------------------------------------------------------------------- */

#soAiDrawer .so-ai-skill-hint {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 12px;
    color: var(--so-text-muted);
}#soAiDrawer .so-ai-skill-hint-text {
    flex: 1 1 auto;
    min-width: 0;
}#soAiDrawer .so-ai-skill-hint .so-badge .material-symbols-rounded,
#soAiDrawer .so-ai-skill-badge .material-symbols-rounded {
    font-size: 14px;
    vertical-align: -2px;
    margin-right: 0.2rem;
}#soAiDrawer .so-ai-skill-badge {
    margin-right: 0.4rem;
}#soAiDrawer .so-ai-welcome-tip {
    margin: 0 0 0.9rem;
    font-size: 12px;
    color: var(--so-text-muted);
}#soAiDrawer .so-ai-result-note {
    margin: 0 0 0.5rem;
    font-size: 12px;
    color: var(--so-text-muted);
}#soAiDrawer .so-ai-skills-help {
    border: 1px solid var(--so-border-color);
    border-radius: 0.5rem;
    padding: 0.75rem 0.9rem;
}#soAiDrawer .so-ai-skills-help-title {
    margin: 0 0 0.2rem;
    font-size: 13px;
    font-weight: 600;
    color: var(--so-text-heading);
}#soAiDrawer .so-ai-skills-help-sub {
    margin: 0 0 0.6rem;
    font-size: 12px;
    color: var(--so-text-muted);
}#soAiDrawer .so-ai-skill-row {
    display: grid;
    grid-template-columns: 22px minmax(0, 1fr) auto;
    gap: 0.6rem;
    align-items: start;
    padding: 0.55rem 0;
    border-top: 1px solid var(--so-border-color);
    font-size: 13px;
}#soAiDrawer .so-ai-skill-row > .material-symbols-rounded {
    font-size: 18px;
    color: var(--so-ai-accent);
}#soAiDrawer .so-ai-skill-meta {
    margin-top: 0.15rem;
    font-size: 12px;
    color: var(--so-text-muted);
}/* ---- AI Manager --------------------------------------------------------
   The Manager tab: the teams an AI manager looks after, and the form that
   configures them. Buttons, inputs, checkboxes, badges and alerts are stock
   SO; this is layout only.
   ---------------------------------------------------------------------- */

#soAiDrawer .so-ai-tabs {
    display: flex;
    gap: 0.15rem;
    margin-left: 0.75rem;
    padding: 0.15rem;
    border-radius: 999px;
    background: var(--so-bg-secondary);
}#soAiDrawer .so-ai-tab {
    padding: 0.2rem 0.75rem;
    border: 0;
    border-radius: 999px;
    background: none;
    color: var(--so-text-muted);
    font: inherit;
    font-size: 12px;
    cursor: pointer;
}#soAiDrawer .so-ai-tab-on {
    background: var(--so-bg-body, #fff);
    color: var(--so-text-heading);
    font-weight: 600;
}#soAiDrawer .so-ai-manager {
    gap: 0.5rem;
}/* ---- Small screens ------------------------------------------------------
   Full screen is a desktop shape: it stands the chat list beside the
   conversation, which needs width a phone has not got. The toggle goes, and
   the expanded layout is neutralised in case the state arrives anyway (the
   shared Alt+Enter handler, or a window resized after expanding).
   ---------------------------------------------------------------------- */

@media (max-width: 767px) {
    #soAiDrawer [data-so-drawer-fullscreen-toggle-btn] {
        display: none !important;
    }

    #soAiDrawer.so-drawer-expanded .so-ai-sidebar {
        position: absolute;
        inset: 0;
        z-index: 2;
        flex: none;
        max-width: none;
        border-right: 0;
        display: none;
    }

    #soAiDrawer.so-drawer-expanded.so-ai-history-open .so-ai-sidebar {
        display: block;
    }

    #soAiDrawer.so-drawer-expanded .so-ai-main {
        flex: 1 1 auto;
        max-width: none;
    }
}

/* ---- Scrum call (Manager tab) ------------------------------------------
   The call itself is SOCall, running inside the composer. The briefing cards
   and the conversation use the framework's call chat classes (.so-call-msg-*),
   so only the pane's layout is set here.
   ---------------------------------------------------------------------- */

#soAiDrawer .so-ai-scrum,
#soAiDrawer .so-ai-scrum-calls,
#soAiDrawer .so-ai-scrum-thread,
#soAiDrawer #soAiManagerList {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}#soAiDrawer .so-ai-scrum-calls:empty,
#soAiDrawer .so-ai-scrum-thread:empty {
    display: none;
}#soAiDrawer .so-ai-scrum-calls > *,
#soAiDrawer .so-ai-scrum-thread > * {
    flex-shrink: 0;
}#soAiDrawer .so-ai-scrum-call {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 0.7rem;
    border: 1px solid var(--so-border-color);
    border-radius: 0.6rem;
    font-size: 13px;
}#soAiDrawer .so-ai-scrum-call > .material-symbols-rounded {
    font-size: 20px;
    color: var(--so-ai-accent);
}#soAiDrawer .so-ai-scrum-failed > .material-symbols-rounded {
    color: var(--so-danger, #dc2626);
}
/* TOP-ALIGNED when it has failed. Every other status is one short phrase and
   centres nicely against the row; a failure is a sentence of explanation plus
   whatever the API said back - here "...run out of credit... Plans &
   Billing..." - and centring a 20px icon and a button against five lines of
   text floats them in the middle of the card with nothing to line up with. */
#soAiDrawer .so-ai-scrum-failed {
    align-items: flex-start;
}
/* THE ACTION NEVER SHRINKS, nor does the status icon.
   .so-btn is white-space:nowrap AND overflow:hidden, so a squeezed button does
   not get narrower - it keeps its width and loses its label inside itself.
   With the long failure text ("...has run out of credit... Plans & Billing...")
   flex gave the row's spare width to the message and took it off the button,
   and "Try again" came out as "Try aga" against the card's edge.
   The text column is the one that should give: it has min-width: 0 and wraps,
   which is what a three-line error is supposed to do. */
#soAiDrawer .so-ai-scrum-call > .material-symbols-rounded,
#soAiDrawer .so-ai-scrum-call > .so-btn,
#soAiDrawer .so-ai-scrum-call > .so-spinner,
#soAiDrawer .so-call-msg-missed > .so-btn {
    flex-shrink: 0;
}
#soAiDrawer .so-ai-scrum-call-text {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-width: 0;
    line-height: 1.3;
}#soAiDrawer .so-ai-scrum-call-text span {
    font-size: 12px;
    color: var(--so-text-muted);
}#soAiDrawer .so-ai-scrum-more {
    display: inline-block;
    margin-top: 0.35rem;
    font-size: 12px;
}

/* The consent gate: "Start briefing" / "Not now", for answering the greeting
   without speaking - no microphone, no speech recognition, an insecure page,
   or a member who would rather tap. Colour comes from the buttons; this only
   places them, and undoes the note bubble's small centred text. */
#soAiDrawer .so-ai-scrum-gate {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    justify-content: center;
    padding: 0.15rem 0;
    font-size: inherit;
}

/* ---- Scrum history (Manager tab) ---------------------------------------
   A team's calls day by day, and one day's call. Rows are SO list-group
   items and the call itself reuses the call chat classes above.
   ---------------------------------------------------------------------- */

#soAiDrawer .so-ai-history-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}#soAiDrawer .so-ai-history-head-text {
    min-width: 0;
}#soAiDrawer .so-ai-history-head-text p {
    margin: 0;
}#soAiDrawer .so-ai-history-day {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}#soAiDrawer .so-ai-history-date {
    margin: 0;
    font-size: 12px;
    font-weight: 600;
    color: var(--so-text-muted);
}#soAiDrawer button.so-ai-mgr-row,
#soAiDrawer .so-ai-history-call {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    width: 100%;
    text-align: left;
    cursor: pointer;
}#soAiDrawer button.so-ai-mgr-row:hover,
#soAiDrawer .so-ai-history-call:hover {
    background: var(--so-bg-secondary);
}#soAiDrawer .so-ai-history-call > .material-symbols-rounded,
#soAiDrawer button.so-ai-mgr-row > .material-symbols-rounded:last-child {
    font-size: 18px;
    color: var(--so-text-muted);
}#soAiDrawer .so-ai-history-count {
    font-size: 12px;
    color: var(--so-text-muted);
    white-space: nowrap;
}#soAiDrawer .so-ai-history-briefing {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}#soAiDrawer .so-ai-history-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--so-text-muted);
}#soAiDrawer .so-ai-history-play {
    align-self: flex-start;
}

/* A manager's name, member picker and calendar: a strip between the tabs and
   the chat that does not scroll, so whose chat this is stays in view. */
#soAiDrawer .so-ai-manager-head {
    flex-shrink: 0;
    padding: 10px 12px;
    border-bottom: 1px solid var(--so-border-color);
}#soAiDrawer.so-drawer-expanded .so-ai-manager-head {
    max-width: 900px;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
}#soAiDrawer .so-ai-history-content {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

/* The call bar at the top of a manager's chat, on today. */
#soAiDrawer .so-ai-team-callbar,
#soAiDrawer .so-ai-history-body {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}#soAiDrawer .so-ai-team-callbar:empty,
#soAiDrawer .so-ai-history-body:empty {
    display: none;
}

/* ---- AI manager chat: one thread, a tag per day ------------------------ */

#soAiDrawer .so-ai-chat-thread {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}#soAiDrawer .so-ai-chat-thread > * {
    flex-shrink: 0;
}/* One section per day, laid out like the thread. Its tag sticks inside it only,
   so the next day pushes the previous date off instead of stacking over it. */
#soAiDrawer .so-ai-day {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    scroll-margin-top: 0.5rem;
}#soAiDrawer .so-ai-day > * {
    flex-shrink: 0;
}#soAiDrawer .so-ai-day-tag {
    position: sticky;
    top: 0;
    z-index: 1;
    align-self: center;
    margin: 0.35rem 0 0.1rem;
}#soAiDrawer .so-ai-day-tag span {
    display: inline-block;
    padding: 0.15rem 0.7rem;
    border: 1px solid var(--so-border-color);
    border-radius: 999px;
    /* Solid: the messages scroll underneath the pinned tag. */
    background-color: var(--so-card-bg, #fff);
    font-size: 11px;
    font-weight: 600;
    color: var(--so-text-muted);
}#soAiDrawer .so-ai-day-tag.is-target span {
    border-color: var(--so-primary-border-subtle);
    /* The subtle tint can be see-through, so it is laid over the solid ground. */
    background-image: linear-gradient(var(--so-primary-bg-subtle), var(--so-primary-bg-subtle));
    color: var(--so-primary-text-emphasis);
}/* The width and the room for the clear x and icon come from SODatePicker's
   autoSize (set where the calendar is created), not from a fixed width here. */
#soAiDrawer .so-ai-chat-calendar {
    flex-shrink: 0;
    cursor: pointer;
}#soAiDrawer .so-ai-chat-member {
    width: auto;
    max-width: 160px;
    flex-shrink: 0;
}

/* Breathing room in a manager's chat: between days, and above the composer. */
#soAiDrawer .so-ai-chat-thread {
    gap: 0.75rem;
    padding-bottom: 1rem;
}#soAiDrawer .so-ai-day-tag {
    margin: 1rem 0 0.25rem;
}#soAiDrawer .so-ai-chat-thread > .so-ai-day:first-child > .so-ai-day-tag {
    margin-top: 0.25rem;
}

/* ---- Register interest (SO_AI_INTENT v1) --------------------------------
   Ends the switched-off showcase on both tabs: the form for an
   administrator, a line for everyone else. See mountIntent() in so-ai.js.
   ---------------------------------------------------------------------- */

#soAiDrawer .so-ai-intent {
    max-width: 34rem;
    margin: 1.25rem auto 0;
    text-align: left;
}
#soAiDrawer .so-ai-intent-title {
    margin: 0 0 0.25rem;
    font-size: 14px;
    font-weight: 600;
    color: var(--so-text-heading);
}
#soAiDrawer .so-ai-intent-sub {
    margin: 0 0 1rem;
    font-size: 13px;
    color: var(--so-text-muted);
}
#soAiDrawer .so-ai-intent-pair {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 0.75rem;
}
#soAiDrawer .so-ai-intent-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 0.75rem;
}
@media (max-width: 480px) {
    #soAiDrawer .so-ai-intent-pair {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* ---- Launcher: the AI mark fills the button -----------------------------
   The mark fills its 64 grid, so it covers the button edge to edge, and the
   button clips it to the same circle the other navbar icons use.
   The pale fill and ring are dropped: the mark is the button now, flat,
   with a thin ring on hover. The drawer title shows the same mark at the
   same size. */
#soAiBtn {
    padding: 0;
    /* No border: so-btn's 1px transparent one insets the mark and lets the
       navbar show through as a white ring. */
    border: 0;
    /* VISIBLE, and the mark clips ITSELF below.
       This rule used to say `overflow: hidden` to round the artwork off at
       the button's edge, and being the later of the two #soAiBtn rules it
       quietly beat the overflow:visible further up - so the count badge,
       which hangs a pixel past the top-right corner, was cut along the
       circle and came out as a red crescent. The mark is an <img>, and an
       <img> with its own border-radius clips itself, so the button does not
       have to do it for them both. !important for the same reason as the
       badge block above: SORipple writes overflow:hidden inline on click. */
    overflow: visible !important;
    /* A circle, like every other navbar button. */
    border-radius: 50%;
    background: transparent;
    /* Flat, like the navbar icons beside it: no shadow at rest. */
    box-shadow: none;
    transition: box-shadow 0.15s ease;
}
#soAiBtn .so-ai-mark {
    width: 100%;
    height: 100%;
    /* The artwork's own clip, so the button can stop clipping for it - see
       the overflow note above. A solid fill behind a circle, so this costs
       nothing visually and keeps the launcher round. */
    border-radius: 50%;
}
/* Hover and keyboard focus: a thin flat ring, no lift, no depth. */
#soAiBtn:hover:not(:disabled),
#soAiBtn:focus-visible {
    background: transparent;
    box-shadow: 0 0 0 2px var(--so-primary-border-subtle);
}
#soAiBtn:focus-visible {
    outline: 2px solid var(--so-accent-primary);
    outline-offset: 2px;
}

/* ---- Panel title: the same mark as the launcher --------------------------
   40px (the launcher's so-btn-icon size), the same corners, flat, and no
   visible name beside it. */
#soAiDrawer .so-ai-title .so-ai-mark {
    width: 40px;
    height: 40px;
    /* Circular too, so the panel's own title matches the button that opened it. */
    border-radius: 50%;
}

/* The technical reason behind a failed call: sent only to an administrator,
   and quieter than the sentence the member reads. */
#soAiDrawer .so-ai-error-detail {
    font-size: 11px;
    opacity: 0.75;
}

/* ---- Quick Access: the AI Setup tile ------------------------------------
   The mark itself rather than a stand-in glyph, in the solid artwork: a
   filled tile with the mark in white, so it sits with the coloured circles
   beside it. The circle stays the container's - the artwork is square and
   is clipped to it. */
.so-navbar-apps-icon-mark {
    background: none;
    overflow: hidden;
}
.so-navbar-apps-icon-mark img {
    width: 100%;
    height: 100%;
    display: block;
}
/* Qualified by the image rule above, so these need the same weight to win. */
.so-navbar-apps-icon-mark img.so-navbar-apps-mark-dark { display: none; }
[data-theme="dark"] .so-navbar-apps-icon-mark img.so-navbar-apps-mark-light { display: none; }
[data-theme="dark"] .so-navbar-apps-icon-mark img.so-navbar-apps-mark-dark { display: block; }

/* ---- SO_AI_FLAG v1: this whole conversation was wrong -------------------
   The thumbs on a message rate one answer. The flag says the THREAD went
   wrong, which is the shape most real failures take, and is what a reviewer
   has to be able to find. Two places carry it: the header control for the
   open chat, and a mark on the row in the conversation list. */
.so-ai-flag-mark {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    padding: 0;
    border: 0;
    background: none;
    /* The warning palette's text shade - readable on both themes, where the
       raw amber is not. See the house note on #b45309. */
    color: var(--so-warning-text, #b45309);
    cursor: pointer;
}
.so-ai-flag-mark .material-symbols-rounded {
    font-size: 1rem;
}
.so-ai-flag-mark:hover,
.so-ai-flag-mark:focus-visible {
    opacity: 0.7;
}
/* The header control, once the conversation is flagged. .so-btn is repeated
   for the same reason the rated thumb repeats it: the ghost button's own
   colour rule has equal specificity and comes later in the file. */
#soAiFlag.so-btn.so-ai-flagged {
    color: var(--so-warning-text, #b45309);
}

/* ---- SO_AI_SOURCE v1: which engine wrote this answer --------------------
   OFF by default and not switchable from anywhere on screen: three clicks on
   the AI mark add .so-ai-show-source to the drawer, and closing it takes the
   class away again. The badge is always in the markup - hiding it in CSS is
   what makes the toggle instant and keeps it correct on messages that were
   drawn while it was off. */
.so-ai-src {
    display: none;
    align-items: center;
    margin-left: 0.35rem;
    padding: 0 0.25rem;
    border-radius: var(--so-radius-sm, 4px);
    line-height: 1;
    cursor: default;
}
.so-ai-show-source .so-ai-src {
    display: inline-flex;
}
.so-ai-src .material-symbols-rounded {
    font-size: 0.9rem;
}
/* The Claude API - the ordinary answer, and the general-knowledge block. */
.so-ai-src-api {
    color: var(--so-info-text, #0e7490);
    background: var(--so-info-bg-subtle, rgba(14, 116, 144, 0.08));
}
/* Claude Code on the office PC - the live answer when no tool covers it. */
.so-ai-src-code {
    color: var(--so-success-text, #15803d);
    background: var(--so-success-bg-subtle, rgba(21, 128, 61, 0.08));
}
/* In the live-answer bubble the badge trails the text rather than sitting in
   an actions row, so it needs the spacing the row would have given it. */
.so-ai-assist-bubble .so-ai-src {
    margin-top: 0.35rem;
}
