/* Agent roster, detail drawer, composer identity.
   Split out of console.css; see channel/web/README.md for the
   load order, which is load-bearing. */

/* =====================================================================
   Agents: cards, detail, composer identity
   ===================================================================== */
/* Team page is a two-pane workbench: a scrollable vertical roster on the left,
   the selected Agent's detail filling the right — the same shape as the desktop
   client. On a narrow screen it collapses to a single column and the detail
   slides over as a full-screen sheet (see the media query below). */
.agents-view.view.active { display: flex; flex-direction: row; }
.agents-view { min-height: 0; overflow: hidden; }
.agents-list-pane {
    display: flex; flex-direction: column; min-height: 0;
    width: 320px; flex-shrink: 0;
    border-right: 1px solid #e2e8f0;
    padding: 18px 14px 8px;
    overflow-y: auto;
}
.dark .agents-list-pane { border-color: rgba(255,255,255,.08); }
.agents-list-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; padding: 0 4px; }
/* A tidier, less shouty header for the roster column. */
.agents-list-head h2 { font-size: 15px; font-weight: 600; }
.agents-list-head p { display: none; }
.agents-list-head > button {
    padding: 6px 12px; font-size: 12.5px; border-radius: 8px;
}
.agents-grid {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.agent-card {
    position: relative;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 10px;
    padding: 9px 10px;
    cursor: pointer;
    transition: background .12s, border-color .12s;
}
/* The status chip floats in the corner instead of taking a row of its own, so
   the "default" card is the same height as the rest of the roster. */
.agent-card-badge {
    position: absolute;
    top: 9px; right: 10px;
    font-size: 9.5px;
    padding: 1px 7px;
    border-radius: 999px;
    background: #f1f5f9;
    color: #64748b;
    font-weight: 500;
}
.agent-card-badge.agent-chip-on { background: #EDFDF3; color: #17803d; }
.dark .agent-card-badge { background: rgba(255,255,255,.06); color: #94a3b8; }
.dark .agent-card-badge.agent-chip-on { background: rgba(74, 190, 110, .15); color: #86efac; }
.agent-card:hover { background: #f8fafc; }
.dark .agent-card:hover { background: rgba(255,255,255,.04); }
.agent-card.selected { background: #EDFDF3; border-color: transparent; }
.dark .agent-card.selected { background: rgba(74, 190, 110, .14); }
.agent-card.archived { opacity: .55; }
.agent-card-top { display: flex; align-items: center; gap: 10px; padding-right: 44px; min-width: 0; }
.agent-card-top .agent-avatar { flex-shrink: 0; }
.agent-card-name { font-weight: 600; font-size: 13.5px; color: #1e293b; }
.dark .agent-card-name { color: #f1f5f9; }
.agent-card-id { font-size: 11px; color: #94a3b8; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
/* One line of description under the name, ellipsised — keeps every row the same
   compact height so the roster reads as a clean list, not a wall of cards. */
.agent-card-desc {
    margin-top: 3px;
    font-size: 12px;
    line-height: 1.4;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.dark .agent-card-desc { color: #94a3b8; }
.agent-card-desc-empty { color: #cbd5e1; }
.dark .agent-card-desc-empty { color: #475569; }
.agent-card-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.agent-chip {
    font-size: 10px;
    padding: 2px 7px;
    border-radius: 999px;
    background: #f1f5f9;
    color: #64748b;
}
.dark .agent-chip { background: rgba(255,255,255,.06); color: #94a3b8; }
.agent-chip-on { background: #EDFDF3; color: #17803d; }
.dark .agent-chip-on { background: rgba(74, 190, 110, .15); color: #86efac; }

.agent-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    font-weight: 600;
    line-height: 1;
    background: #edfdf3;
    color: #17803d;
}
.agent-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* The face an Agent wears until an image is uploaded: its initial on a tinted
   disc. Kept low-saturation, and a tint rather than a solid fill, so a roster
   of a dozen of them reads as one calm list instead of a bag of sweets. Tone 0
   is the neutral one, worn by anything without an id yet (a draft in the
   create modal). */
.agent-avatar-tone-0 { background: #eef1f5; color: #4b5563; }
.agent-avatar-tone-1 { background: #eaf0f7; color: #3f5f80; }
.agent-avatar-tone-2 { background: #ebf3ed; color: #46694e; }
.agent-avatar-tone-3 { background: #f4f1e9; color: #6b5f45; }
.agent-avatar-tone-4 { background: #f5eeeb; color: #7a564d; }
.agent-avatar-tone-5 { background: #f0eef6; color: #574f70; }
.dark .agent-avatar-tone-0 { background: #2a2f36; color: #b6bec9; }
.dark .agent-avatar-tone-1 { background: #26313d; color: #a8c0d6; }
.dark .agent-avatar-tone-2 { background: #263329; color: #a9c7b0; }
.dark .agent-avatar-tone-3 { background: #33302a; color: #cdbe9f; }
.dark .agent-avatar-tone-4 { background: #352c2a; color: #d0b0a7; }
.dark .agent-avatar-tone-5 { background: #2e2b38; color: #b8b0d0; }
.agent-avatar-15 { width: 15px; height: 15px; font-size: 7px; }
.agent-avatar-16 { width: 16px; height: 16px; font-size: 8px; }
.agent-avatar-20 { width: 20px; height: 20px; font-size: 10px; }
.agent-avatar-22 { width: 22px; height: 22px; font-size: 11px; }
.agent-avatar-24 { width: 24px; height: 24px; font-size: 12px; }
.agent-avatar-28 { width: 28px; height: 28px; font-size: 13px; }
.agent-avatar-32 { width: 32px; height: 32px; font-size: 15px; }
.agent-avatar-40 { width: 40px; height: 40px; font-size: 18px; }
.agent-avatar-56 { width: 56px; height: 56px; font-size: 24px; }

/* A drawer rather than a column: the Agent list now sits inside a settings
   tab, which is a normal scrolling page, so the panel cannot rely on being
   the second half of a full-height flex row. */
/* Desktop: the detail is the right pane, filling the space beside the roster.
   `.hidden` (no Agent selected) shows an empty-state placeholder instead of
   collapsing, so the workbench keeps its two-pane shape. */
.agent-detail {
    flex: 1;
    min-width: 0;
    background: #fff;
    display: flex;
    flex-direction: column;
}
.agent-detail.hidden { display: flex; }
.agent-detail.hidden > * { display: none; }
.agent-detail.hidden::before {
    content: attr(data-empty-label);
    margin: auto;
    color: #cbd5e1;
    font-size: 14px;
}
.dark .agent-detail.hidden::before { color: #475569; }
.dark .agent-detail { background: #1A1A1A; }
.agent-detail-header { position: relative; padding: 20px 20px 8px; }
.agent-detail-close {
    position: absolute; top: 12px; right: 12px;
    width: 28px; height: 28px; border-radius: 8px;
    color: #94a3b8;
}
.agent-detail-close:hover { background: #f1f5f9; }
.dark .agent-detail-close:hover { background: rgba(255,255,255,.06); }
.agent-detail-identity { display: flex; align-items: center; gap: 12px; padding-right: 28px; }
.agent-detail-tabs { display: flex; gap: 4px; padding: 0 16px; border-bottom: 1px solid #e2e8f0; }
.dark .agent-detail-tabs { border-color: rgba(255,255,255,.08); }
.agent-detail-tab {
    padding: 10px 12px; font-size: 13px; color: #64748b; border-bottom: 2px solid transparent;
}
.agent-detail-tab.active { color: #17803d; border-color: #4ABE6E; font-weight: 600; }
.agent-detail-pane { flex: 1; overflow-y: auto; padding: 16px 20px; }
.agent-core-editor {
    width: 100%; min-height: 520px; padding: 12px;
    background: #f8fafc; color: #1e293b; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 12px; border-radius: 10px; resize: vertical; border: 1px solid #e2e8f0;
}
.dark .agent-core-editor { background: #151515; color: #e2e8f0; border-color: rgba(255,255,255,.08); }
/* Read-only rendered markdown, shown instead of the textarea in preview mode.
   Same footprint as the editor so switching modes doesn't jump the layout. */
.agent-core-preview {
    width: 100%; min-height: 520px; padding: 12px 14px;
    background: #f8fafc; border-radius: 10px; border: 1px solid #e2e8f0;
    overflow-y: auto; font-size: 13px;
}
.dark .agent-core-preview { background: #151515; border-color: rgba(255,255,255,.08); }
.agent-skill-row {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 0; border-bottom: 1px solid #f1f5f9;
}
.dark .agent-skill-row { border-color: rgba(255,255,255,.05); }

/* Custom checkbox: green fill with a white tick when checked, instead of the
   browser default (accent-color renders a black tick that clashes with green).
   Applies to the skills pane's "use all" toggle and each skill row. */
#agent-detail-skills input[type="checkbox"] {
    appearance: none; -webkit-appearance: none;
    flex-shrink: 0; margin: 0; cursor: pointer;
    width: 16px; height: 16px; border-radius: 5px;
    border: 1.5px solid #cbd5e1; background: #fff;
    position: relative; transition: background .12s, border-color .12s;
}
.dark #agent-detail-skills input[type="checkbox"] { background: #1f1f1f; border-color: rgba(255,255,255,.2); }
#agent-detail-skills input[type="checkbox"]:hover { border-color: #4ABE6E; }
#agent-detail-skills input[type="checkbox"]:checked {
    background: #4ABE6E; border-color: #4ABE6E;
}
#agent-detail-skills input[type="checkbox"]:checked::after {
    content: ""; position: absolute;
    left: 5px; top: 2px; width: 4px; height: 8px;
    border: solid #fff; border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}
#agent-detail-skills input[type="checkbox"]:disabled {
    opacity: .5; cursor: not-allowed;
}
.agent-modal {
    position: fixed; inset: 0; background: rgba(15, 23, 42, .45);
    display: flex; align-items: center; justify-content: center; z-index: 60;
    backdrop-filter: blur(2px);
}
.agent-modal.hidden { display: none; }
.agent-modal-card-wide { width: min(560px, calc(100% - 32px)) !important; }
.agent-modal-card {
    width: min(460px, calc(100% - 32px));
    max-height: calc(100vh - 48px);
    max-height: calc(100dvh - 48px);
    display: flex; flex-direction: column;
    background: #fff; border-radius: 18px;
    box-shadow: 0 24px 60px -20px rgba(0,0,0,.4);
}
.dark .agent-modal-card { background: #1A1A1A; border: 1px solid rgba(255,255,255,.08); }
.agent-modal-title {
    font-size: 16px; font-weight: 600; color: #1e293b;
    padding: 22px 24px 4px;
    flex: 0 0 auto;
}
.dark .agent-modal-title { color: #f1f5f9; }
/* The body scrolls when a form outgrows the viewport (e.g. small laptops or
   narrow mobile widths) so the footer's action buttons stay reachable. While a
   dropdown is open we let the body overflow so its menu can spill past the last
   field instead of being clipped; the menu's own max-height (and drop-up flip)
   keeps it inside the viewport. */
.agent-modal-body { padding: 12px 24px; overflow-y: auto; flex: 1 1 auto; min-height: 0; }
.agent-modal-body:has(.cfg-dropdown.open) { overflow: visible; }
.agent-modal-foot {
    display: flex; align-items: center; gap: 10px;
    padding: 16px 24px 20px; border-top: 1px solid #f1f5f9;
    flex: 0 0 auto;
}
.dark .agent-modal-foot { border-color: rgba(255,255,255,.06); }

/* Shared form vocabulary for the create modal and the detail drawer, so a
   field looks the same wherever it appears: a label above the control, never
   a placeholder standing in for one. */
.agent-field { margin-bottom: 18px; }
.agent-field-label {
    display: block; font-size: 12px; font-weight: 500;
    color: #64748b; margin-bottom: 7px;
}
.dark .agent-field-label { color: #94a3b8; }
.agent-field-hint { font-size: 11px; color: #94a3b8; margin-top: 6px; }
.agent-status-ok { color: #17803d !important; }
.dark .agent-status-ok { color: #86efac !important; }
.agent-status-error { color: #dc2626 !important; }
.dark .agent-status-error { color: #fca5a5 !important; }
#agent-detail-files button[onclick="saveAgentCoreFile()"][disabled] { opacity: 0.55; cursor: default; }
.agent-input {
    width: 100%; height: 40px; padding: 0 12px;
    border-radius: 10px; border: 1px solid #e2e8f0; background: #f8fafc;
    font-size: 14px; color: #1e293b;
    transition: border-color .2s ease, box-shadow .2s ease;
}
.agent-input::placeholder { color: #cbd5e1; }
.agent-input:focus {
    outline: none; border-color: #4ABE6E;
    box-shadow: 0 0 0 3px rgba(74, 190, 110, .12); background: #fff;
}
/* Responsibilities is a paragraph, not a line: let it breathe and wrap. */
.agent-textarea {
    height: auto; min-height: 84px; padding: 10px 12px;
    line-height: 1.55; resize: vertical; font-family: inherit;
}
.dark .agent-input {
    border-color: #475569; background: rgba(255,255,255,.05); color: #f1f5f9;
}
.dark .agent-input:focus { background: rgba(255,255,255,.07); }
.agent-input-locked {
    width: 100%; min-height: 40px; padding: 9px 12px;
    border-radius: 10px; border: 1px dashed #e2e8f0;
    font-size: 13px; color: #94a3b8; background: #f8fafc;
}
.dark .agent-input-locked { border-color: rgba(255,255,255,.1); background: rgba(255,255,255,.03); }

/* Segmented two-way switch (e.g. shared vs own knowledge base). Kept compact
   so it reads as an inline control rather than a heavy toolbar. */
.agent-seg {
    display: inline-flex; gap: 2px; padding: 2px;
    border-radius: 8px; background: #f1f5f9; border: 1px solid #e2e8f0;
}
.dark .agent-seg { background: rgba(255,255,255,.05); border-color: rgba(255,255,255,.1); }
.agent-seg-btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 4px 12px; height: 26px; border-radius: 6px; border: none; cursor: pointer;
    font-size: 12px; font-weight: 500; color: #64748b; background: transparent;
    transition: background .15s, color .15s;
}
.agent-seg-btn i { font-size: 11px; }
.dark .agent-seg-btn { color: #94a3b8; }
.agent-seg-btn:hover { color: #334155; }
.dark .agent-seg-btn:hover { color: #cbd5e1; }
.agent-seg-btn.active {
    background: #fff; color: #16a34a;
    box-shadow: 0 1px 2px rgba(0,0,0,.06);
}
.dark .agent-seg-btn.active { background: rgba(255,255,255,.12); color: #86efac; }

/* An info icon that sits after a field label and reveals its help on hover,
   replacing a permanent paragraph of hint text below the field. The popup
   itself is a JS-positioned element fixed to <body> (see showFieldTip in
   console.js) rather than a CSS ::after, so it can escape an ancestor's
   `overflow: auto` (e.g. the Agent detail drawer) instead of being clipped. */
.agent-field-label-row { display: flex; align-items: center; gap: 6px; margin-bottom: 7px; }
.agent-field-label-row .agent-field-label { margin-bottom: 0; }
.agent-field-tip {
    position: relative; display: inline-flex; align-items: center; justify-content: center;
    width: 14px; height: 14px; color: #cbd5e1; cursor: help; font-size: 11px;
}
.agent-field-tip:hover { color: #94a3b8; }
.dark .agent-field-tip { color: #64748b; }
.dark .agent-field-tip:hover { color: #94a3b8; }
.agent-tip-popup {
    position: fixed; width: max-content; max-width: 260px; padding: 8px 10px;
    border-radius: 8px; background: #1e293b; color: #f1f5f9;
    font-size: 11px; font-weight: 400; line-height: 1.5; text-align: left; white-space: pre-line;
    opacity: 0; pointer-events: none; transition: opacity .12s; z-index: 200;
    box-shadow: 0 6px 20px rgba(0,0,0,.18);
}
.agent-tip-popup.show { opacity: 1; }
.agent-tip-popup::after {
    content: ""; position: absolute; left: var(--tip-arrow-x, 50%); top: 100%;
    transform: translateX(-50%);
    border: 5px solid transparent; border-top-color: #1e293b;
}
/* Flipped below the icon when there isn't room above (e.g. near the top of a
   drawer): the arrow points up at the icon instead of down. */
.agent-tip-popup.tip-arrow-top::after {
    top: auto; bottom: 100%;
    border-top-color: transparent; border-bottom-color: #1e293b;
}
.dark .agent-tip-popup { background: #0f172a; }
.dark .agent-tip-popup::after { border-top-color: #0f172a; }
.dark .agent-tip-popup.tip-arrow-top::after { border-bottom-color: #0f172a; }

/* Avatar picker: a live preview beside an emoji grid and an upload button,
   all in the page palette. */
.agent-avatar-picker { display: flex; align-items: flex-start; gap: 14px; }
.agent-avatar-picker-preview { flex-shrink: 0; }
.agent-avatar-picker-body { flex: 1; min-width: 0; padding-top: 4px; }
.agent-avatar-upload {
    display: inline-flex; align-items: center; gap: 6px; margin-top: 10px;
    padding: 6px 12px; border-radius: 9px;
    border: 1px solid #e2e8f0; background: #fff;
    font-size: 12px; color: #64748b; cursor: pointer;
    transition: border-color .15s ease, color .15s ease;
}
.agent-avatar-upload:hover { border-color: #4ABE6E; color: #17803d; }
.dark .agent-avatar-upload { background: rgba(255,255,255,.04); border-color: rgba(255,255,255,.1); color: #94a3b8; }

/* While bytes are in flight: dim the preview and spin a ring over it, and make
   the upload button read as busy so a second click does not stack requests. */
.agent-avatar-picker.is-uploading .agent-avatar-picker-preview { position: relative; }
.agent-avatar-picker.is-uploading .agent-avatar-picker-preview::after {
    content: ""; position: absolute; inset: 0; margin: auto;
    width: 22px; height: 22px; border-radius: 50%;
    border: 2px solid rgba(74,190,110,.35); border-top-color: #4ABE6E;
    animation: agent-avatar-spin .7s linear infinite;
}
.agent-avatar-picker.is-uploading .agent-avatar-picker-preview .agent-avatar { opacity: .35; }
.agent-avatar-picker.is-uploading .agent-avatar-upload { opacity: .6; pointer-events: none; }
@keyframes agent-avatar-spin { to { transform: rotate(360deg); } }

/* Detail-drawer buttons, matching the create modal's foot. */
.agent-detail-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
/* Delete is destructive, so it sits apart from the everyday save/chat buttons. */
.agent-detail-delete { margin-left: auto; }
.agent-btn {
    height: 34px; padding: 0 14px; border-radius: 9px;
    font-size: 13px; font-weight: 500; cursor: pointer;
    transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.agent-btn-primary { background: #4ABE6E; color: #fff; }
.agent-btn-primary:hover { background: #3aa85d; }
.agent-btn-ghost { border: 1px solid #e2e8f0; color: #475569; background: #fff; }
.agent-btn-ghost:hover { border-color: #94a3b8; }
.dark .agent-btn-ghost { background: transparent; border-color: rgba(255,255,255,.12); color: #cbd5e1; }
.agent-btn-text { color: #64748b; background: transparent; }
.agent-btn-text:hover { color: #334155; }
.dark .agent-btn-text:hover { color: #e2e8f0; }
.agent-btn-sm { padding: 4px 8px; font-size: 12px; }
.agent-btn-text.agent-btn-sm { color: #4ABE6E; }
.agent-btn-text.agent-btn-sm:hover { color: #228547; }
.agent-btn-accent { color: #17803d; }
.agent-btn-danger { color: #ef4444; background: transparent; }
.agent-btn-danger:hover { color: #dc2626; }

.composer-identity-row { display: flex; align-items: flex-start; gap: 10px; }
/* The identity chip lives in the toolbar's right group now, so it centers with
   the other chips instead of hanging from the top of the card. */
.composer-identity { position: relative; display: inline-flex; align-items: center; }
.composer-identity.hidden { display: none; }
.composer-agent-btn {
    border-radius: 50%; padding: 0; line-height: 0;
    box-shadow: 0 0 0 2px transparent;
}
.composer-agent-btn { position: relative; }
.composer-agent-btn:hover { box-shadow: 0 0 0 2px #4ABE6E; }
/* Locked only means the owner can no longer be swapped; the button still opens
   its menu, so it keeps a pointer. */
.composer-agent-btn.locked:hover { box-shadow: 0 0 0 2px #cbd5e1; }
.composer-agent-count {
    position: absolute; right: -4px; bottom: -4px;
    min-width: 13px; height: 13px; padding: 0 2px;
    border-radius: 999px; border: 2px solid #fff;
    background: #4ABE6E; color: #fff;
    font-size: 8px; font-weight: 600; line-height: 9px; text-align: center;
}
.dark .composer-agent-count { border-color: #1A1A1A; }

/* The current Agent is marked by its trailing check, not a standing highlight:
   a permanent green fill fought the hover state, so two rows looked selected at
   once. Hover is the only fill; current just tints its text and check. */
.composer-menu-item.current { color: #228547; }
.composer-menu-item.current:hover { background: #EDFDF3; }
.dark .composer-menu-item.current { color: #6EE7A0; }
.dark .composer-menu-item.current:hover { background: rgba(74, 190, 110, .14); }
.composer-menu-item.current > i.fa-check { color: #4ABE6E; }
/* A member already in the conversation is a plain row, not a standing green
   fill (that read as "everything is selected"). A dim ✓ marks that it's in the
   chat; hovering a removable teammate swaps it for a red × (the owner row is a
   non-button and stays put). */
.composer-menu-item.joined .joined-check { color: #94a3b8; }
.composer-menu-item.joined .joined-remove { display: none; }
button.composer-menu-item.joined:hover { background: #FEF2F2; color: #b91c1c; cursor: pointer; }
.dark button.composer-menu-item.joined:hover { background: rgba(239, 68, 68, .12); color: #fca5a5; }
button.composer-menu-item.joined:hover .joined-check { display: none; }
button.composer-menu-item.joined:hover .joined-remove { display: inline; color: #b91c1c; }
.composer-menu-item.joined.is-owner { cursor: default; }
/* The owner row never turns into a red "remove" affordance on hover — it is the
   main Agent and stays put. */
.composer-menu-item.joined.is-owner:hover { background: transparent; color: inherit; }
.composer-menu-badge {
    font-size: 10px; font-weight: 500; padding: 1px 7px; border-radius: 999px;
    background: #f1f5f9; color: #64748b;
}
.dark .composer-menu-badge { background: rgba(255,255,255,.08); color: #94a3b8; }
/* The "main Agent" badge is the one standing marker in the roster, so it reads
   in the brand green rather than the muted grey of an ordinary badge. */
.composer-menu-badge.owner-badge { background: #4ABE6E; color: #fff; }
.dark .composer-menu-badge.owner-badge { background: #4ABE6E; color: #fff; }
.composer-menu-item .agent-avatar { flex-shrink: 0; }
.composer-menu-sep { height: 1px; margin: 5px 6px; background: #eef2f6; }
.dark .composer-menu-sep { background: rgba(255, 255, 255, 0.08); }

/* Overlapping faces read as "several people are in here" at a glance, which is
   the only thing this row needs to say. */
.session-faces { display: inline-flex; flex-shrink: 0; }
.session-faces .agent-avatar {
    border: 1.5px solid #fff;
    box-sizing: content-box;
}
.session-faces .agent-avatar + .agent-avatar { margin-left: -8px; }
.dark .session-faces .agent-avatar { border-color: #141414; }
/* A "+N" cap keeps the stack short while still telling how big the group is. */
.session-face-more {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 20px; height: 20px; padding: 0 4px; margin-left: -8px;
    border: 1.5px solid #fff; box-sizing: content-box;
    border-radius: 999px; background: #e2e8f0; color: #475569;
    font-size: 10px; font-weight: 600; line-height: 1;
}
.dark .session-face-more { border-color: #141414; background: #2a2a2a; color: #cbd5e1; }

.bot-face { flex-shrink: 0; line-height: 0; }
.bot-speaker {
    margin: 0 0 4px 2px;
    font-size: 11px; font-weight: 500; color: #64748b;
}
.dark .bot-speaker { color: #94a3b8; }

/* A mention reads as the teammate it names: a rounded chip carrying their face
   and name, so "@我的运营助手" looks addressed rather than typed. */
.mention-tag {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 1px 7px 1px 2px; border-radius: 999px;
    font-weight: 500; line-height: 1;
    /* The chip carries a 16px avatar, so it is taller than the surrounding
       text. `vertical-align: middle` centres it on the font's x-height, which
       for CJK still leaves it sitting a hair low; the small negative shift
       lands its optical centre on the text centre. */
    vertical-align: middle;
    transform: translateY(-1.5px);
    background: rgba(255, 255, 255, .22);
}
.mention-tag-face {
    display: inline-flex; align-items: center; justify-content: center;
    width: 16px; height: 16px; flex-shrink: 0;
}
/* The avatar is an inline <img>; without `block` it rides the text baseline and
   leaves a descender gap that drops it a few px below the name. `block` removes
   that gap so the face and the name share a centre. */
.mention-tag-face .agent-avatar {
    display: block; width: 16px; height: 16px; border-radius: 50%;
}
.mention-tag-name { white-space: nowrap; }
/* In a bot bubble (white surface) the chip needs its own tint to read as a chip. */
.bot-message-group .mention-tag { background: #EDFDF3; color: #17803d; }
.dark .bot-message-group .mention-tag { background: rgba(74, 190, 110, .16); color: #6EE7A0; }

.channel-agent-bind {
    display: flex; align-items: center; gap: 8px;
    margin: 0 0 16px; padding: 10px 12px;
    background: #f8fafc; border-radius: 10px;
}
.dark .channel-agent-bind { background: rgba(255,255,255,.04); }
.channel-agent-bind select {
    flex: 1; min-width: 0;
    padding: 6px 8px; border-radius: 8px;
    border: 1px solid #e2e8f0; background: #fff; font-size: 13px;
}
.dark .channel-agent-bind select { background: #222; border-color: rgba(255,255,255,.1); color: #e2e8f0; }
/* Bind-agent avatar dropdown fills the row like the old <select> did. */
.channel-agent-bind .cfg-dropdown { flex: 1 1 auto; min-width: 0; width: auto !important; }

/* Narrow screens (phones, split panes): the roster takes the full width and the
   detail slides over it as a sheet only once an Agent is picked. Nothing
   selected -> no empty pane hanging around, just the list. */
@media (max-width: 900px) {
    .agents-list-pane { width: 100%; border-right: none; }
    .agent-detail {
        position: absolute; inset: 0; z-index: 20;
        width: 100%; border-left: none;
        box-shadow: none;
    }
    .agent-detail.hidden { display: none; }
    .agent-detail.hidden::before { content: none; }
}
