/* ── an agent's page ────────────────────────────────────────────────────
 *
 * screens/studio/agent: the questions down the side, the answer in the
 * middle, and the preview on the end.
 *
 * Its own file, as loading.css and menus.css are: shell.css is four thousand
 * lines, and a new class name in it is a collision waiting to happen. Every
 * name here is new (scripts/cssclash.php keeps it that way).
 */

.xc-agentpage {
    position: relative;
    flex: 1;
    min-block-size: 0;
    display: flex;
    gap: 14px;
    padding: 0 16px 16px;
}

/* ── the side ─────────────────────────────────────────────────────────── */

.xc-agentside {
    inline-size: 232px;
    flex: none;
    box-sizing: border-box;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 14px 12px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--surface);
}

.xc-agentside__back {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 8px 5px 5px;
    border-radius: 9px;
    font-size: 13px;
    text-decoration: none;
    color: rgba(var(--ink), .55);
    transition: background 140ms, color 140ms;
}

.xc-agentside__back:hover {
    background: rgba(var(--ink), .05);
    color: var(--text);
}

/* The arrow points the way back, whichever way the page reads. */
[dir="rtl"] .xc-agentside__back svg { transform: scaleX(-1); }

.xc-agentside__who {
    display: flex;
    align-items: center;
    gap: 11px;
    padding-inline: 4px;
}

.xc-agentside__mark {
    inline-size: 40px;
    block-size: 40px;
    flex: none;
    border-radius: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent, var(--peri));
    background: rgba(var(--ink), .05);
    background: color-mix(in srgb, var(--accent, #5B5BF0) 14%, transparent);
}

.xc-agentside__name {
    display: flex;
    align-items: center;
    gap: 6px;
    min-inline-size: 0;
    font-weight: 600;
    font-size: 15px;
}

.xc-agentside__chip {
    align-self: flex-start;
    border-radius: 20px;
    padding: 3px 9px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 9.5px;
    letter-spacing: .11em;
}

.xc-agentside__role {
    margin: 0;
    padding-inline: 4px;
    font-size: 12.5px;
    line-height: 1.45;
    color: rgba(var(--ink), .5);
    text-wrap: pretty;
}

.xc-agentside__tabs {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding-block-start: 10px;
    border-block-start: 1px solid var(--line);
}

/* On the air or not, at the foot of the side whatever is above it. */
.xc-agentside__air {
    margin-block-start: auto;
    display: flex;
    flex-direction: column;
    gap: 9px;
    padding: 13px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(var(--ink), .025);
}

.xc-agentside__more {
    display: flex;
    align-items: center;
    gap: 8px;
}

.xc-agentside__more form:first-child { flex: 1; }

.xc-agentside__more form:first-child .xc-act {
    inline-size: 100%;
    justify-content: center;
}

/* ── the middle ───────────────────────────────────────────────────────── */

.xc-agentmain {
    flex: 1;
    min-inline-size: 0;
    min-block-size: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding-inline-end: 2px;
}

/* The header stays put while the cards scroll under it, so the save is
   always one press away from whatever was just changed. */
.xc-agentmain > .xc-rephead {
    position: sticky;
    inset-block-start: 0;
    z-index: 5;
}

/* "Preview", only while the preview is put away: open, it is its own way
   back out. */
.xc-agentmain__peek { display: none !important; }
[data-preview-closed] .xc-agentmain__peek { display: inline-flex !important; }

.xc-agentcards {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.xc-agentcards__note {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12.8px;
    color: rgba(var(--ink), .5);
}

.xc-agentcards__note::before {
    content: "";
    inline-size: 7px;
    block-size: 7px;
    flex: none;
    border-radius: 50%;
    background: rgba(var(--ink), .25);
}

.xc-agentcards__note[data-live] { color: var(--green); }
.xc-agentcards__note[data-live]::before { background: var(--green); }

.xc-agentcards__foot {
    display: flex;
    justify-content: flex-end;
}

.xc-saved {
    margin: 0;
    padding: 9px 11px;
    border-radius: 10px;
    font-size: 13px;
    color: var(--green);
    background: rgba(0, 168, 134, .1);
}

.xc-refused {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 9px 11px;
    border-radius: 10px;
    font-size: 13px;
    color: #b83636;
    background: rgba(214, 69, 69, .08);
}

/* A card: its question, a line on what it is for, and the fields. */
.xc-sect {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 20px 22px;
}

.xc-sect__head {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.xc-sect__head h3 {
    margin: 0;
    font-family: Poppins, sans-serif;
    font-weight: 600;
    font-size: 17px;
    letter-spacing: -0.01em;
}

.xc-sect__head p {
    margin: 0;
    font-size: 13px;
    line-height: 1.5;
    color: rgba(var(--ink), .48);
    text-wrap: pretty;
}

.xc-sect__body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ── fields ───────────────────────────────────────────────────────────── */

/* The studio's own field, as its panels have always drawn it inline. */
.xc-field {
    inline-size: 100%;
    box-sizing: border-box;
    appearance: none;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--surface-2);
    font: inherit;
    font-size: 14px;
    color: var(--text);
    outline: none;
    transition: border-color 160ms, box-shadow 160ms;
}

.xc-field:focus {
    border-color: var(--peri);
    box-shadow: 0 0 0 3px rgba(var(--brand), .12);
}

select.xc-field {
    cursor: pointer;
    padding-inline-end: 34px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

[dir="rtl"] select.xc-field { background-position: left 12px center; }

/* How much room is left, in the corner of the box (modules/count.js). */
.xc-counted {
    position: relative;
    display: block;
}

.xc-counted > .xc-field { padding-inline-end: 66px; }

.xc-counted--area > .xc-field {
    padding-inline-end: 12px;
    padding-block-end: 30px;
}

.xc-count {
    position: absolute;
    inset-inline-end: 11px;
    inset-block-end: 10px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10.5px;
    font-variant-numeric: tabular-nums;
    color: rgba(var(--ink), .38);
    pointer-events: none;
}

.xc-counted > input.xc-field + .xc-count {
    inset-block: 50% auto;
    transform: translateY(-50%);
}

.xc-count[data-near] { color: var(--amber); }

/* A language: on or off, and it shows which without a reload. */
.xc-langchip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 13px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: rgba(var(--ink), .04);
    font-size: 13.5px;
    cursor: pointer;
    transition: background 160ms, border-color 160ms;
}

.xc-langchip input {
    margin: 0;
    inline-size: 14px;
    block-size: 14px;
    accent-color: #1C1CD2;
}

.xc-langchip:has(input:checked) {
    border-color: var(--peri);
    background: rgba(143, 143, 247, .14);
}

/* Not on the workspace's plan: shown, and not chosen. */
.xc-langchip:has(input:disabled) {
    opacity: .45;
    cursor: not-allowed;
}

/* Names typed into the instructions at the cursor (modules/insert.js). */

.xc-howto {
    border-radius: 12px;
    background: rgba(var(--brand), .05);
}

.xc-howto summary {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--peri);
    cursor: pointer;
}

.xc-howto summary::-webkit-details-marker { display: none; }

.xc-howto p {
    margin: 0;
    padding: 0 12px 12px 34px;
    font-size: 13px;
    line-height: 1.6;
    color: rgba(var(--ink), .62);
    text-wrap: pretty;
}

[dir="rtl"] .xc-howto p { padding: 0 34px 12px 12px; }

.xc-nevers {
    margin: 0;
    padding-inline-start: 18px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.xc-nevers li {
    font-size: 13px;
    color: rgba(var(--ink), .55);
    text-wrap: pretty;
}

/* ── making an agent ──────────────────────────────────────────────────
   A name and a role, on a card centred in the page. */

.xc-mk__label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.xc-mk__roles {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 0;
    padding: 0;
    border: 0;
    min-inline-size: 0;
}

.xc-mk__roles legend { padding: 0; margin-block-end: 10px; }

.xc-mk__attrs {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* The last thing on the card, which keeps what overflows it: the list opens
   upwards, over the roles, rather than below the edge. */
.xc-mk__attrs .xc-attrpick__menu {
    inset-block-start: auto;
    inset-block-end: calc(100% + 6px);
}

.xc-role {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.xc-role__one {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 18px;
    border: 1.5px solid var(--line);
    border-radius: 16px;
    background: var(--surface);
    cursor: pointer;
    transition: border-color 160ms, background 160ms, box-shadow 160ms;
}

.xc-role__one input {
    position: absolute;
    inline-size: 1px;
    block-size: 1px;
    opacity: 0;
    pointer-events: none;
}

.xc-role__one:hover { border-color: rgba(var(--brand), .35); }

.xc-role__one:has(input:checked) {
    border-color: var(--peri);
    background: rgba(var(--brand), .05);
    box-shadow: 0 0 0 3px rgba(var(--brand), .1);
}

.xc-role__one:has(input:focus-visible) {
    outline: 2px solid var(--peri);
    outline-offset: 2px;
}

.xc-role__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    inline-size: 36px;
    block-size: 36px;
    border-radius: 11px;
    background: rgba(var(--ink), .05);
    color: rgba(var(--ink), .6);
    transition: background 160ms, color 160ms;
}

.xc-role__one:has(input:checked) .xc-role__icon {
    background: var(--grad);
    color: #fff;
}

.xc-role__title {
    font-size: 14.5px;
    font-weight: 600;
}

.xc-role__sub {
    font-size: 12.8px;
    line-height: 1.5;
    color: rgba(var(--ink), .52);
    text-wrap: pretty;
}

/* ── the Settings tabs, and the header's end ─────────────────────────── */

.xc-agtabs {
    flex: 1;
    min-inline-size: 200px;
    display: flex;
    align-items: flex-end;
    gap: 22px;
    align-self: stretch;
    margin-block: -16px;
}

.xc-agtabs__one {
    display: inline-flex;
    align-items: center;
    padding-block: 18px 15px;
    border-block-end: 2.5px solid transparent;
    font-family: Poppins, sans-serif;
    font-weight: 600;
    font-size: 15px;
    text-decoration: none;
    color: rgba(var(--ink), .45);
    transition: color 140ms, border-color 140ms;
}

.xc-agtabs__one:hover { color: var(--text); }

.xc-agtabs__one[data-on] {
    color: var(--text);
    border-block-end-color: var(--peri);
}

.xc-rephead__end {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-inline-start: auto;
}

/* ── how it speaks ───────────────────────────────────────────────────── */

.xc-tonepills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.xc-tonepill {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 14px;
    border: 1.5px solid var(--line);
    border-radius: 11px;
    background: var(--surface);
    font-size: 13.8px;
    font-weight: 500;
    color: rgba(var(--ink), .7);
    cursor: pointer;
    transition: border-color 150ms, background 150ms, color 150ms;
}

.xc-tonepill input {
    position: absolute;
    inline-size: 1px;
    block-size: 1px;
    opacity: 0;
    pointer-events: none;
}

.xc-tonepill:hover { border-color: rgba(var(--brand), .35); }

.xc-tonepill:has(input:checked) {
    border-color: var(--peri);
    background: rgba(var(--brand), .06);
    color: var(--text);
}

.xc-tonepill:has(input:focus-visible) {
    outline: 2px solid var(--peri);
    outline-offset: 2px;
}

/* What the chosen tone means: only the one whose pill is on. */
.xc-tonesay { display: none; }

.xc-f:has(.xc-tonepill input[value="professional"]:checked) .xc-tonesay[data-tone="professional"],
.xc-f:has(.xc-tonepill input[value="humorous"]:checked) .xc-tonesay[data-tone="humorous"],
.xc-f:has(.xc-tonepill input[value="casual"]:checked) .xc-tonesay[data-tone="casual"],
.xc-f:has(.xc-tonepill input[value="friendly"]:checked) .xc-tonesay[data-tone="friendly"] { display: block; }

/* A hint that starts with a small (i). */
.xc-hintline {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    text-wrap: pretty;
}

.xc-hintline svg { flex: none; margin-block-start: 2px; }

/* ── under the instructions: variables, and prompt templates ─────────── */

.xc-ins {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}

.xc-dd {
    position: relative;
}

.xc-dd__open {
    list-style: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    font-size: 13px;
    font-weight: 600;
    color: rgba(var(--ink), .78);
    cursor: pointer;
    transition: border-color 140ms, background 140ms, color 140ms;
}

.xc-dd__open::-webkit-details-marker { display: none; }

.xc-dd__open:hover,
.xc-dd[open] > .xc-dd__open {
    border-color: var(--peri);
    background: rgba(var(--brand), .05);
    color: var(--peri);
}

.xc-dd > summary { list-style: none; }
.xc-dd > summary::-webkit-details-marker { display: none; }

.xc-dd__menu {
    position: absolute;
    inset-block-start: calc(100% + 6px);
    inset-inline-start: 0;
    z-index: 30;
    inline-size: max-content;
    min-inline-size: 220px;
    max-inline-size: min(360px, 86vw);
    max-block-size: 320px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: var(--surface);
    box-shadow: 0 16px 38px rgba(var(--scrim), .16);
}

.xc-dd--end .xc-dd__menu {
    inset-inline-start: auto;
    inset-inline-end: 0;
}

.xc-dd__menu--wide { inline-size: min(380px, 86vw); }

.xc-dd__one {
    appearance: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    inline-size: 100%;
    padding: 9px 11px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    font: inherit;
    font-size: 13.4px;
    text-align: start;
    text-decoration: none;
    color: var(--text);
    cursor: pointer;
}

.xc-dd__one:hover,
.xc-dd__one:focus-visible { background: rgba(var(--ink), .05); outline: none; }

.xc-dd__one--bad { color: #B83636; }
.xc-dd__one--bad:hover { background: rgba(214, 69, 69, .08); }

.xc-dd__tag {
    flex: none;
    padding: 2px 8px;
    border-radius: 20px;
    background: rgba(var(--ink), .07);
    font-size: 11px;
    color: rgba(var(--ink), .55);
}

/* A prompt template: its name, and the start of what it says. */
.xc-dd__one--tpl {
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
}

.xc-dd__one--tpl strong { font-size: 13.6px; }

.xc-dd__one--tpl span {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 12.3px;
    line-height: 1.45;
    color: rgba(var(--ink), .5);
}

/* The menus on the left of the row, together. */
.xc-ins__left {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* A menu's search, stuck to its top while the rows scroll. */
.xc-dd__search {
    appearance: none;
    position: sticky;
    inset-block-start: -6px;
    z-index: 1;
    margin: -6px -6px 4px;
    padding: 10px 12px;
    border: 0;
    border-block-end: 1px solid var(--line);
    border-radius: 13px 13px 0 0;
    background: var(--surface);
    font: inherit;
    font-size: 13.2px;
    color: var(--text);
    outline: none;
}

.xc-dd__head {
    display: block;
    padding: 8px 11px 3px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 9.5px;
    letter-spacing: .13em;
    text-transform: uppercase;
    color: rgba(var(--ink), .4);
}

.xc-dd__empty {
    margin: 0;
    padding: 10px 11px;
    font-size: 12.6px;
    color: rgba(var(--ink), .45);
}

.xc-dd__one[hidden],
.xc-dd__head[hidden] { display: none; }

.xc-dd__tags {
    display: inline-flex;
    gap: 5px;
    flex: none;
}

.xc-dd__tag--line {
    background: transparent;
    box-shadow: inset 0 0 0 1px var(--line);
}

.xc-dd__one--new,
.xc-dd__one--go { color: var(--peri); }

.xc-dd__one--new { font-weight: 600; }

/* ── actions: what the agent may do besides writing ───────────────────── */

.xc-agacts {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.xc-agact {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(var(--ink), .018);
    transition: border-color 160ms, background 160ms;
}

.xc-agact:has(.xc-agact__switch input:checked) {
    border-color: rgba(var(--brand), .28);
    background: rgba(var(--brand), .03);
}

.xc-agact__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
}

.xc-agact__said {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-inline-size: 0;
}

.xc-agact__said strong {
    font-size: 14.6px;
    font-weight: 600;
}

.xc-agact__said span {
    font-size: 12.9px;
    line-height: 1.5;
    color: rgba(var(--ink), .55);
    text-wrap: pretty;
}

/* The switch: a checkbox, drawn as one. Off posts the hidden 0 before it. */
.xc-agact__switch {
    position: relative;
    flex: none;
    margin-block-start: 2px;
    cursor: pointer;
}

.xc-agact__switch input[type="checkbox"] {
    position: absolute;
    inset: 0;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}

.xc-agact__track {
    position: relative;
    display: block;
    inline-size: 38px;
    block-size: 22px;
    border-radius: 12px;
    background: rgba(var(--ink), .18);
    transition: background 180ms;
}

.xc-agact__track::after {
    content: "";
    position: absolute;
    inset-block-start: 3px;
    inset-inline-start: 3px;
    inline-size: 16px;
    block-size: 16px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(var(--scrim), .25);
    transition: inset-inline-start 200ms cubic-bezier(.2, .8, .25, 1);
}

.xc-agact__switch input:checked + .xc-agact__track { background: var(--grad); }
.xc-agact__switch input:checked + .xc-agact__track::after { inset-inline-start: 19px; }
.xc-agact__switch input:focus-visible + .xc-agact__track { outline: 2px solid var(--peri); outline-offset: 2px; }

/* The four that always hand over, under Escalate. */
.xc-agact__rules {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-block-start: 12px;
    border-block-start: 1px dashed var(--line);
}

.xc-agact__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.xc-agact__chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 11px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: var(--surface);
    font-size: 12.8px;
    cursor: pointer;
}

.xc-agact__chip input {
    margin: 0;
    accent-color: var(--amber);
}

.xc-agact__chip:has(input:checked) {
    border-color: rgba(232, 163, 61, .45);
    background: rgba(232, 163, 61, .08);
}

/* ── which contact attributes it may save ─────────────────────────────── */

.xc-attrpick__open {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--surface-2);
    font-size: 13.6px;
    cursor: pointer;
}

.xc-attrpick[open] > .xc-attrpick__open { border-color: var(--peri); }

.xc-attrpick__said {
    min-inline-size: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.xc-attrpick__said[data-empty] { color: rgba(var(--ink), .45); }

.xc-attrpick__menu {
    inline-size: 100%;
    max-inline-size: none;
}

.xc-attrpick__one { cursor: pointer; }

.xc-attrpick__tick {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    min-inline-size: 0;
}

.xc-attrpick__tick input {
    margin: 0;
    accent-color: var(--acc);
}

/* ── knowledge ────────────────────────────────────────────────────────── */

.xc-kn {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.xc-kn__bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 9px;
}

.xc-kn__search {
    flex: 1 1 200px;
    inline-size: auto;
    max-inline-size: 280px;
}

.xc-kn__pick select {
    appearance: none;
    padding: 8px 32px 8px 12px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--surface-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a8a99' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 11px center;
    font: inherit;
    font-size: 13.2px;
    color: var(--text);
    cursor: pointer;
}

[dir="rtl"] .xc-kn__pick select {
    padding: 8px 12px 8px 32px;
    background-position: left 11px center;
}

.xc-kn__add { margin-inline-start: auto; }

.xc-kn__card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 18px 20px;
    /* The table fits the room it has, beside the preview or without it. */
    container-type: inline-size;
}

.xc-kn__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-block-size: 34px;
}

.xc-kn__top strong {
    font-family: Poppins, sans-serif;
    font-size: 15px;
}

.xc-kn__wipe {
    appearance: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border: 1px solid rgba(214, 69, 69, .35);
    border-radius: 10px;
    background: transparent;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    color: #B83636;
    cursor: pointer;
    transition: background 140ms;
}

.xc-kn__wipe:hover { background: rgba(214, 69, 69, .08); }

.xc-kn__empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 9px;
    padding: 44px 16px 36px;
    text-align: center;
}

.xc-kn__empty strong { font-size: 15px; }

.xc-kn__empty span:not(.xc-kn__emptyart) {
    max-inline-size: 440px;
    font-size: 13.2px;
    line-height: 1.55;
    color: rgba(var(--ink), .5);
    text-wrap: pretty;
}

.xc-kn__emptyart {
    display: flex;
    align-items: center;
    justify-content: center;
    inline-size: 76px;
    block-size: 76px;
    margin-block-end: 4px;
    border-radius: 24px;
    background: rgba(var(--brand), .07);
    color: var(--peri);
}

.xc-kn__rows {
    display: flex;
    flex-direction: column;
    overflow-x: auto;
}

.xc-kn__head,
.xc-kn__row {
    display: grid;
    grid-template-columns: 34px minmax(190px, 1.5fr) minmax(140px, 1.2fr) 96px 108px 150px 72px;
    align-items: center;
    gap: 12px;
    min-inline-size: 860px;
    padding: 11px 4px;
}

/* Narrower: the description goes first — the name says what it is — then
   the type, which the row's icon and its line under the name say too. Each
   before its columns stop fitting: all seven need 862px, six need 646px. */
@container (max-width: 880px) {
    .xc-kn__head,
    .xc-kn__row {
        grid-template-columns: 30px minmax(160px, 1fr) 88px 104px 140px 64px;
        min-inline-size: 0;
    }

    .xc-kn__head > :nth-child(3),
    .xc-kn__row > :nth-child(3) { display: none; }
}

@container (max-width: 660px) {
    .xc-kn__head,
    .xc-kn__row { grid-template-columns: 30px minmax(140px, 1fr) 96px 132px 60px; }

    .xc-kn__head > :nth-child(4),
    .xc-kn__row > :nth-child(4) { display: none; }
}

.xc-kn__head {
    padding-block: 8px;
    border-radius: 10px;
    background: rgba(var(--ink), .035);
    font-size: 12.5px;
    font-weight: 600;
    color: rgba(var(--ink), .55);
}

.xc-kn__row { border-block-end: 1px solid var(--line); }
.xc-kn__row:last-child { border-block-end: 0; }
.xc-kn__row:hover { background: rgba(var(--ink), .018); }

.xc-kn__name {
    display: flex;
    align-items: center;
    gap: 10px;
    min-inline-size: 0;
}

.xc-kn__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    inline-size: 32px;
    block-size: 32px;
    flex: none;
    border-radius: 10px;
    background: rgba(var(--brand), .08);
    color: var(--peri);
}

.xc-kn__icon[data-type="online"] { background: rgba(0, 168, 134, .1); color: var(--green); }
.xc-kn__icon[data-type="qa"] { background: rgba(232, 163, 61, .13); color: var(--amber); }
.xc-kn__icon[data-type="attachment"] { background: rgba(154, 73, 214, .1); color: #9A49D6; }

/* An attachment that is a picture shows itself. */
.xc-kn__thumb {
    inline-size: 40px;
    block-size: 40px;
    flex: none;
    border-radius: 9px;
    object-fit: cover;
    background: rgba(var(--ink), .06);
    box-shadow: inset 0 0 0 1px var(--line);
}

.xc-kn__said {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-inline-size: 0;
}

.xc-kn__title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13.8px;
    font-weight: 600;
    unicode-bidi: plaintext;
}

.xc-kn__meta {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 11.8px;
    color: rgba(var(--ink), .42);
}

.xc-kn__desc {
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    font-size: 12.8px;
    line-height: 1.45;
    color: rgba(var(--ink), .6);
}

.xc-kn__type,
.xc-kn__when {
    font-size: 12.8px;
    color: rgba(var(--ink), .6);
}

.xc-kn__state {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
    min-inline-size: 0;
}

.xc-kn__pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 20px;
    background: rgba(var(--ink), .07);
    font-size: 12px;
    font-weight: 600;
    color: rgba(var(--ink), .65);
}

.xc-kn__pill[data-state="failed"] {
    background: rgba(214, 69, 69, .1);
    color: #B83636;
}

.xc-kn__spin {
    inline-size: 10px;
    block-size: 10px;
    border: 2px solid currentColor;
    border-inline-end-color: transparent;
    border-radius: 50%;
    animation: xc-kn-spin .8s linear infinite;
}

@keyframes xc-kn-spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
    .xc-kn__spin { animation: none; }
}

.xc-kn__why {
    flex-basis: 100%;
    font-size: 11.5px;
    line-height: 1.4;
    color: rgba(var(--ink), .5);
}

/* "Used": a switch, on or off. */
.xc-kn__switch {
    appearance: none;
    position: relative;
    inline-size: 34px;
    block-size: 20px;
    flex: none;
    padding: 0;
    border: 0;
    border-radius: 20px;
    background: rgba(var(--ink), .2);
    cursor: pointer;
    transition: background 160ms;
}

.xc-kn__switch[aria-checked="true"] { background: var(--grad); }

.xc-kn__knob {
    position: absolute;
    inset-block-start: 2px;
    inset-inline-start: 2px;
    inline-size: 16px;
    block-size: 16px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
    transition: inset-inline-start 160ms;
}

.xc-kn__switch[aria-checked="true"] .xc-kn__knob { inset-inline-start: 16px; }

.xc-kn__switch:focus-visible {
    outline: 2px solid var(--peri);
    outline-offset: 2px;
}

.xc-kn__onoff {
    font-size: 12.5px;
    color: rgba(var(--ink), .65);
}

.xc-kn__warn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    inline-size: 17px;
    block-size: 17px;
    border-radius: 50%;
    background: rgba(232, 163, 61, .18);
    font-size: 11px;
    font-weight: 700;
    color: var(--amber);
    cursor: help;
}

.xc-kn__acts {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
}

.xc-kn__acts .xc-dd > summary { list-style: none; }

.xc-kn__foot {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 12px;
    padding-block-start: 8px;
}

.xc-kn__foot .xc-pager { margin-inline-end: auto; }

.xc-kn__goto label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: rgba(var(--ink), .6);
}

.xc-kn__goto input {
    inline-size: 64px;
    padding: 7px 9px;
}

/* ── adding knowledge ────────────────────────────────────────────────── */

.xc-kn__kinds {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.xc-kn__kind {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    border: 1.5px solid var(--line);
    border-radius: 15px;
    background: var(--surface);
    cursor: pointer;
    transition: border-color 160ms, background 160ms, box-shadow 160ms;
}

.xc-kn__kind input {
    position: absolute;
    inline-size: 1px;
    block-size: 1px;
    opacity: 0;
    pointer-events: none;
}

.xc-kn__kind:hover { border-color: rgba(var(--brand), .35); }

.xc-kn__kind:has(input:checked) {
    border-color: var(--peri);
    background: rgba(var(--brand), .05);
    box-shadow: 0 0 0 3px rgba(var(--brand), .1);
}

.xc-kn__kind:has(input:focus-visible) {
    outline: 2px solid var(--peri);
    outline-offset: 2px;
}

.xc-kn__kindicon {
    display: flex;
    align-items: center;
    justify-content: center;
    inline-size: 36px;
    block-size: 36px;
    flex: none;
    border-radius: 11px;
    background: rgba(var(--ink), .05);
    color: rgba(var(--ink), .6);
}

.xc-kn__kind:has(input:checked) .xc-kn__kindicon {
    background: var(--grad);
    color: #fff;
}

.xc-kn__kindsaid {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-inline-size: 0;
}

.xc-kn__kindsaid strong { font-size: 14.5px; }

.xc-kn__kindsaid span {
    font-size: 12.8px;
    line-height: 1.5;
    color: rgba(var(--ink), .55);
    text-wrap: pretty;
}

.xc-kn__kindsaid b {
    font-weight: 600;
    color: rgba(var(--ink), .8);
}

.xc-kn__kindsaid .xc-kn__new {
    display: inline-block;
    margin-inline-start: 6px;
    padding: 1px 8px;
    border-radius: 20px;
    background: rgba(0, 168, 134, .14);
    font-size: 11px;
    font-weight: 600;
    line-height: 1.6;
    color: var(--green);
    vertical-align: middle;
}

.xc-kn__next {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-block-start: 16px;
}

.xc-kn__form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.xc-kn__info {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 0;
    padding: 10px 12px;
    border: 1px solid rgba(var(--brand), .25);
    border-radius: 11px;
    background: rgba(var(--brand), .06);
    font-size: 12.8px;
    line-height: 1.5;
    color: rgba(var(--ink), .75);
    text-wrap: pretty;
}

.xc-kn__info svg { flex: none; margin-block-start: 2px; color: var(--peri); }

.xc-kn__upload {
    pointer-events: none;
    margin-block: 4px;
}

.xc-kn__files {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.xc-kn__files:empty { display: none; }

/* An attachment's window: the file and its words, and the limits beside. */
.xc-kn__att {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(220px, 1fr);
    gap: 20px;
    align-items: start;
}

.xc-kn__setup {
    margin: 0;
    font-family: Poppins, sans-serif;
    font-size: 15.5px;
    font-weight: 600;
}

.xc-kn__limits {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 16px;
    border-radius: 14px;
    background: rgba(var(--ink), .035);
    font-size: 12.8px;
}

.xc-kn__limits strong { font-size: 14px; }
.xc-kn__limits > span { color: rgba(var(--ink), .55); }

.xc-kn__limits dl {
    display: flex;
    flex-direction: column;
    margin: 6px 0 0;
}

.xc-kn__limits dl div {
    padding-block: 9px;
    border-block-end: 1px solid var(--line);
}

.xc-kn__limits dl div:last-child { border-block-end: 0; }
.xc-kn__limits dt { font-size: 12.8px; font-weight: 600; }

.xc-kn__limits dd {
    margin: 3px 0 0;
    color: rgba(var(--ink), .6);
}

@media (max-width: 720px) {
    .xc-kn__att { grid-template-columns: 1fr; }
}

/* ── an agent's version history ───────────────────────────────────────── */

.xc-agvers {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.xc-agver {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 13px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
}

.xc-agver[data-live] {
    border-color: rgba(0, 168, 134, .35);
    background: rgba(0, 168, 134, .05);
}

.xc-agver__num {
    flex: none;
    min-inline-size: 34px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    font-weight: 600;
    color: var(--peri);
}

.xc-agver__said {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 2px;
    min-inline-size: 0;
}

.xc-agver__said strong { font-size: 13.6px; }

.xc-agver__said > span {
    font-size: 12px;
    color: rgba(var(--ink), .5);
}

.xc-agver__tags {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 5px;
}

.xc-agver__tag {
    padding: 2px 8px;
    border-radius: 20px;
    background: rgba(var(--ink), .07);
    font-size: 11px;
    color: rgba(var(--ink), .6);
}

.xc-agver__tag[data-live] {
    background: rgba(0, 168, 134, .14);
    color: var(--green);
    font-weight: 600;
}

/* ── recommendation: what it could not answer ─────────────────────────── */

.xc-recs {
    display: flex;
    flex-direction: column;
}

.xc-rec {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding-block: 13px;
    border-block-end: 1px solid var(--line);
}

.xc-rec:last-child { border-block-end: 0; }

.xc-rec__said {
    display: flex;
    flex: 1 1 280px;
    flex-direction: column;
    gap: 4px;
    min-inline-size: 0;
}

.xc-rec__asked {
    font-size: 14.2px;
    font-weight: 500;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.xc-rec__meta {
    font-size: 12.2px;
    color: rgba(var(--ink), .5);
}

.xc-rec__meta a { color: var(--peri); }

.xc-rec__acts {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: none;
}

/* ── skills: the list, and one being written ──────────────────────────── */

.xc-skl__rows {
    display: flex;
    flex-direction: column;
    container-type: inline-size;
}

.xc-skl__head,
.xc-skl__row {
    display: grid;
    grid-template-columns: minmax(140px, 1.1fr) minmax(160px, 2fr) 110px 132px 72px;
    align-items: center;
    gap: 12px;
    padding: 11px 4px;
    border-block-end: 1px solid var(--line);
}

.xc-skl__head {
    padding-block: 9px;
    font-size: 12.2px;
    font-weight: 600;
    color: rgba(var(--ink), .5);
}

.xc-skl__row:last-child { border-block-end: 0; }

.xc-skl__trigger {
    min-inline-size: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
    color: rgba(var(--ink), .6);
}

@container (max-width: 620px) {
    .xc-skl__head,
    .xc-skl__row { grid-template-columns: minmax(140px, 1fr) 132px 72px; }

    .xc-skl__head > :nth-child(2),
    .xc-skl__row > :nth-child(2),
    .xc-skl__head > :nth-child(3),
    .xc-skl__row > :nth-child(3) { display: none; }
}

.xc-skl__crumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 14px;
    color: rgba(var(--ink), .55);
}

.xc-skl__crumb a { color: inherit; text-decoration: none; }
.xc-skl__crumb a:hover { color: var(--peri); }
.xc-skl__crumb strong { color: var(--text); }

.xc-skl__back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    inline-size: 30px;
    block-size: 30px;
    border-radius: 9px;
}

.xc-skl__back:hover { background: rgba(var(--ink), .06); }

.xc-skl__badge {
    padding: 2px 9px;
    border-radius: 20px;
    background: rgba(var(--ink), .08);
    font-size: 11.5px;
    font-weight: 600;
    color: rgba(var(--ink), .6);
}

.xc-skl__badge[data-on] {
    background: rgba(0, 168, 134, .14);
    color: var(--green);
}

.xc-skl {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 22px 24px;
}

.xc-skl__title {
    appearance: none;
    padding: 4px 0;
    border: 0;
    border-block-end: 1px solid transparent;
    background: transparent;
    font-family: Poppins, sans-serif;
    font-size: 20px;
    font-weight: 600;
    color: var(--text);
    outline: none;
}

.xc-skl__title:focus { border-block-end-color: var(--peri); }

.xc-skl__part {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-block-start: 18px;
    border-block-start: 1px solid var(--line);
}

.xc-skl__h {
    margin: 0;
    font-size: 15.5px;
    font-weight: 600;
}

.xc-skl__sub {
    margin: 0;
    font-size: 12.8px;
    color: rgba(var(--ink), .55);
    text-wrap: pretty;
}

.xc-skl__foot {
    display: flex;
    justify-content: flex-end;
}

.xc-skl__delete {
    display: flex;
    justify-content: flex-end;
}

/* ── several questions and their answers, one under the other ─────────── */

.xc-kn__pairs {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.xc-kn__pair {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.xc-kn__pair + .xc-kn__pair {
    padding-block-start: 16px;
    border-block-start: 1px dashed var(--line);
}

.xc-kn__pairout {
    position: absolute;
    inset-block-start: 12px;
    inset-inline-end: 0;
}

/* ── making an agent, in a pop-up ─────────────────────────────────────── */

.xc-agentnew {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

/* The attributes open in place: a list floating over the window's edge
   would be cut off by it. */
.xc-agentnew .xc-attrpick__menu {
    position: static;
    margin-block-start: 6px;
    max-block-size: 260px;
    box-shadow: none;
}

.xc-kn__note {
    margin: 0;
    font-size: 12.5px;
    color: rgba(var(--ink), .5);
}

.xc-kn__list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.xc-kn__line {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.xc-kn__line > .xc-field,
.xc-kn__line > .xc-counted { flex: 1; min-inline-size: 0; }

.xc-kn__line > .xc-f__err { flex-basis: 100%; }

.xc-kn__line .xc-field[aria-invalid="true"] {
    border-color: #D64545;
    box-shadow: 0 0 0 3px rgba(214, 69, 69, .12);
}

.xc-kn__more {
    appearance: none;
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 4px;
    border: 0;
    background: transparent;
    font: inherit;
    font-size: 13.2px;
    font-weight: 600;
    color: var(--peri);
    cursor: pointer;
}

.xc-kn__more:hover { text-decoration: underline; }

@media (max-width: 720px) {
    .xc-role,
    .xc-kn__kinds { grid-template-columns: minmax(0, 1fr); }

    .xc-kn__search { inline-size: 100%; flex: 1 1 100%; }
    .xc-kn__add { margin-inline-start: 0; }
}

/* ── performance ──────────────────────────────────────────────────────── */

.xc-rangepick {
    padding: 7px 12px;
    border: 1px solid var(--line);
    border-radius: 20px;
    font-size: 13px;
    text-decoration: none;
    white-space: nowrap;
    color: rgba(var(--ink), .6);
    transition: border-color 140ms, color 140ms;
}

.xc-rangepick:hover {
    border-color: var(--peri);
    color: var(--text);
}

.xc-rangepick[data-on] {
    border-color: var(--mine);
    background: var(--mine);
    color: var(--onmine);
    font-weight: 600;
}

.xc-perf-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 52px 24px;
    text-align: center;
}

.xc-perf-empty p {
    margin: 0;
    max-inline-size: 46ch;
    font-size: 14px;
    line-height: 1.6;
    color: rgba(var(--ink), .5);
    text-wrap: pretty;
}

.xc-perf-tiles {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.xc-perf-tile {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 15px 16px;
    box-shadow: inset 0 3px 0 rgb(var(--tint));
}

.xc-perf-tile__n {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 500;
    font-size: 26px;
    line-height: 1;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}

.xc-perf-tile__sub {
    font-size: 12.8px;
    color: rgba(var(--ink), .45);
}

.xc-perf-key {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    color: rgba(var(--ink), .55);
}

.xc-perf-key i {
    inline-size: 9px;
    block-size: 9px;
    border-radius: 3px;
}

.xc-perf-why {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.xc-perf-why__top {
    display: flex;
    align-items: baseline;
    gap: 10px;
    font-size: 13.3px;
}

.xc-perf-why__top > span:first-child {
    flex: 1;
    min-inline-size: 0;
}

.xc-perf-why__n {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: rgba(var(--ink), .55);
}

.xc-perf-turn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 11px;
    text-decoration: none;
    color: inherit;
    transition: background 140ms;
}

.xc-perf-turn:hover { background: rgba(var(--ink), .04); }

.xc-perf-turn__who {
    flex: none;
    max-inline-size: 40%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
    font-size: 13.5px;
}

.xc-perf-turn__why {
    flex: 1;
    min-inline-size: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12.8px;
    color: rgba(var(--ink), .55);
}

.xc-perf-turn__at {
    flex: none;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10.5px;
    color: rgba(var(--ink), .35);
}

/* ── the preview ──────────────────────────────────────────────────────── */

.xc-preview {
    inline-size: 372px;
    flex: none;
    min-block-size: 0;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--surface);
}

[data-preview-closed] .xc-preview { display: none; }

.xc-preview__head {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 10px 12px 18px;
    border-block-end: 1px solid var(--line);
}

[dir="rtl"] .xc-preview__head { padding: 12px 18px 12px 10px; }

.xc-preview__title {
    flex: 1;
    min-inline-size: 0;
    display: flex;
    align-items: baseline;
    gap: 10px;
    font-family: Poppins, sans-serif;
    font-weight: 600;
    font-size: 16px;
}

.xc-preview__icon {
    appearance: none;
    inline-size: 34px;
    block-size: 34px;
    border: 0;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: rgba(var(--ink), .55);
    cursor: pointer;
    transition: background 140ms, color 140ms;
}

.xc-preview__icon:hover {
    background: rgba(var(--ink), .06);
    color: var(--text);
}

.xc-preview__head form { display: flex; }

.xc-preview__log {
    flex: 1;
    min-block-size: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px 14px;
    background: rgba(var(--ink), .02);
}

.xc-preview__empty {
    margin-block: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 9px;
    padding: 20px 10px;
    text-align: center;
}

.xc-preview__empty strong {
    font-size: 14px;
    font-weight: 600;
    text-wrap: balance;
}

.xc-preview__empty span:last-child {
    font-size: 12.8px;
    line-height: 1.55;
    color: rgba(var(--ink), .45);
    text-wrap: pretty;
}

/* The orb: the agent, waiting to be spoken to, before the preview's first
   question. */
.xc-orb {
    display: grid;
    place-items: center;
    inline-size: 96px;
    block-size: 96px;
    margin-block-end: 6px;
    border-radius: 50%;
    background:
        radial-gradient(circle at 32% 28%, rgba(255, 255, 255, .95) 0 7%, transparent 30%),
        radial-gradient(circle at 72% 70%, rgba(255, 128, 204, .55), transparent 55%),
        radial-gradient(circle at 24% 76%, rgba(96, 224, 255, .6), transparent 55%),
        conic-gradient(from 210deg, #8F8FF7, #C9A7FF, #7FE3F2, #F2A7E0, #8F8FF7);
    box-shadow: 0 18px 44px rgba(91, 91, 240, .32), inset 0 -8px 20px rgba(28, 28, 210, .22);
    animation: xc-orb 7s ease-in-out infinite;
}

@keyframes xc-orb {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-4px) rotate(10deg); }
}

/* Our mark at its heart, kept upright while the orb turns. */
.xc-orb__mark {
    filter: drop-shadow(0 2px 8px rgba(28, 28, 210, .45));
    animation: xc-orb-mark 7s ease-in-out infinite;
}

@keyframes xc-orb-mark {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(-10deg); }
}

@media (prefers-reduced-motion: reduce) {
    .xc-orb,
    .xc-orb__mark { animation: none; }
}

.xc-preview__err {
    margin: 0;
    padding: 8px 16px 0;
    font-size: 12.5px;
    color: #b83636;
}

.xc-preview__compose {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 12px;
    padding: 5px 5px 5px 14px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface);
    transition: border-color 160ms;
}

[dir="rtl"] .xc-preview__compose { padding: 5px 14px 5px 5px; }

.xc-preview__compose:focus-within { border-color: var(--peri); }

.xc-preview__compose input[type="text"] {
    flex: 1;
    min-inline-size: 0;
    padding-block: 8px;
    border: 0;
    outline: none;
    background: transparent;
    font: inherit;
    font-size: 14px;
    color: var(--text);
}

.xc-preview__compose button {
    appearance: none;
    inline-size: 36px;
    block-size: 36px;
    flex: none;
    border: 0;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--grad);
    color: #fff;
    cursor: pointer;
}

[dir="rtl"] .xc-preview__compose button svg { transform: scaleX(-1); }

.xc-preview__note {
    margin: 0;
    padding: 0 16px 14px;
    font-size: 11.8px;
    line-height: 1.5;
    color: rgba(var(--ink), .4);
    text-wrap: pretty;
}

/* A line of the conversation: the customer on the start side, the agent on
   the end side, as the inbox has them. */
.xc-pv {
    max-inline-size: 88%;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.xc-pv--them {
    align-self: flex-start;
    align-items: flex-start;
}

.xc-pv--agent {
    align-self: flex-end;
    align-items: flex-end;
}

.xc-pv__bubble {
    padding: 9px 12px;
    border-radius: 14px;
    font-size: 13.8px;
    line-height: 1.5;
    white-space: pre-line;
    overflow-wrap: anywhere;
    unicode-bidi: plaintext;
    text-wrap: pretty;
}

.xc-pv--them .xc-pv__bubble {
    border: 1px solid var(--line);
    border-end-start-radius: 5px;
    background: var(--surface);
}

.xc-pv--agent .xc-pv__bubble {
    border: 1px solid rgba(var(--brand), .16);
    border-end-end-radius: 5px;
    background: rgba(var(--brand), .09);
}

/* A draft the guard stopped: in the thread, and marked. */
.xc-pv[data-held] .xc-pv__bubble {
    border-color: rgba(232, 163, 61, .3);
    background: rgba(232, 163, 61, .1);
}

.xc-pv__who {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    font-weight: 600;
    color: rgba(var(--ink), .55);
}

/* The robot, on a disc in the agent's own tint — as every messenger
   draws the one answering, and as the agent's card is coloured. */
.xc-pv__mark {
    inline-size: 22px;
    block-size: 22px;
    flex: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #FFFFFF;
    background: var(--accent, #5B5BF0);
}

/* While it works: the three dots, and what it is doing beside them. */
.xc-pv__bubble--typing {
    display: flex;
    align-items: center;
    gap: 8px;
}

.xc-pv__status {
    font-size: 12px;
    color: rgba(var(--ink), .55);
}

.xc-pv__none { color: rgba(var(--ink), .5); }

.xc-pv__note {
    font-size: 11.5px;
    line-height: 1.45;
    text-align: end;
    color: #C8791A;
    text-wrap: pretty;
}

.xc-pv__meta {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    color: rgba(var(--ink), .35);
}

/* What the agent would have done besides replying: said, not done. */
.xc-pv__did {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.xc-pv__did li {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    padding: 6px 9px;
    border-radius: 9px;
    background: rgba(var(--brand), .06);
    font-size: 11.8px;
    line-height: 1.45;
    color: rgba(var(--ink), .7);
    text-wrap: pretty;
}

.xc-pv__did li::before {
    content: "→";
    flex: none;
    color: var(--peri);
}

.xc-pv__did li:dir(rtl)::before { content: "←"; }

/* The buttons, or the link, a reply would have gone with. */
.xc-pv__shown {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.xc-pv__btn {
    padding: 5px 11px;
    border: 1px solid rgba(var(--brand), .25);
    border-radius: 999px;
    background: var(--surface);
    font-size: 12px;
    font-weight: 600;
    color: var(--peri);
    unicode-bidi: plaintext;
}

/* ── a voice note or a picture, going in ─────────────────────────────── */

/* The paperclip and the microphone, beside the send button and quieter than
   it. Two classes deep, because every button in the composer is drawn as the
   send button first. */
.xc-preview__compose .xc-pvtool {
    inline-size: 32px;
    block-size: 32px;
    border-radius: 10px;
    background: transparent;
    color: rgba(var(--ink), .5);
    transition: background 140ms, color 140ms;
}

.xc-preview__compose .xc-pvtool:hover {
    background: rgba(var(--ink), .06);
    color: var(--text);
}

[dir="rtl"] .xc-preview__compose .xc-pvtool svg { transform: none; }

.xc-preview__compose .xc-pvtool[hidden] { display: none; }

.xc-pvtool__stop { display: none; }

/* Recording: the microphone becomes the way to stop. */
.xc-preview__compose .xc-pvtool[data-recording] {
    background: rgba(214, 69, 69, .12);
    color: #D64545;
}

.xc-pvtool[data-recording] .xc-pvtool__mic { display: none; }
.xc-pvtool[data-recording] .xc-pvtool__stop { display: block; }

/* Waiting for an answer (modules/chat.js): the buttons rest until it lands.
   Not the send button while busy.js is turning it: that is the wait itself. */
.xc-preview__compose button:disabled {
    cursor: default;
}

.xc-preview__compose button:disabled:not([aria-busy="true"]) { opacity: .45; }

.xc-preview__compose .xc-pvtool:disabled:hover {
    background: transparent;
    color: rgba(var(--ink), .5);
}

/* What goes with the question, above the composer: its kind, its name, and
   the way to take it back. */
.xc-pvattach {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 10px 12px -4px;
    padding: 6px 6px 6px 10px;
    border: 1px solid rgba(var(--brand), .18);
    border-radius: 12px;
    background: rgba(var(--brand), .06);
    font-size: 12.8px;
}

[dir="rtl"] .xc-pvattach { padding: 6px 10px 6px 6px; }

.xc-pvattach[hidden] { display: none; }

.xc-pvattach__icon {
    display: flex;
    flex: none;
    color: var(--peri);
}

.xc-pvattach__icon svg { display: none; }
.xc-pvattach[data-kind="voice"] .xc-pvattach__icon [data-pv-icon="voice"],
.xc-pvattach[data-kind="image"] .xc-pvattach__icon [data-pv-icon="image"] { display: block; }

/* A voice note ready to go can be heard first: the play button takes the
   icon's place, and is a pause button while it plays. */
.xc-pvattach__play {
    appearance: none;
    display: none;
    flex: none;
    inline-size: 24px;
    block-size: 24px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    background: var(--mine);
    color: var(--onmine);
    cursor: pointer;
}

.xc-pvattach[data-playable]:not([data-recording]) .xc-pvattach__play { display: flex; }
.xc-pvattach[data-playable]:not([data-recording]) .xc-pvattach__icon { display: none; }

.xc-pvattach__play:focus-visible {
    outline: 2px solid var(--peri);
    outline-offset: 2px;
}

.xc-pvattach__hold,
.xc-pvattach[data-playing] .xc-pvattach__go { display: none; }

.xc-pvattach[data-playing] .xc-pvattach__hold { display: block; }

.xc-pvattach__name {
    flex: 1;
    min-inline-size: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    unicode-bidi: plaintext;
}

.xc-pvattach__time {
    flex: none;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: rgba(var(--ink), .5);
}

/* A recording in progress says so, the way every recorder does. */
.xc-pvattach[data-recording] .xc-pvattach__time { color: #D64545; }

.xc-pvattach[data-recording] .xc-pvattach__time::before {
    content: '';
    display: inline-block;
    inline-size: 7px;
    block-size: 7px;
    margin-inline-end: 6px;
    border-radius: 50%;
    background: #D64545;
    vertical-align: 1px;
    animation: xc-blink 1.1s ease-in-out infinite;
}

.xc-pvattach__x {
    appearance: none;
    inline-size: 24px;
    block-size: 24px;
    flex: none;
    border: 0;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: rgba(var(--ink), .5);
    cursor: pointer;
}

.xc-pvattach__x:hover {
    background: rgba(var(--ink), .07);
    color: var(--text);
}

/* A voice note to play, or the picture itself, in their line. */
.xc-pv__bubble--media {
    padding: 5px;
    line-height: 0;
}

.xc-pvaudio {
    display: block;
    inline-size: 250px;
    max-inline-size: 100%;
    block-size: 38px;
}

.xc-pvimg { display: block; }

.xc-pvimg img {
    display: block;
    max-inline-size: 220px;
    max-block-size: 220px;
    border-radius: 10px;
    object-fit: cover;
}

/* The file in their line of the transcript. */
.xc-pvfile {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    max-inline-size: 100%;
    color: var(--peri);
    font-size: 13px;
    font-weight: 500;
}

.xc-pvfile svg { flex: none; }

.xc-pvfile span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    unicode-bidi: plaintext;
}

/* ── what was heard ─────────────────────────────────────────────────────
 *
 * Under a voice note or a picture in the preview (components/heard): what
 * the reader made of it, labelled as the reader's, folded to one line.
 */

.xc-heard {
    display: block;
    min-inline-size: 0;
    max-inline-size: 100%;
    font-size: 13px;
    line-height: 1.5;
}

.xc-heard > summary {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 8px;
    min-inline-size: 0;
    border-radius: 8px;
    cursor: pointer;
    user-select: none;
}

.xc-heard > summary::-webkit-details-marker { display: none; }

.xc-heard > summary:focus-visible {
    outline: 2px solid var(--peri);
    outline-offset: 2px;
}

.xc-heard__label {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    flex: none;
    padding: 2px 8px 2px 6px;
    border-radius: 999px;
    background: rgba(var(--brand), .1);
    color: var(--peri);
    font-family: 'JetBrains Mono', monospace;
    font-size: 9.5px;
    font-weight: 500;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.xc-heard__meta {
    font-weight: 400;
    letter-spacing: .04em;
    text-transform: none;
    opacity: .75;
}

/* Spaced capitals break Arabic's joined letters apart. */
[dir="rtl"] .xc-heard__label {
    padding: 2px 6px 2px 8px;
    font-family: inherit;
    font-size: 11px;
    letter-spacing: 0;
}

/* No width of its own: folded, the line takes whatever room the file left
   and never widens the bubble to fit the whole transcript on one line. */
.xc-heard__peek {
    flex: 1 1 0;
    inline-size: 0;
    min-inline-size: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    unicode-bidi: plaintext;
    opacity: .72;
}

/* Open, the line it was folded to is the first line of what is below. */
.xc-heard[open] .xc-heard__peek { visibility: hidden; }

.xc-heard__chev {
    flex: none;
    opacity: .5;
    transition: transform 160ms;
}

.xc-heard[open] .xc-heard__chev { transform: rotate(180deg); }

.xc-heard__text {
    margin: 6px 0 0;
    padding: 7px 10px;
    border-inline-start: 2px solid rgba(var(--brand), .35);
    border-start-end-radius: 8px;
    border-end-end-radius: 8px;
    background: rgba(var(--ink), .035);
    color: var(--text);
    white-space: pre-line;
    overflow-wrap: anywhere;
    unicode-bidi: plaintext;
    text-align: start;
    text-wrap: pretty;
}

.xc-heard--failed {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--amber);
}

@media (prefers-reduced-motion: reduce) {
    .xc-pvattach[data-recording] .xc-pvattach__time::before { animation: none; }
}

/* ── narrower ─────────────────────────────────────────────────────────── */

/* No room for three columns: the preview comes out over the page, from the
   end side, and starts put away (modules/preview.js). */
@media (max-width: 1180px) {
    .xc-agentside { inline-size: 212px; }

    .xc-preview {
        position: absolute;
        z-index: 20;
        inset-block: 0 16px;
        inset-inline-end: 16px;
        box-shadow: 0 24px 60px rgba(var(--scrim), .3);
    }
}

/* A phone: everything in one column, the questions as a row to swipe, and
   the preview below the page rather than over it. */
@media (max-width: 820px) {
    .xc-agentside__tabs {
        flex-direction: row;
        overflow-x: auto;
        scrollbar-width: none;
    }

    .xc-agentside__tabs .xc-subnav__one { flex: none; }

    .xc-preview {
        position: static;
        inline-size: auto;
        min-block-size: 460px;
        box-shadow: none;
    }

    .xc-perf-tiles { grid-template-columns: minmax(0, 1fr); }
}

/* ── an agent's card, on the list ───────────────────────────────────────
 *
 * screens/studio/sections/agents, drawn as the canvas draws it: what it
 * speaks and when, three figures from its own turns, and a row of actions —
 * one wide, three square.
 */

.xc-agcard__chips {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.xc-agcard__chip {
    background: rgba(var(--ink), .06);
    color: rgba(var(--ink), .55);
    border-radius: 20px;
    padding: 3px 10px;
    font-size: 12.5px;
}

/* Pushed to the foot of the card, with the actions under it, so a row of
   cards lines its figures up even when one role wraps to two lines. */
.xc-agcard__stats {
    display: flex;
    gap: 10px;
    margin-block-start: auto;
}

.xc-agcard__stat {
    flex: 1;
    min-inline-size: 0;
    background: rgba(var(--ink), .04);
    border-radius: 12px;
    padding: 9px 11px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.xc-agcard__value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 16.5px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

.xc-agcard__label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 9.5px;
    letter-spacing: .1em;
    color: rgba(var(--ink), .38);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Arabic has no capitals to space out, and a monospace Latin face does not
   draw it: the labels take the page's own face there. */
html[lang="ar"] .xc-agcard__label {
    font-family: inherit;
    font-size: 11px;
    letter-spacing: normal;
}

.xc-agcard__acts {
    display: flex;
    align-items: center;
    gap: 7px;
    padding-block-start: 2px;
}

.xc-agcard__edit {
    flex: 1;
    justify-content: center;
    padding: 9px 13px;
    border-radius: 11px;
    font-size: 13.5px;
    text-decoration: none;
}

/* Copying is neither safe-green nor danger-red: it makes something new and
   touches nothing that exists. */
.xc-act--copy {
    color: #9A49D6;
    border-color: rgba(154, 73, 214, .32);
    background: rgba(154, 73, 214, .1);
}

.xc-act--copy:hover {
    background: rgba(154, 73, 214, .17);
    border-color: rgba(154, 73, 214, .5);
}
