/* ── 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); }

/* The tone: three cards, each saying what it sounds like. */
.xc-tones {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

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

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

.xc-tone__mark {
    inline-size: 32px;
    block-size: 32px;
    flex: none;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(var(--ink), .05);
    color: rgba(var(--ink), .5);
    transition: background 160ms, color 160ms;
}

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

.xc-tone__name {
    font-weight: 600;
    font-size: 14px;
}

.xc-tone__say {
    font-size: 12.3px;
    line-height: 1.4;
    color: rgba(var(--ink), .5);
}

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

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

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

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

/* 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);
}

/* Names typed into the instructions at the cursor (modules/insert.js). */
.xc-inserts {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
}

.xc-inserts .xc-f__label { margin-inline-end: 3px; }

.xc-insert {
    appearance: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 10px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--surface);
    font: inherit;
    font-size: 12.8px;
    color: rgba(var(--ink), .72);
    cursor: pointer;
    transition: border-color 140ms, color 140ms, background 140ms;
}

.xc-insert:hover {
    border-color: var(--peri);
    background: rgba(var(--brand), .05);
    color: var(--peri);
}

.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;
}

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

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

.xc-knows__one {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 18px;
}

.xc-knows__mark {
    inline-size: 38px;
    block-size: 38px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(var(--tint), .12);
    color: rgb(var(--tint));
}

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

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

.xc-knows__go {
    margin-block-start: auto;
    padding-block-start: 6px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    font-weight: 600;
    color: rgb(var(--tint));
}

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

/* ── 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;
}

.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);
}

.xc-pv__mark--big {
    inline-size: 44px;
    block-size: 44px;
    border-radius: 15px;
}

/* 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);
}

/* ── the preview's mark ─────────────────────────────────────────────────
 *
 * Ours, with the sparkles that now say "the AI" everywhere: the X in the
 * brand's own gradient on a soft glass tile, three sparkles in the agent's
 * tint around it, twinkling out of step. Still where motion is not wanted.
 */

.xc-pvmagic {
    --logo-a: #1C1CD2;
    --logo-b: #6B6BF3;
    position: relative;
    inline-size: 72px;
    block-size: 72px;
    flex: none;
    margin-block: 8px 8px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(var(--brand), .18);
    border-radius: 23px;
    background: rgba(var(--brand), .08);
    background:
        radial-gradient(120% 120% at 18% 8%, rgba(var(--brand), .2), transparent 58%),
        radial-gradient(100% 100% at 95% 100%, color-mix(in srgb, var(--accent, #8F8FF7) 30%, transparent), transparent 68%),
        var(--surface);
    box-shadow: 0 12px 30px rgba(var(--brand), .16), inset 0 1px 0 rgba(255, 255, 255, .55);
}

[data-theme="dark"] .xc-pvmagic {
    --logo-a: #8F8FF7;
    --logo-b: #C9C9FC;
    box-shadow: 0 12px 30px rgba(0, 0, 0, .4), inset 0 1px 0 rgba(255, 255, 255, .06);
}

.xc-pvmagic__logo stop:first-child { stop-color: var(--logo-a); }
.xc-pvmagic__logo stop:last-child { stop-color: var(--logo-b); }

.xc-pvmagic__spark {
    position: absolute;
    color: var(--accent, var(--peri));
    filter: drop-shadow(0 2px 6px rgba(var(--brand), .35));
    animation: xc-pvtwinkle 2.8s ease-in-out infinite;
}

/* The big one sits on the tile's corner, the way the AI sparkle sits on
   every product's mark; the two small ones drift around it. */
.xc-pvmagic__spark--a { inset-block-start: -12px; inset-inline-end: -12px; }
.xc-pvmagic__spark--b { inset-block-end: 4px; inset-inline-start: -13px; color: rgb(var(--brand)); animation-delay: .9s; }
.xc-pvmagic__spark--c { inset-block-start: -4px; inset-inline-start: 4px; color: var(--peri); animation-delay: 1.7s; }

[data-theme="dark"] .xc-pvmagic__spark { color: #C9C9FC; filter: drop-shadow(0 0 6px rgba(143, 143, 247, .55)); }
[data-theme="dark"] .xc-pvmagic__spark--a { color: #E4E4FE; }

@keyframes xc-pvtwinkle {
    0%, 100% { transform: scale(.86) rotate(0deg); opacity: .8; }
    50% { transform: scale(1.08) rotate(12deg); opacity: 1; }
}

/* ── 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-pvmagic__spark,
    .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);
    }

    .xc-tones { grid-template-columns: minmax(0, 1fr); }
    .xc-knows { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* 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-knows,
    .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);
}
