/* ============================================================
   AI Agents Chat UI
   ============================================================ */

.agents-container {
    display: flex;
    min-height: 300px;
    background: #f8f9fa;
    overflow: hidden;
}

/* Sidebar — persona picker */
.agents-sidebar {
    width: 220px;
    min-width: 220px;
    background: #fff;
    border-right: 1px solid #e0e0e0;
    padding: 16px;
    overflow-y: auto;
}

.agents-sidebar__title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #8a8a8a;
    margin-bottom: 12px;
    padding-left: 4px;
}

.agents-persona {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
}

.agents-persona:hover {
    background: #f0f0f0;
}

.agents-persona--active {
    background: #e8f0fe;
}

.agents-persona__icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--club-colour, #4a6cf7);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.agents-persona__name {
    font-weight: 600;
    font-size: 13px;
    color: #333;
}

.agents-persona__desc {
    font-size: 11px;
    color: #888;
}

/* Main chat area */
.agents-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.agents-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
}

.agents-header__persona {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 14px;
}

.agents-header__persona i {
    color: var(--club-colour, #4a6cf7);
}

.agents-header__subtitle {
    font-weight: 400;
    color: #888;
    font-size: 12px;
}

.agents-header__usage {
    display: flex;
    gap: 12px;
    font-size: 11px;
    color: #999;
}

.agents-usage__cost {
    font-weight: 600;
    color: #666;
}

.agents-usage__label {
    color: #aaa;
}

.agents-usage__sep {
    color: #ddd;
}

/* Messages */
.agents-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.agents-bubble {
    display: flex;
    gap: 10px;
    max-width: 85%;
    animation: agentsFadeIn 0.2s ease;
}

@keyframes agentsFadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

.agents-bubble--user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.agents-bubble--agent {
    align-self: flex-start;
}

.agents-bubble__avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--club-colour, #4a6cf7);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    flex-shrink: 0;
    margin-top: 2px;
}

.agents-bubble__content {
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.5;
    word-wrap: break-word;
    overflow: visible;
    position: relative;
}

.agents-bubble--agent .agents-bubble__content {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px 12px 12px 2px;
}

.agents-bubble--user .agents-bubble__content {
    background: var(--club-colour, #4a6cf7);
    color: #fff;
    border-radius: 12px 12px 2px 12px;
}

/* Human (support agent) replies after a Milo handoff — teal so they read
   distinctly from Milo's white bubbles. */
.agents-bubble--human .agents-bubble__avatar { background: #0d9488; }
.agents-bubble--human .agents-bubble__content {
    background: #ccfbf1;
    border: 1px solid #99f6e4;
    color: #134e4a;
    border-radius: 12px 12px 12px 2px;
}

/* Attachments in the widget thread (pasted images / files) */
.agents-att { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 8px; }
.agents-att img {
    max-width: 220px; max-height: 200px; border-radius: 10px;
    border: 1px solid rgba(15,23,42,0.12); cursor: pointer; display: block;
}
.agents-att__file {
    display: inline-flex; align-items: center; gap: 6px;
    background: rgba(255,255,255,0.65); border: 1px solid rgba(15,23,42,0.14);
    border-radius: 9px; padding: 7px 11px; font-size: 12.5px;
    color: inherit; text-decoration: none;
}
.agents-att__file:hover { border-color: var(--club-colour, #4a6cf7); }
.agents-att-bar { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 6px; }
.agents-att-bar:empty { display: none; }
.agents-att-chip {
    display: inline-flex; align-items: center; gap: 6px;
    background: #f3effe; border: 1px solid #ddd6fe; color: #5b21b6;
    border-radius: 8px; padding: 4px 8px; font-size: 11.5px;
}
.agents-att-chip img { width: 28px; height: 28px; object-fit: cover; border-radius: 4px; }
.agents-att-chip b { cursor: pointer; color: #7c3aed; padding-left: 2px; }
.agents-att-btn {
    border: none; background: transparent; cursor: pointer;
    font-size: 17px; line-height: 1; padding: 0 6px; opacity: 0.75;
}
.agents-att-btn:hover { opacity: 1; }

/* "Milo handed this over" / "Resolved — Milo is back" markers */
.agents-handoff-divider {
    align-self: stretch;
    text-align: center;
    font-size: 12.5px;
    font-weight: 600;
    color: #0f766e;
    margin: 10px 0;
}

.agents-typing {
    color: #999;
    font-style: italic;
}

/* Tool call indicators */
.agents-tool-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: #888;
    padding: 4px 12px 4px 52px;
}

.agents-tool-indicator .fa-check {
    color: #28a745;
}

/* Input area */
.agents-input {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 12px 20px;
    background: #fff;
    border-top: 1px solid #e0e0e0;
}

.agents-input__textarea {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 13px;
    resize: none;
    outline: none;
    min-height: 40px;
    max-height: 120px;
    font-family: inherit;
}

.agents-input__textarea:focus {
    border-color: var(--club-colour, #4a6cf7);
}

.agents-input__send {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: var(--club-colour, #4a6cf7);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: opacity 0.15s;
}

.agents-input__send:hover {
    opacity: 0.85;
}

.agents-input__send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Structured content: tables */
.agents-table {
    width: 100%;
    border-collapse: collapse;
    margin: 8px 0;
    font-size: 12px;
}

/* Export CSV — sits above its table, quiet until you want it (#42501).
   Right-aligned so it never competes with the data for attention. */
.agents-table__export {
    display: block;
    margin: 8px 0 -4px auto;
    padding: 3px 9px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.4;
    color: #64748b;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    cursor: pointer;
    transition: color .15s ease, border-color .15s ease, background .15s ease;
}

.agents-table__export:hover,
.agents-table__export:focus-visible {
    color: var(--cui-nav-link-color, #5B7CFA);
    border-color: currentColor;
    background: #f8fafc;
}

.agents-table__export i {
    margin-right: 4px;
    opacity: .8;
}

/* Show more — sits under its table and loads the next page of a truncated
   member list straight into it (#43763). Centred and full-width-ish because
   this one IS the next step, unlike the quiet Export CSV control above. */
.agents-table__more {
    display: block;
    width: 100%;
    margin: -4px 0 8px;
    padding: 6px 12px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.4;
    color: #64748b;
    background: #fff;
    border: 1px dashed #e2e8f0;
    border-radius: 6px;
    cursor: pointer;
    transition: color .15s ease, border-color .15s ease, background .15s ease;
}

.agents-table__more:hover:not(:disabled),
.agents-table__more:focus-visible {
    color: var(--cui-nav-link-color, #5B7CFA);
    border-color: currentColor;
    background: #f8fafc;
}

.agents-table__more:disabled {
    cursor: default;
    opacity: .7;
}

.agents-table__more i {
    margin-right: 4px;
    opacity: .8;
}

/* Rows the operator loaded, marked so they read as a continuation of the same
   list rather than as something Milo wrote. */
.agents-table__row--more td {
    background: #fcfcfd;
}

.agents-table th {
    background: #f5f5f5;
    font-weight: 600;
    text-align: left;
    padding: 6px 10px;
    border-bottom: 2px solid #ddd;
}

.agents-table td {
    padding: 6px 10px;
    border-bottom: 1px solid #eee;
}

.agents-table tr:hover td {
    background: #fafafa;
}

/* Structured content: a file Milo is building for you (#42820).
   Starts as a "preparing" row and becomes a download button in place — same card
   throughout, so the operator's eye doesn't have to find it twice. */
.agents-download {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 10px 0;
    padding: 10px 12px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}

.agents-download__icon {
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    color: #64748b;
    background: #f8fafc;
    border-radius: 6px;
}

.agents-download__body {
    flex: 1 1 auto;
    min-width: 0;
}

.agents-download__label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #111827;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.agents-download__status {
    display: block;
    font-size: 11px;
    color: #64748b;
}

.agents-download__btn {
    flex: 0 0 auto;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.4;
    color: #fff;
    background: var(--cui-nav-link-color, #5B7CFA);
    border: 1px solid transparent;
    border-radius: 6px;
    text-decoration: none;
    cursor: pointer;
    transition: filter .15s ease;
}

.agents-download__btn:hover,
.agents-download__btn:focus-visible {
    color: #fff;
    filter: brightness(1.08);
}

.agents-download__btn i {
    margin-right: 4px;
    opacity: .9;
}

/* Ready draws the eye; a dead export recedes rather than shouting. */
.agents-download[data-state="ready"] .agents-download__icon {
    color: var(--cui-nav-link-color, #5B7CFA);
}

.agents-download[data-state="failed"] .agents-download__icon,
.agents-download[data-state="expired"] .agents-download__icon {
    color: #b45309;
    background: #fffbeb;
}

/* Structured content: charts (#42755).
   A [CHART] block renders the chart and the table it was built from, so the figure
   sits directly above its own numbers — the Export CSV button below belongs to it. */
.agents-chart {
    margin: 10px 0 0;
    padding: 10px 12px 8px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}

.agents-chart__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
    min-height: 20px;
}

.agents-chart__title {
    font-size: 12px;
    font-weight: 600;
    color: #111827;
}

/* Matches .agents-table__export so the two controls under a figure read as a pair. */
.agents-chart__png {
    padding: 3px 9px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.4;
    color: #64748b;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    cursor: pointer;
    flex-shrink: 0;
    transition: color .15s ease, border-color .15s ease, background .15s ease;
}

.agents-chart__png:hover,
.agents-chart__png:focus-visible {
    color: var(--cui-nav-link-color, #5B7CFA);
    border-color: currentColor;
    background: #f8fafc;
}

.agents-chart__png i {
    margin-right: 4px;
    opacity: .8;
}

/* Chart.js sizes to this box (maintainAspectRatio is off), so the height lives here
   and the chart never jumps as the panel resizes. Horizontal bar charts overwrite it
   inline — their height depends on how many categories there are. */
.agents-chart__canvas {
    position: relative;
    height: 240px;
}

/* Between the closing [/CHART] arriving and the chart being mounted (which waits for
   the stream to finish) the frame would otherwise be an empty white box. */
.agents-chart--pending .agents-chart__canvas {
    background: linear-gradient(180deg, #fbfbfc 0%, #f4f5f7 100%);
    border-radius: 6px;
    animation: agents-chart-pulse 1.2s ease-in-out infinite;
}

.agents-chart--pending .agents-chart__png {
    visibility: hidden;
}

@keyframes agents-chart-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: .55; }
}

@media (prefers-reduced-motion: reduce) {
    .agents-chart--pending .agents-chart__canvas { animation: none; }
}

/* The full-page /Agents view and the expanded widget have the room for a taller
   figure; the docked 720px panel does not. */
.agents-container .agents-chart__canvas,
.spot--expanded .agents-chart__canvas {
    height: 300px;
}

/* Says what the chart left out — a row cap, a series cap, a grouped "Other". Never
   silently truncate: the table below always has the full set. */
.agents-chart__note {
    margin-top: 6px;
    font-size: 11px;
    color: #6b7280;
}

/* Structured content: member cards */
.agents-member-card {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: #e8f0fe;
    border-radius: 4px;
    color: var(--club-colour, #4a6cf7);
    text-decoration: none;
    font-size: 12px;
    font-weight: 500;
    position: relative;
    cursor: pointer;
}

.agents-member-card:hover {
    background: #d0e1fd;
    text-decoration: none;
    color: var(--club-colour, #4a6cf7);
}

.agents-member-popup {
    display: none;
    position: fixed;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.1), 0 2px 8px rgba(0,0,0,0.06);
    padding: 0;
    min-width: 240px;
    z-index: 10000;
    font-size: 12px;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
}

.agents-member-popup--visible {
    display: block;
}

.agents-member-popup::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 30px;
    border: 7px solid transparent;
    border-top-color: #fff;
}

.agents-member-popup::before {
    content: '';
    position: absolute;
    top: 100%;
    left: 29px;
    border: 8px solid transparent;
    border-top-color: #e0e0e0;
}

.agents-member-popup__header {
    padding: 12px 14px 8px;
    border-bottom: 1px solid #f0f0f0;
    background: #fafbfc;
}

.agents-member-popup__name {
    font-weight: 700;
    font-size: 14px;
    color: #222;
}

.agents-member-popup__details {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 10px 14px;
}

.agents-member-popup__details div {
    color: #555;
    font-size: 12px;
}

.agents-member-popup__details strong {
    color: #333;
    font-weight: 600;
    min-width: 50px;
    display: inline-block;
}

.agents-member-popup__link {
    display: block;
    font-size: 12px;
    color: var(--club-colour, #4a6cf7);
    text-decoration: none;
    font-weight: 600;
    padding: 8px 14px;
    background: #f8f9fa;
    border-top: 1px solid #f0f0f0;
    text-align: center;
    transition: background 0.1s;
}

.agents-member-popup__link:hover {
    background: #e8f0fe;
    text-decoration: none;
    color: var(--club-colour, #4a6cf7);
}

.agents-member-popup__loading {
    color: #999;
    padding: 14px;
    display: block;
}

.agents-member-popup__error {
    color: #dc3545;
    padding: 14px;
    display: block;
}

/* Structured content: stats */
.agents-stat {
    display: inline-flex;
    flex-direction: column;
    padding: 8px 14px;
    background: #f0f7ff;
    border-radius: 8px;
    border-left: 3px solid var(--club-colour, #4a6cf7);
    margin: 3px 6px 3px 0;
    vertical-align: top;
}

.agents-stat__label {
    font-size: 10px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.agents-stat__value {
    font-size: 18px;
    font-weight: 700;
    color: #333;
}

/* Markdown elements inside bubbles */
.agents-heading {
    margin: 8px 0 2px;
    font-weight: 600;
    color: #333;
    line-height: 1.3;
}

.agents-heading:first-child {
    margin-top: 0;
}

h3.agents-heading { font-size: 15px; }
h4.agents-heading { font-size: 14px; }
h5.agents-heading { font-size: 13px; }
h6.agents-heading { font-size: 12px; }

.agents-hr {
    border: none;
    border-top: 1px solid #e0e0e0;
    margin: 8px 0;
}

.agents-list {
    margin: 2px 0;
    padding-left: 18px;
}

.agents-list li {
    margin-bottom: 1px;
    font-size: 13px;
    line-height: 1.4;
}

.agents-line {
    line-height: 1.5;
}

.agents-spacer {
    height: 6px;
}

.agents-bubble__content code {
    background: #f0f0f0;
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 12px;
}

.agents-emoji-warn {
    font-size: 14px;
}

/* Structured content: action prompts */
.agents-action {
    padding: 10px 0;
}

.agents-action__text {
    font-size: 13px;
    margin-bottom: 8px;
}

.agents-action__buttons {
    display: flex;
    gap: 6px;
}

.agents-action__btn {
    font-size: 12px;
}
.agents-action__btn.disabled {
    opacity: 0.5;
    pointer-events: none;
}
.agents-action__btn--selected {
    opacity: 1 !important;
    font-weight: 600;
}

/* "Talk to a human" in the Milo-is-down bubble: the club-colour pill, not a stock blue button. */
.agents-human-fallback {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border: 1px solid var(--club-colour, #EC6627);
    border-radius: 999px;
    background: var(--club-colour, #EC6627);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}
.agents-human-fallback:hover { filter: brightness(1.05); }

/* Write-approval card — the operator must approve a write tool before it runs. */
.agents-approval {
    margin: 8px 0 8px 42px;
    padding: 12px 14px;
    border: 1px solid #f0c36d;
    border-left: 4px solid #e0a800;
    border-radius: 10px;
    background: #fffdf5;
}
.agents-approval__title {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #7a5b00;
}
.agents-approval__list {
    margin: 0 0 10px;
    padding: 0;
    list-style: none;
    font-size: 13px;
}
.agents-approval__action + .agents-approval__action {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #f0e2b8;
}
.agents-approval__action-title {
    font-weight: 600;
    margin-bottom: 4px;
}
/* #43757 — the recipient line. Deliberately the loudest thing on the card after the
   heading: this is the one fact the operator can check that the body text cannot. */
.agents-approval__target {
    margin-bottom: 6px;
    padding: 5px 8px;
    border-radius: 6px;
    background: #fff5d6;
    font-size: 13px;
    word-break: break-word;
}
.agents-approval__target-label {
    color: #7a5b00;
    font-weight: 600;
}
.agents-approval__target-name {
    font-weight: 600;
}
.agents-approval__target-contact {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 12px;
}
.agents-approval__target-ref {
    font-size: 12px;
    color: #8a7a4a;
}
.agents-approval__target-sep {
    color: #c4ad6a;
}
.agents-approval__warning {
    margin-bottom: 6px;
    padding: 5px 8px;
    border-radius: 6px;
    background: #fdecea;
    border: 1px solid #f5c2bd;
    color: #a3261a;
    font-size: 12px;
}
.agents-approval__field {
    margin-bottom: 3px;
    font-size: 12px;
    word-break: break-word;
}
.agents-approval__field-label {
    color: #8a7a4a;
    margin-right: 5px;
}
.agents-approval__field-label::after {
    content: ":";
}
.agents-approval__field--long .agents-approval__field-label {
    display: block;
    margin-bottom: 2px;
}
/* The email body in full. It used to be cut at 300 characters on a one-line summary —
   an operator who can only see the first few lines is approving what they haven't read. */
.agents-approval__value--long {
    display: block;
    max-height: 220px;
    overflow-y: auto;
    padding: 6px 8px;
    border: 1px solid #eadfc0;
    border-radius: 6px;
    background: #fff;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    line-height: 1.45;
}
.agents-approval__summary {
    display: block;
    font-size: 11px;
    color: #8a8a8a;
    word-break: break-word;
}
.agents-approval__buttons {
    display: flex;
    gap: 6px;
}
.agents-approval__btn {
    font-size: 12px;
}
.agents-approval__btn.disabled {
    opacity: 0.5;
    pointer-events: none;
}
.agents-approval__btn--selected {
    opacity: 1 !important;
    font-weight: 600;
}
.agents-approval--resolved {
    opacity: 0.75;
}

.agents-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 6px 16px;
    min-height: 0;
}
.agents-suggestions:empty {
    display: none;
}
.agents-suggestion-chip {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    font-size: 12px;
    border: 1px solid #dee2e6;
    border-radius: 16px;
    background: #f8f9fa;
    color: #495057;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}
.agents-suggestion-chip:hover {
    background: #e9ecef;
    border-color: #adb5bd;
    color: #212529;
}

/* ── #43331 — inline CSAT strip under the latest answer ─────────────────── */
.agents-csat {
    display: flex;
    align-items: center;
    gap: 4px;
    margin: -2px 0 10px 42px; /* aligns under the agent bubble content (32px avatar + 10px gap) */
    opacity: .5;
    transition: opacity .15s ease;
}

.agents-csat:hover,
.agents-csat--rated {
    opacity: .9;
}

.agents-csat__label {
    font-size: 11px;
    color: #71717a;
    margin-right: 4px;
}

.agents-csat__btn {
    font-size: 15px;
    line-height: 1;
    background: none;
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 2px 5px;
    cursor: pointer;
    filter: grayscale(1);
    transition: filter .15s ease, transform .15s ease, border-color .15s ease;
}

.agents-csat__btn:hover {
    filter: grayscale(0);
    transform: scale(1.15);
}

.agents-csat__btn--chosen {
    filter: grayscale(0);
    border-color: var(--club-colour, #EC6627);
}

/* ── #43339 — archived-conversation bar (replaces the composer, view-only) ── */
.agents-archived-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 10px 12px;
    background: #f4f4f5;
    border-top: 1px solid #e4e4e7;
    font-size: 12px;
}

.agents-archived-bar__text {
    color: #52525b;
    margin-right: auto;
}

.agents-archived-bar__btn {
    background: none;
    border: 1px solid #d4d4d8;
    border-radius: 8px;
    padding: 5px 10px;
    font-size: 12px;
    cursor: pointer;
    color: #3f3f46;
}

.agents-archived-bar__btn:hover {
    border-color: #a1a1aa;
}

.agents-archived-bar__btn--primary {
    background: var(--club-colour, #EC6627);
    border-color: var(--club-colour, #EC6627);
    color: #fff;
}

.agents-archived-bar__btn--primary:hover {
    filter: brightness(1.05);
}

/* ── Conversation lifecycle: countdown line, ended divider, card buttons ──── */
.agents-endcount {
    text-align: center;
    font-size: 11px;
    color: #a1a1aa;
    padding: 4px 0 2px;
    background: #fff;
}

.agents-ended-divider {
    align-self: stretch;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #a1a1aa;
    font-size: 11px;
    margin: 6px 0;
}

.agents-ended-divider::before,
.agents-ended-divider::after {
    content: '';
    flex: 1;
    border-top: 1px solid #e4e4e7;
}

/* The wrap-up's fate buttons: right-aligned in the footer bar (#agentsWrapupBar). */
.milo-rate-choice {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-left: auto;
}

.milo-rate-choice button {
    border: 1px solid #d4d4d8;
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 12px;
    cursor: pointer;
    background: none;
    color: #3f3f46;
}

.milo-rate-choice button:hover {
    border-color: #a1a1aa;
}

.milo-rate-choice .milo-rate-end,
.milo-rate-choice .milo-rate-startfresh {
    background: var(--club-colour, #EC6627);
    border-color: var(--club-colour, #EC6627);
    color: #fff;
}

.milo-rate-choice .milo-rate-end:hover,
.milo-rate-choice .milo-rate-startfresh:hover {
    filter: brightness(1.05);
}

.milo-rate-choice .milo-rate-continue { background: #fff; } /* legible on the bar's grey */

/* The ended card carries only the rating; the way out is the footer bar (#agentsEndedBar),
   so nothing an operator needs can scroll out of sight. */
.agents-ended-card {
    border: 1px solid #e4e4e7;
    border-radius: 10px;
    padding: 10px 12px;
}
.agents-ended-card__title { font-weight: 600; margin-bottom: 4px; }
.agents-ended-card__sub { font-size: 12px; color: #71717a; margin-bottom: 8px; }
.milo-rate { display: flex; gap: 8px; margin-bottom: 8px; }
.milo-rate button {
    font-size: 22px;
    background: none;
    border: 1px solid #e4e4e7;
    border-radius: 10px;
    padding: 5px 9px;
    cursor: pointer;
}
.milo-rate button:hover { border-color: #a1a1aa; }
.milo-rate--chosen button { opacity: 0.45; }
.milo-rate--chosen button.is-chosen { opacity: 1; border-color: var(--club-colour, #EC6627); }
.milo-rate-c {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #e4e4e7;
    border-radius: 8px;
    margin-bottom: 6px;
    font: inherit;
    font-size: 12px;
}
/* The wrap-up card (asked on ✕ / new chat) is the same card with the accent border. */
.agents-ended-card--wrapup { border-color: var(--club-colour, #EC6627); }
.agents-archived-bar--ended .agents-archived-bar__text { font-weight: 600; color: #3f3f46; }

/* Small relative time stamp under each message ("5 min ago"), refreshed
   every minute. User-side stamps right-align under their bubbles. */
.agents-msg-time {
    font-size: 10px;
    color: #a1a1aa;
    margin: -8px 0 0 42px;
    align-self: flex-start;
}

.agents-msg-time--user {
    align-self: flex-end;
    margin: -8px 6px 0 0;
}

.agents-endcount__time {
    color: var(--club-colour, #EC6627);
    font-weight: 600;
    font-variant-numeric: tabular-nums; /* the clock doesn't jiggle as digits change */
}

/* ── #44081 — Milo's mark as the bubble avatar ─────────────────────────────── */
.agents-avatar-mark {
    width: 18px;
    height: 18px;
    display: block;
}

/* ── #44083 — follow-up chips and Yes / Not now offers sit UNDER the bubble ─── */
/* The bubble is avatar + content in a row; anything under the content wraps onto
   the next line and indents past the avatar (32px + 10px gap). */
.agents-bubble--agent { flex-wrap: wrap; }
.agents-followups,
.agents-offer {
    flex: 0 0 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 6px 0 0 42px;
}
.agents-followups .agents-suggestion-chip { white-space: normal; }
.agents-offer__btn {
    border-radius: 999px;
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.14s ease, color 0.14s ease, transform 0.14s ease;
}
.agents-offer__btn--accept {
    background: var(--club-colour, #4a6cf7);
    color: #fff;
    border: 1px solid var(--club-colour, #4a6cf7);
}
.agents-offer__btn--accept:hover { filter: brightness(1.08); transform: translateY(-1px); }
.agents-offer__btn--decline {
    background: transparent;
    color: #64748b;
    border: 1px solid #e2e8f0;
}
.agents-offer__btn--decline:hover { background: #f8fafc; color: #334155; }

/* ── #44078 — links in an answer are links ─────────────────────────────────── */
.agents-link {
    color: var(--club-colour, #4a6cf7);
    text-decoration: underline;
    text-underline-offset: 2px;
    word-break: break-word;
}
.agents-link:hover { text-decoration-thickness: 2px; }
.agents-link__ext { font-size: 0.75em; opacity: 0.7; margin-left: 1px; }
/* Avatar and content still share the first row; only the chips/offer wrap below. */
.agents-bubble--agent .agents-bubble__content { flex: 1 1 0%; min-width: 0; }
.agents-link__host { font-size: 0.85em; opacity: 0.7; text-decoration: none; display: inline-block; }
