/*
 * SixOrbit AI Manager - the configuration surface.
 *
 * grep marker: SO_AI v1
 *
 * Shared by BOTH surfaces on purpose: the Manager tab in the chat panel lists
 * the teams, and so_ai/manager.php is the page where they are created and
 * changed. One copy of the card, the people picker and the form, so the two
 * cannot drift apart. Page-only layout lives at the end.
 *
 * All colours come from SO theme tokens, so light and dark follow the app.
 */

/* The accent. so-ai.css defines it for the chat panel only, so the setup
   page gets its own - without it every accent border, the scrum icon and the
   picked-person tick lose their colour there. */
.so-ai-setup,
.so-ai-mgr-page {
    --so-ai-accent: var(--so-accent-primary, #2563eb);
}

.so-ai-mgr-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
}/* The form flows into as many columns as the width allows: one in the narrow
   drawer, two or three in full screen, rather than one column of fields
   stretched across a 27-inch screen. */
.so-ai-mgr-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 0 1.5rem;
    align-items: start;
}.so-ai-mgr-wide,
.so-ai-mgr-skills {
    grid-column: 1 / -1;
}.so-ai-mgr-block {
    min-width: 0;
}.so-ai-mgr-title {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--so-text-heading);
}.so-ai-mgr-sub {
    margin: 0.15rem 0 0;
    font-size: 13px;
    color: var(--so-text-muted);
}.so-ai-mgr-cards {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}.so-ai-mgr-card {
    padding: 0.7rem 0.8rem;
    border: 1px solid var(--so-border-color);
    border-radius: 0.5rem;
}.so-ai-mgr-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}.so-ai-mgr-name {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--so-text-heading);
}.so-ai-mgr-card-actions {
    display: flex;
    gap: 0.15rem;
    flex-shrink: 0;
}.so-ai-mgr-line {
    display: flex;
    align-items: flex-start;
    gap: 0.35rem;
    margin: 0.15rem 0 0;
    font-size: 13px;
    color: var(--so-text-primary);
}.so-ai-mgr-line > .material-symbols-rounded {
    font-size: 15px;
    color: var(--so-text-muted);
    flex-shrink: 0;
}.so-ai-mgr-muted {
    color: var(--so-text-muted);
}.so-ai-mgr-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-top: 0.45rem;
}.so-ai-mgr-chips .material-symbols-rounded {
    font-size: 13px;
    vertical-align: -2px;
    margin-right: 0.2rem;
}/* ---- the form ---- */

.so-ai-mgr-label {
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
    margin: 0.8rem 0 0.25rem;
    font-size: 13px;
    font-weight: 600;
    color: var(--so-text-heading);
}.so-ai-mgr-hint,
.so-ai-mgr-count {
    font-weight: 400;
    font-size: 12px;
    color: var(--so-text-muted);
}.so-ai-mgr-count {
    margin-left: auto;
}/* People in a grid, not lines in a list: a face, a name and where they work,
   as many across as the width allows. No cards - only a hairline between
   neighbours. */
.so-ai-mgr-people {
    display: grid;
    /* 180px, not wider: in full screen each field is itself a column of the
       form, about 400px, and a larger minimum left one person per row there. */
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    /* A fixed row height, not 1fr: once the list scrolls there is no free
       space to share out and 1fr falls back to each row's own content, which
       is what left the grid ragged. */
    /* 48px: the 32px face with 8px either side, and still room for the name
       and the meta line - no empty band under a name with no meta. */
    grid-auto-rows: 48px;
    /* No gap: the separators are the only thing between two people. */
    gap: 0;
    align-content: start;
    max-height: 264px;
    overflow-y: auto;
    /* No surface of its own: the people sit straight on the panel, so there
       is one background here instead of three stacked tones. */
    margin-top: 0.3rem;
}.so-ai-mgr-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0.35rem;
    font-size: 13px;
    cursor: pointer;
}.so-ai-mgr-person {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    min-width: 0;
    /* The row is a <label>, and the app's base label style adds a bottom
       margin: without this each cell stops short of its row. */
    margin: 0;
    padding: 0 0.75rem;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.12s ease;
}/* The separators: a hairline on each person's left and top, drawn 1px outside
   the cell. The first column's and first row's fall outside the list and are
   clipped, so lines only ever sit BETWEEN two people - never on the outer
   edge, and never under an empty cell in a short last row. */
.so-ai-mgr-person::before,
.so-ai-mgr-person::after {
    content: "";
    position: absolute;
    pointer-events: none;
}/* Dotted, so the grid stays a quiet guide rather than a table. */
.so-ai-mgr-person::before {
    top: 0;
    bottom: 0;
    left: -1px;
    border-left: 1px dotted var(--so-border-color);
}.so-ai-mgr-person::after {
    top: -1px;
    left: 0;
    right: 0;
    border-top: 1px dotted var(--so-border-color);
}.so-ai-mgr-person:hover {
    background: color-mix(in srgb, var(--so-ai-accent) 4%, transparent);
}/* Picked: a wash of the accent and the tick on the face, nothing heavier. */
@supports not (background: color-mix(in srgb, red 7%, transparent)) {
    .so-ai-mgr-person-on { background: var(--so-primary-bg-subtle); }
}

.so-ai-mgr-person-on {
    background: color-mix(in srgb, var(--so-ai-accent) 7%, transparent);
}.so-ai-mgr-person-face {
    position: relative;
    flex-shrink: 0;
    line-height: 0;
}.so-ai-mgr-person .so-avatar {
    flex-shrink: 0;
    overflow: hidden;
}.so-ai-mgr-person-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.25;
}.so-ai-mgr-person-name,
.so-ai-mgr-person-sub {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}.so-ai-mgr-person-sub {
    font-size: 12px;
    color: var(--so-text-muted);
}.so-ai-mgr-person-name {
    font-weight: 600;
    color: var(--so-text-heading);
}.so-ai-mgr-person-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.2rem;
    margin-top: 0.2rem;
}.so-ai-mgr-person-tags .so-badge {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 10px;
}/* No checkbox control on these rows: the row itself is what you click, and a
   tick at the end says who is on the team. The input is still there, and still
   reachable by keyboard — just not drawn. */
.so-ai-mgr-person > input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}/* A check badge on the corner of the face, not a glyph adrift on the card. */
.so-ai-mgr-person .so-ai-mgr-person-tick {
    position: absolute;
    right: -4px;
    bottom: -4px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid var(--so-card-bg, #fff);
    background: var(--so-ai-accent);
    color: #fff;
    /* The icon font's own size and line height (and the face's line-height: 0)
       would push the glyph out of the badge: size it for the badge, and bold. */
    font-size: 12px;
    line-height: 1;
    font-variation-settings: 'FILL' 0, 'wght' 700, 'GRAD' 0, 'opsz' 20;
    visibility: hidden;
}.so-ai-mgr-person-on .so-ai-mgr-person-tick {
    visibility: visible;
}/* Keyboard users get the same outline the row would have as a control. */
.so-ai-mgr-person:focus-within {
    outline: 2px solid var(--so-ai-accent);
    outline-offset: -2px;
}/* The scrum meeting: the heart of an AI manager, so it reads as its own feature
   - an accent border, a wash of the accent and a proper heading - and goes
   quiet when it is switched off. */
.so-ai-mgr-scrum {
    margin-top: 1.1rem;
    /* No overflow: hidden - the role and language selects open past its edge. */
    position: relative;
    border: 1px solid color-mix(in srgb, var(--so-ai-accent) 38%, var(--so-border-color));
    border-radius: 0.85rem;
    background: linear-gradient(120deg, color-mix(in srgb, var(--so-ai-accent) 10%, transparent), transparent 65%);
    transition: border-color 0.2s ease, background 0.2s ease;
}

.so-ai-mgr-scrum.is-off {
    border-color: var(--so-border-color);
    background: none;
}

.so-ai-mgr-scrum-head {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.9rem 1rem;
}

.so-ai-mgr-scrum-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: var(--so-ai-accent);
    color: #fff;
    box-shadow: 0 6px 16px color-mix(in srgb, var(--so-ai-accent) 32%, transparent);
}

.so-ai-mgr-scrum-icon .material-symbols-rounded {
    font-size: 22px;
}

.so-ai-mgr-scrum.is-off .so-ai-mgr-scrum-icon {
    background: var(--so-bg-secondary);
    color: var(--so-text-muted);
    box-shadow: none;
}

.so-ai-mgr-scrum-title {
    flex: 1;
    min-width: 0;
}

.so-ai-mgr-scrum-name {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--so-text-heading);
}

.so-ai-mgr-scrum-desc {
    margin: 0.15rem 0 0;
    font-size: 13px;
    color: var(--so-text-muted);
}

/* Scoped twice over on purpose: .so-ai-mgr-check sets width: 100% later in
   this file, which would stretch the switch across the heading. */
.so-ai-mgr-scrum-head .so-ai-mgr-scrum-switch {
    width: auto;
    flex-shrink: 0;
    padding-top: 0.5rem;
}

.so-ai-mgr-scrum-body {
    padding: 0 1rem 1rem;
}

.so-ai-mgr-scrum-when {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.25rem 2rem;
    border-top: 1px dashed color-mix(in srgb, var(--so-ai-accent) 30%, var(--so-border-color));
}

.so-ai-mgr-scrum-people {
    margin-top: 0.4rem;
}

.so-ai-mgr-scrum-people .so-alert {
    margin-bottom: 0.4rem;
}

/* Who gets the call: one row per assigned user - who, their role, their
   language. */
.so-ai-mgr-callrows {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.so-ai-mgr-callrow {
    display: grid;
    grid-template-columns: minmax(170px, 1.3fr) minmax(170px, 1fr) minmax(140px, 190px);
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.6rem;
    border: 1px solid var(--so-border-color);
    border-radius: 0.6rem;
    background: var(--so-card-bg, #fff);
}

/* The enhanced selects fill their column. */
.so-ai-mgr-callrow .so-select {
    width: 100%;
    min-width: 0;
}

.so-ai-mgr-callrow-who {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

.so-ai-mgr-callrow-who .so-avatar {
    flex-shrink: 0;
    overflow: hidden;
}

@media (max-width: 575px) {
    .so-ai-mgr-callrow {
        grid-template-columns: 1fr 1fr;
    }

    .so-ai-mgr-callrow-who {
        grid-column: 1 / -1;
    }

    .so-ai-mgr-scrum-head {
        flex-wrap: wrap;
    }
}.so-ai-mgr-days {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}.so-ai-mgr-time {
    max-width: 140px;
}.so-ai-mgr-skilllist {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--so-border-color);
    border-radius: 0.5rem;
    overflow: hidden;
}/* One bordered list divided by hairlines, rather than a card per skill: eight
   boxes in a column read as eight separate things to decide on. */
.so-ai-mgr-skill {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.55rem 0.65rem;
    border-top: 1px solid var(--so-border-color);
    font-size: 13px;
}.so-ai-mgr-skill:first-child {
    border-top: 0;
}.so-ai-mgr-skill-pick {
    cursor: pointer;
}/* A skill you switch on: the checkbox, icon and title on one 20px line, the
   description under the title. The checkbox input is absolutely positioned,
   so it takes no cell. */
.so-ai-mgr-skill.so-ai-mgr-skill-pick {
    display: grid;
    grid-template-columns: 20px 20px minmax(0, 1fr);
    column-gap: 0.5rem;
    row-gap: 0.1rem;
    align-items: center;
}.so-ai-mgr-skill-pick .so-checkbox-box {
    grid-column: 1;
    grid-row: 1;
}.so-ai-mgr-skill-pick > .material-symbols-rounded {
    grid-column: 2;
    grid-row: 1;
}.so-ai-mgr-skill-pick .so-ai-mgr-skill-title {
    grid-column: 3;
    grid-row: 1;
}.so-ai-mgr-skill-pick .so-ai-mgr-skill-desc {
    grid-column: 3;
    grid-row: 2;
}/* An even glyph size in a whole-pixel box, at its own optical size: at 17px
   the outlined circle landed on half pixels and was not round. */
.so-ai-mgr-skill > .material-symbols-rounded {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    font-size: 18px;
    line-height: 1;
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 20;
    color: var(--so-ai-accent);
    flex-shrink: 0;
}.so-ai-mgr-skill strong {
    display: block;
    line-height: 20px;
    color: var(--so-text-heading);
}/* The description only. A bare `span` here also caught the check icon inside
   .so-checkbox-box and greyed the tick out. */
.so-ai-mgr-skill-desc {
    color: var(--so-text-muted);
}.so-ai-mgr-showcase {
    text-align: center;
    padding: 0.5rem 0.25rem;
}.so-ai-mgr-showcase .so-ai-mgr-skilllist,
.so-ai-mgr-showcase .so-ai-mgr-skill {
    text-align: left;
}.so-ai-mgr-showcase .so-alert {
    margin-top: 1.25rem;
    text-align: left;
}.so-ai-mgr-showcase .so-ai-mgr-sub {
    margin: 1rem 0 0.4rem;
    font-weight: 600;
    color: var(--so-text-heading);
}.so-ai-mgr-req {
    margin-left: 0.15rem;
    color: var(--so-danger, #dc3545);
    font-weight: 600;
}.so-ai-mgr-error {
    margin-top: 0.75rem;
}/* The rows are SO checkboxes now, so only the row layout is set here. */
.so-ai-mgr-person,
.so-ai-mgr-check {
    width: 100%;
}/* Everyone picked so far, on one wrapping row above the list: who is on the
   team, without scrolling the list to find out. */
.so-ai-mgr-picked {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.3rem;
    margin: 0.3rem 0;
}.so-ai-mgr-picked-empty {
    margin: 0;
    font-size: 12px;
    color: var(--so-text-muted);
}.so-ai-mgr-picked-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    max-width: 100%;
    padding: 0.15rem 0.15rem 0.15rem 0.15rem;
    border: 1px solid var(--so-border-color);
    border-radius: 999px;
    font-size: 13px;
}.so-ai-mgr-picked-name {
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}.so-ai-mgr-picked-remove {
    display: inline-flex;
    align-items: center;
    padding: 0 0.15rem;
    border: 0;
    background: none;
    color: var(--so-text-muted);
    cursor: pointer;
}.so-ai-mgr-picked-remove:hover,
.so-ai-mgr-picked-remove:focus-visible {
    color: var(--so-danger, #dc3545);
}.so-ai-mgr-picked-remove .material-symbols-rounded {
    font-size: 14px;
}/* A team's people on its card: every member, with a face, a name and where
   they work, as many across as the card allows. */
.so-ai-mgr-section {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin: 0.35rem 0 0.4rem;
    font-size: 12px;
    font-weight: 600;
    color: var(--so-text-muted);
}

.so-ai-mgr-section > .material-symbols-rounded {
    font-size: 15px;
}

.so-ai-mgr-section .so-ai-mgr-count {
    margin-left: 0;
}

.so-ai-mgr-members {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.5rem 0.75rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.so-ai-mgr-member {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
    font-size: 13px;
}

.so-ai-mgr-member .so-avatar {
    flex-shrink: 0;
    overflow: hidden;
}

/* Schedule and skills under a hairline, apart from the people. */
.so-ai-mgr-card-foot {
    margin-top: 0.65rem;
    padding-top: 0.55rem;
    border-top: 1px solid var(--so-border-color);
}

.so-ai-mgr-card-foot > .so-ai-mgr-line:first-child,
.so-ai-mgr-card-foot > .so-ai-mgr-chips:first-child {
    margin-top: 0;
}

/* Schedule and skills read at body size, not as fine print. */
.so-ai-mgr-card-foot .so-ai-mgr-line,
.so-ai-mgr-card-foot .so-ai-mgr-chips,
.so-ai-mgr-card-foot .so-badge {
    font-size: 14px;
}

.so-ai-mgr-card-foot .so-ai-mgr-line > .material-symbols-rounded,
.so-ai-mgr-card-foot .so-ai-mgr-chips .material-symbols-rounded {
    font-size: 16px;
}
/* The chat panel's Manager tab: the list, and nothing else. */
.so-ai-mgr-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 13px;
}

.so-ai-mgr-row > .material-symbols-rounded {
    font-size: 18px;
    color: var(--so-ai-accent, var(--so-accent-primary));
    flex-shrink: 0;
}

.so-ai-mgr-row-count {
    flex-shrink: 0;
    font-size: 12px;
    color: var(--so-text-muted);
}

/* ---- The page (?urlq=ai-manager) ----------------------------------------
   Rendered inside the app shell, so it brings no chrome of its own - only the
   measure of the column and how the form behaves in it.
   ---------------------------------------------------------------------- */

.so-ai-mgr-page {
    max-width: 1180px;
    margin: 0 auto;
    padding: 0.25rem 1rem 1rem;
}

/* The form's actions sit at the foot of the window, not at the end of a long
   scroll: a team with sixty people to pick through is a long page. */
.so-ai-mgr-page .so-ai-mgr-foot {
    position: sticky;
    bottom: 0;
    z-index: 4;
    margin-top: 1rem;
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--so-border-color);
    background: var(--so-bg-body, #fff);
}

/* A page has room the drawer has not: show more people before scrolling. */
.so-ai-mgr-page .so-ai-mgr-people {
    max-height: 360px;
}

/* Wide enough for two columns of members per card; one card per row on a
   phone rather than a card wider than the screen. */
.so-ai-mgr-page .so-ai-mgr-cards {
    display: grid;
    /* auto-FIT, not auto-fill: there are rarely many managers, so the cards
       stretch across the page instead of leaving empty columns beside them. */
    grid-template-columns: repeat(auto-fit, minmax(min(460px, 100%), 1fr));
    gap: 0.75rem;
    align-items: start;
}

@media (max-width: 575px) {
    .so-ai-mgr-page {
        padding: 0.25rem 0.75rem 1rem;
    }

    .so-ai-mgr-page .so-ai-mgr-head {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
}

/* ---- SixOrbit AI setup (?urlq=ai-setup/<tab>) ---------------------------
   A white SO card like other pages; the card, its header and the tabs are
   the framework's own. These only space the open tab's content.
   ---------------------------------------------------------------------- */

.so-ai-setup-pane {
    padding-top: 1rem;
}

/* The managers pane already sits in the card's body. */
.so-ai-setup .so-ai-mgr-page {
    max-width: none;
    padding: 0;
}

/* The sticky Save bar sits on the card, not the grey page behind it. */
.so-ai-setup .so-ai-mgr-page .so-ai-mgr-foot {
    background: var(--so-card-bg, var(--so-bg-body, #fff));
}

.so-ai-setup-card {
    max-width: 640px;
    margin-bottom: 0.75rem;
    padding: 0.85rem 1rem;
    border: 1px solid var(--so-border-color);
    border-radius: 0.6rem;
}

.so-ai-setup-card-title {
    margin: 0 0 0.5rem;
    font-size: 14px;
    font-weight: 600;
    color: var(--so-text-heading);
}

.so-ai-setup-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.45rem 0;
    border-top: 1px solid var(--so-border-color);
    font-size: 13px;
}

.so-ai-setup-row:first-of-type {
    border-top: 0;
}

.so-ai-setup-row-label {
    color: var(--so-text-muted);
}

.so-ai-setup-row-value {
    color: var(--so-text-heading);
    font-weight: 500;
    text-align: right;
    overflow-wrap: anywhere;
}

.so-ai-setup-muted {
    color: var(--so-text-muted);
    font-weight: 400;
}

.so-ai-setup .so-alert {
    max-width: 640px;
}

/* ---- SO_AI_ADMIN_HISTORY v1 - chat history on the setup page -------------
   People down the left, their chats (or one chat in full) on the right. The
   pane uses the page's whole width: there are never many managers or people,
   so the space is better spent on the reading column. */
.so-ai-hist {
    display: grid;
    grid-template-columns: minmax(200px, 260px) minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
}
.so-ai-hist-lead {
    margin-top: 1.25rem;
}
.so-ai-hist-people {
    display: grid;
    gap: 0.25rem;
    max-height: 26rem;
    overflow: auto;
}
.so-ai-hist-person {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.4rem 0.5rem;
    border: 0;
    border-radius: 0.5rem;
    background: transparent;
    text-align: left;
    cursor: pointer;
}
.so-ai-hist-person:hover {
    background: var(--so-bg-subtle, rgba(0, 0, 0, 0.04));
}
.so-ai-hist-person.so-active {
    background: var(--so-primary-bg-subtle);
}
.so-ai-hist-person-text {
    display: grid;
    min-width: 0;
}
.so-ai-hist-person-text strong {
    font-size: 13px;
    font-weight: 600;
    color: var(--so-text-heading);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.so-ai-hist-person-text span {
    font-size: 12px;
    color: var(--so-text-muted);
}
.so-ai-hist-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}
.so-ai-hist-title {
    margin-bottom: 0.5rem;
}
.so-ai-hist-thread {
    display: grid;
    gap: 0.5rem;
    max-height: 30rem;
    overflow: auto;
    padding-right: 0.25rem;
}

/* The setup page's own cards no longer cap their width - the managers, the
   state rows and the history all read better across the page. */
.so-ai-setup .so-ai-setup-card,
.so-ai-setup .so-alert {
    max-width: none;
}

@media (max-width: 767px) {
    .so-ai-hist {
        grid-template-columns: minmax(0, 1fr);
    }
    .so-ai-hist-people {
        max-height: 14rem;
    }
}

/* ---- Test call: who to ring ---------------------------------------------
   The team, ticked. Scrolls inside the dialog so a big team cannot push the
   footer buttons off screen. */
.so-ai-ring-all {
    margin: 0.75rem 0 0.35rem;
}
.so-ai-ring-people {
    display: grid;
    gap: 0.15rem;
    max-height: 14rem;
    overflow: auto;
    padding: 0.35rem 0.25rem 0.1rem;
    border-top: 1px solid var(--so-border-color);
}
.so-ai-ring-person .so-checkbox-label {
    font-size: 13px;
}

/* A manager's chat read on the page, not in the panel: the bubbles were
   drawn for a narrow drawer, so they are capped and sided here instead of
   running the whole width. */
.so-ai-hist-thread .so-call-msg {
    max-width: 40rem;
}
.so-ai-hist-thread .so-call-msg-user {
    margin-left: auto;
}
.so-ai-hist-thread .so-call-msg-note {
    max-width: none;
}

/* ---- Chat history: one person's chats ------------------------------------
   A row per chat: what it was called, when it was last spoken to and how
   long it ran. Left-aligned, so two chats with the same title are still
   told apart at a glance. */
.so-ai-hist-threads {
    display: grid;
    gap: 0.35rem;
}
.so-ai-hist-thread-row {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    width: 100%;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--so-border-color);
    border-radius: 0.6rem;
    background: var(--so-card-bg, #fff);
    text-align: left;
    cursor: pointer;
}
.so-ai-hist-thread-row:hover {
    border-color: var(--so-accent-primary);
    background: var(--so-primary-bg-subtle);
}
.so-ai-hist-thread-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    flex: 0 0 auto;
    border-radius: 0.5rem;
    background: var(--so-primary-bg-subtle);
    color: var(--so-accent-primary);
}
.so-ai-hist-thread-icon .material-symbols-rounded {
    font-size: 18px;
}
.so-ai-hist-thread-text {
    display: grid;
    min-width: 0;
    flex: 1 1 auto;
}
.so-ai-hist-thread-title {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 13px;
    font-weight: 600;
    color: var(--so-text-heading);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.so-ai-hist-pin {
    font-size: 14px;
    color: var(--so-text-muted);
}
.so-ai-hist-thread-meta {
    font-size: 12px;
    color: var(--so-text-muted);
}
.so-ai-hist-thread-go {
    color: var(--so-text-muted);
    flex: 0 0 auto;
}

/* ---- SO_AI_COST v1 - Usage ----------------------------------------------
   Money only, never tokens: the allowance is a price and so is everything
   the providers charge. The balance is the headline, the two sides of the
   product are shares of what has gone, and the table ranks the people. */
.so-ai-usage-top {
    display: grid;
    grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.4fr);
    gap: 1rem;
    align-items: stretch;
    margin-bottom: 1.5rem;
}
.so-ai-usage-hero {
    padding: 1.1rem 1.25rem;
    border: 1px solid var(--so-success-border-subtle, var(--so-border-color));
    border-radius: 0.75rem;
    background: var(--so-success-bg-subtle, var(--so-card-bg, #fff));
}
.so-ai-usage-hero.so-ai-usage-out {
    border-color: var(--so-danger-border-subtle, var(--so-border-color));
    background: var(--so-danger-bg-subtle, var(--so-card-bg, #fff));
}
.so-ai-usage-hero-label {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--so-text-body);
}
.so-ai-usage-hero-value {
    margin: 0.1rem 0 0.6rem;
    font-size: 30px;
    font-weight: 700;
    line-height: 1.1;
    color: var(--so-text-heading);
}
.so-ai-usage-hero-bar {
    margin-bottom: 0.45rem;
}
.so-ai-usage-hero-sub {
    margin: 0;
    font-size: 12px;
    color: var(--so-text-muted);
}
.so-ai-usage-splits {
    display: grid;
    gap: 0.4rem;
    align-content: start;
    padding: 1.1rem 1.25rem;
    border: 1px solid var(--so-border-color);
    border-radius: 0.75rem;
    background: var(--so-card-bg, #fff);
}
.so-ai-usage-split-head-label {
    margin: 0 0 0.35rem;
    font-size: 13px;
    font-weight: 600;
    color: var(--so-text-heading);
}
.so-ai-usage-totals {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1.5rem;
    margin-bottom: 0.25rem;
}
.so-ai-usage-total {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}
.so-ai-usage-dot {
    width: 0.6rem;
    height: 0.6rem;
    flex: 0 0 auto;
    border-radius: 50%;
    align-self: center;
}
.so-ai-usage-chart {
    margin-top: 0.25rem;
    min-height: 240px;
}
.so-ai-usage-split-name {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 13px;
    font-weight: 600;
    color: var(--so-text-heading);
}
.so-ai-usage-split-name .material-symbols-rounded {
    font-size: 18px;
    color: var(--so-accent-primary);
}
.so-ai-usage-split-value {
    font-size: 15px;
    font-weight: 600;
    color: var(--so-text-heading);
}
.so-ai-usage-sub {
    margin: 0.25rem 0 0;
    font-size: 12px;
    color: var(--so-text-muted);
}
.so-ai-usage-head {
    margin-bottom: 0.15rem;
}
.so-ai-usage-note {
    margin-bottom: 0.75rem;
}
.so-ai-usage-person {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}
.so-ai-usage-sharecol {
    width: 9rem;
}

@media (max-width: 767px) {
    .so-ai-usage-top {
        grid-template-columns: minmax(0, 1fr);
    }
    .so-ai-usage-sharecol {
        display: none;
    }
}

/* The chart's week, and the way back to the one before it. */
.so-ai-usage-weekbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.so-ai-usage-weeknav {
    display: inline-flex;
    align-items: center;
    gap: 0.15rem;
}
.so-ai-usage-week {
    min-width: 12.5rem;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    color: var(--so-text-heading);
    cursor: pointer;
}

/* ---- Usage: the waiting shape -------------------------------------------
   Same blocks, same heights as the loaded pane, so nothing jumps when the
   figures land - on first open and on every week change. */
.so-ai-usage-hero-skeleton {
    border-color: var(--so-border-color);
    background: var(--so-card-bg, #fff);
}
.so-ai-sk-label {
    width: 7rem;
    height: 0.9rem;
}
.so-ai-sk-value {
    width: 12rem;
    height: 2rem;
    margin: 0.2rem 0 0.75rem;
    border-radius: 4px;
}
.so-ai-sk-bar {
    height: 0.5rem;
    margin-bottom: 0.6rem;
    border-radius: 4px;
}
.so-ai-sk-sub {
    width: 60%;
    height: 0.8rem;
}
.so-ai-sk-chart {
    height: 240px;
    border-radius: 6px;
}
.so-ai-sk-head {
    width: 11rem;
    margin-top: 0.25rem;
}
.so-ai-sk-row {
    height: 2.2rem;
    margin-bottom: 0.5rem;
    border-radius: 6px;
}
