/*
 * Merdigit AI — Customer Support Agent Workspace.
 *
 * Loaded by both workspace shells (app.layouts.agent, for every Agent Workspace page) and the Platform shell
 * (app.layouts.app, so Company/WhatsApp under Channels can also use the same "cs-*" building blocks). Loading it
 * unconditionally on both is deliberate: these are plain, inert class definitions - a page that never uses a
 * "cs-*" class pays only the (small, cached-once-per-session) download cost, never a behavioural one - and it means
 * one file to keep in sync rather than two.
 *
 * Sections:
 *   1. Agent Workspace sidebar chrome (the workspace header/switcher/business-system chip inside app.layouts.agent -
 *      NOT the shared .sidebar/.nav-item rules, which live in design-system.css and are reused as-is, icons included)
 *   2. The small presentation kit (cs-page/cs-sec/cs-row/...) shared by Overview, Agent, Company, Knowledge, WhatsApp
 *   3. The guided Setup wizard + the shared setup checklist
 *   4. Conversation Workspace (Block 4.1): thread, bubbles, business-context panel
 *   5. Conversations inbox rows
 *   6. The Agent configuration page's own small helpers (section jump nav, sticky save bar, test panel)
 */

/* ── 1. Agent Workspace sidebar chrome ──────────────────────────────────── */
.agent-back { display: flex; align-items: center; gap: 6px; padding: 10px 18px; font-size: 12px; font-weight: 600; color: var(--text-3); text-decoration: none; border-bottom: 1px solid var(--border); transition: color var(--transition-fast); }
.agent-back:hover { color: var(--text-1); }
.agent-back:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.agent-back svg { width: 13px; height: 13px; }
.agent-brand { display: block; padding: 10px 18px 2px; text-decoration: none; }
.agent-header { padding: 8px 18px 10px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.agent-header > div:last-child { min-width: 0; }
.agent-header-icon { width: 34px; height: 34px; border-radius: 9px; background: var(--accent-glow); border: 1px solid rgba(208,46,244,0.25); display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; }
.agent-header-name { font-size: 14px; font-weight: 700; color: var(--text-1); }
.agent-header-tagline { font-size: 11px; color: var(--text-3); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agent-switch { display: block; margin: 10px 18px 0; padding: 7px 10px; border-radius: var(--radius-sm); border: 1px solid var(--border-md); font-size: 12px; font-weight: 600; color: var(--text-2); text-decoration: none; transition: background var(--transition-fast), color var(--transition-fast); }
.agent-switch:hover { background: var(--bg-hover); color: var(--text-1); }
.agent-switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* The current business system, shown as workspace status chrome (not a nav item - it names data, not a destination). */
/* One compact line, so the workspace pages below get the room. */
.cs-provider { margin: 8px 18px 0; padding: 6px 8px; border-radius: var(--radius-sm); border: 1px solid var(--border-md); background: var(--bg-elevated); }
.cs-provider-row { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-1); font-weight: 600; min-width: 0; }
.cs-provider-label { font-size: 11px; font-weight: 500; color: var(--text-3); white-space: nowrap; }
.cs-provider-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.cs-provider-row .badge { font-size: 10.5px; padding: 1px 7px; margin-inline-start: auto; }
.cs-provider-notice { font-size: 11px; line-height: 1.45; color: var(--text-3); margin-top: 4px; }
.cs-provider-manage { display: inline-flex; color: var(--text-3); padding: 2px; border-radius: 6px; }
.cs-provider-manage:hover { color: var(--text-1); background: var(--bg-hover); }
.cs-provider-manage svg { width: 14px; height: 14px; }

/*
 * ── 2. Presentation kit ─────────────────────────────────────────────────
 * Shared building blocks: page width, a titled section (a card with a one-line purpose), field groups, choice chips,
 * read-only key/value rows, and status rows. Every Customer Support page composes these instead of hand-rolling its
 * own card padding/heading size, which is what PART 9 ("same card treatment, same spacing scale") asks for.
 */
.cs-page { max-width: 880px; }
.cs-page.cs-wide { max-width: 1100px; }
.cs-stack { display: flex; flex-direction: column; gap: 14px; }

.cs-sec { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.cs-sec-head { padding: 14px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.cs-sec-title { font-size: 14px; font-weight: 700; color: var(--text-1); line-height: 1.35; }
.cs-sec-desc { font-size: 12px; color: var(--text-3); margin-top: 3px; line-height: 1.55; max-width: 78ch; }
.cs-sec-body { padding: 16px 20px; display: flex; flex-direction: column; gap: 16px; }
.cs-sec-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.cs-field-label { display: block; font-size: 12px; font-weight: 600; color: var(--text-1); margin-bottom: 6px; }
.cs-field-label .cs-opt { font-weight: 400; color: var(--text-3); }
.cs-help { font-size: 11.5px; color: var(--text-3); margin-top: 6px; line-height: 1.55; }
.cs-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 720px) { .cs-grid-2 { grid-template-columns: minmax(0, 1fr); } }

.cs-choices { display: flex; flex-wrap: wrap; gap: 8px; }
/* Used both as a <label> wrapping a checkbox/radio (Agent page choices) and, unchanged otherwise, as a plain <a>
   quick-navigation link (Overview) - text-decoration: none only matters for the latter, a <label> is never underlined. */
.cs-choice { display: inline-flex; align-items: center; gap: 7px; padding: 6px 11px; border: 1px solid var(--border-md); border-radius: var(--radius-sm); font-size: 12.5px; color: var(--text-2); cursor: pointer; background: rgba(255,255,255,0.02); text-decoration: none; }
.cs-choice input { accent-color: var(--accent); margin: 0; }
.cs-choice:hover { border-color: var(--border-lg); color: var(--text-1); }
.cs-choice:has(input:checked) { border-color: var(--accent); color: var(--text-1); background: var(--accent-glow); }
.cs-choice:focus-within, .cs-choice:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.cs-block { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.cs-block-title { font-size: 13px; font-weight: 700; color: var(--text-1); margin-bottom: 10px; }
.cs-switch { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--text-1); cursor: pointer; }
.cs-switch input { accent-color: var(--accent); width: 15px; height: 15px; margin: 0; }
.cs-switch:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.cs-kv { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 8px 16px; font-size: 13px; margin: 0; }
.cs-kv dt { color: var(--text-3); }
.cs-kv dd { margin: 0; color: var(--text-1); word-break: break-word; }
@media (max-width: 560px) { .cs-kv { grid-template-columns: minmax(0, 1fr); gap: 2px; } .cs-kv dd { margin-bottom: 8px; } }

.cs-rows { display: flex; flex-direction: column; }
.cs-row { display: grid; grid-template-columns: 150px minmax(0, 1fr) auto; align-items: center; gap: 6px 16px; padding: 11px 20px; border-top: 1px solid var(--border); }
.cs-row:first-child { border-top: 0; }
.cs-row-label { font-size: 11px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; }
.cs-row-main { display: flex; align-items: center; gap: 6px 10px; flex-wrap: wrap; min-width: 0; font-size: 13px; color: var(--text-1); }
.cs-row-detail { font-size: 12px; color: var(--text-3); }
.cs-row-action { font-size: 12px; font-weight: 600; color: var(--accent); text-decoration: none; white-space: nowrap; }
.cs-row-action:hover { color: #e879f9; text-decoration: underline; }
.cs-row-action:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 640px) { .cs-row { grid-template-columns: minmax(0, 1fr); padding: 12px 16px; } }

.cs-state-glyph { font-weight: 800; margin-right: 5px; }
.cs-note { font-size: 12px; color: var(--text-2); line-height: 1.6; }

/* ── 3. Setup wizard + checklist ─────────────────────────────────────────── */
.cs-setup-progress { font-size: 12px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 6px; }
.cs-setup-track { display: flex; gap: 4px; margin-bottom: 24px; }
.cs-setup-track-seg { flex: 1; height: 4px; border-radius: 2px; background: var(--border); }
.cs-setup-track-seg.done { background: var(--state-success); }
.cs-setup-track-seg.current { background: var(--accent); }
.cs-setup-icon { width: 52px; height: 52px; border-radius: 14px; background: var(--accent-glow); border: 1px solid rgba(208,46,244,0.25); display: flex; align-items: center; justify-content: center; font-size: 24px; margin-bottom: 16px; }

.cs-checklist { display: flex; flex-direction: column; gap: 2px; }
.cs-checklist-item { display: flex; align-items: flex-start; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--border); text-decoration: none; }
.cs-checklist-item:last-child { border-bottom: none; }
.cs-checklist-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.cs-checklist-icon { flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin-top: 1px; }
.cs-checklist-icon.done { background: rgba(34,197,94,0.15); color: var(--state-success); }
.cs-checklist-icon.pending { background: rgba(255,255,255,0.06); border: 1px solid var(--border-md); color: var(--text-3); }
.cs-checklist-icon svg { width: 12px; height: 12px; }
.cs-checklist-label { font-size: 13.5px; font-weight: 600; color: var(--text-1); }
.cs-checklist-desc { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.cs-checklist-action { flex-shrink: 0; font-size: 12px; font-weight: 600; color: var(--accent); align-self: center; }

/*
 * ── 4. Conversation Workspace (Block 4.1) ──────────────────────────────
 * Header, then the thread (its own scroll container) beside the business context. On wide screens the workspace fits
 * the viewport and only the message list scrolls; on narrow screens the page scrolls normally but the message list is
 * still a bounded, independently scrollable box (never the whole history). Relocated from the page's own inline
 * <style> verbatim (including .cs-ws-head's current padding) - this is a file move, not a value change.
 */
.cs-ws { display: flex; flex-direction: column; gap: 12px; max-width: 1280px; margin: 0 auto; }
.cs-ws-head { padding: 50px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; }
.cs-ws-who { min-width: 0; }
.cs-ws-name { font-size: 15px; font-weight: 600; color: var(--text-1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cs-ws-sub { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 4px; font-size: 12px; color: var(--text-3); }
.cs-ws-sub .cs-sep { opacity: .5; }
.cs-ws-actions { display: flex; align-items: center; gap: 8px; }
.cs-ws-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; min-height: 0; }
.cs-ws-thread { display: flex; flex-direction: column; min-width: 0; min-height: 0; padding: 0; position: relative; overflow: hidden; }
.cs-ws-side { padding: 14px 16px; min-width: 0; }
.cs-ws-side > summary { list-style: none; cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--text-1); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cs-ws-side > summary::-webkit-details-marker { display: none; }
.cs-ws-side[open] > summary { margin-bottom: 12px; }
.cs-side-provider { font-size: 11.5px; font-weight: 400; color: var(--text-3); }
.cs-side-block + .cs-side-block { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }

.cs-message-row { display: flex; margin-bottom: 8px; }
.cs-message-row.cs-in { justify-content: flex-start; }
.cs-message-row.cs-out { justify-content: flex-end; }
.cs-bubble { max-width: 78%; border-radius: var(--radius); padding: 8px 12px; }
@media (max-width: 640px) { .cs-bubble { max-width: 92%; } }
.cs-bubble-customer { background: var(--bg-elevated); border: 1px solid var(--border); }
.cs-bubble-ai { background: rgba(208,46,244,0.06); border: 1px solid rgba(208,46,244,0.2); }
.cs-bubble-human { background: rgba(34,197,94,0.06); border: 1px solid rgba(34,197,94,0.2); }
.cs-bubble-meta { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; flex-wrap: wrap; }
.cs-bubble-time { font-size: 10px; color: var(--text-3); }
.cs-bubble-content { white-space: pre-wrap; line-height: 1.55; font-size: 13px; color: var(--text-1); word-break: break-word; }

/* The thread scrolls by itself. overflow-anchor is off because history is prepended and the page's own script
   restores the reader's position explicitly (scrollTop += the height that was added above). */
.cs-message-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-anchor: none; padding: 14px 16px; overscroll-behavior: contain; height: 62dvh; }
.cs-history-top { height: 28px; display: flex; align-items: center; justify-content: center; font-size: 11.5px; color: var(--text-3); }
.cs-history-retry { background: none; border: 0; color: var(--accent); cursor: pointer; font-size: 11.5px; font-family: inherit; }
.cs-new-messages {
    position: absolute; left: 50%; transform: translateX(-50%); bottom: 12px; z-index: 2;
    background: var(--accent); color: #fff; border: 0; border-radius: 999px; padding: 6px 14px; font-size: 12px; font-weight: 600;
    cursor: pointer; box-shadow: var(--shadow); font-family: inherit;
}
.cs-handoff-note { padding: 10px 16px; border-bottom: 1px solid var(--border); background: rgba(208,46,244,0.06); }
.cs-handoff-note[hidden] { display: none; }
.cs-handoff-note-head { font-size: 11.5px; font-weight: 600; color: var(--text-3); margin-bottom: 3px; }
.cs-handoff-note-text { font-size: 13.5px; line-height: 1.5; color: var(--text-1); overflow-wrap: anywhere; }
.cs-pending-strip { padding: 8px 16px; border-top: 1px solid rgba(251,191,36,0.35); border-bottom: 1px solid rgba(251,191,36,0.2); background: rgba(251,176,59,0.06); }
.cs-composer { padding: 10px 16px 12px; border-top: 1px solid var(--border); }

@media (min-width: 1024px) {
    /* Fit the viewport: 100dvh minus the 60px app header and the 24px page padding (top + bottom). */
    .cs-ws { height: calc(100dvh - 60px - 48px); min-height: 460px; }
    .cs-ws-body { grid-template-columns: minmax(0, 1fr) 320px; flex: 1 1 auto; }
    .cs-message-list { height: auto; }
    .cs-ws-side { overflow-y: auto; }
    .cs-ws-side > summary { pointer-events: none; cursor: default; }
}

/*
 * ── 5. Inbox rows ────────────────────────────────────────────────────────
 * Deliberately flex-wrap based rather than a fixed grid-template-columns: a rigid 5-column grid has no way to
 * reflow on narrow screens without a breakpoint per column, and previously just clipped/overlapped on mobile.
 * Wrapping lets the meta row (channel/status/time) drop below the customer/preview text naturally at any width.
 */
.cs-convo-row {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
    gap: 6px 16px; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius);
    text-decoration: none; color: inherit; transition: border-color var(--transition-fast), background var(--transition-fast);
}
.cs-convo-row:hover, .cs-convo-row:focus-visible { border-color: var(--border-lg); background: var(--bg-hover); }
.cs-convo-row:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cs-convo-main { min-width: 0; flex: 1 1 260px; }
.cs-convo-name { font-size: 13.5px; font-weight: 600; color: var(--text-1); }
.cs-convo-preview {
    font-size: 12.5px; color: var(--text-2); margin-top: 3px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cs-convo-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; flex: 0 0 auto; }
.cs-convo-channel { font-size: 11.5px; color: var(--text-3); }
.cs-convo-assignee { font-size: 11px; color: var(--text-2); max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cs-convo-assignee[hidden] { display: none; }
.cs-convo-time { font-size: 11px; color: var(--text-3); white-space: nowrap; }
@media (max-width: 480px) {
    .cs-convo-row { flex-direction: column; align-items: stretch; }
    .cs-convo-meta { justify-content: space-between; }
}

/* ── 6. Agent configuration page ─────────────────────────────────────────── */
.cs-jump { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.cs-jump a { font-size: 12px; font-weight: 600; color: var(--text-2); text-decoration: none; padding: 5px 11px; border: 1px solid var(--border-md); border-radius: 99px; }
.cs-jump a:hover { color: var(--text-1); border-color: var(--border-lg); background: var(--bg-hover); }
.cs-jump a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cs-sec[id] { scroll-margin-top: 12px; }
.cs-savebar { position: sticky; bottom: 0; z-index: 3; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 20px; background: var(--bg-surface); border: 1px solid var(--border-md); border-radius: var(--radius-lg); box-shadow: 0 -6px 18px rgba(0,0,0,.35); }
.cs-question { display: flex; gap: 10px; align-items: center; }
.cs-question .form-input { flex: 1; min-width: 0; }
@media (max-width: 560px) { .cs-question { flex-wrap: wrap; } .cs-savebar .btn { width: 100%; justify-content: center; } }
.cs-test-result { padding: 12px 14px; border: 1px solid var(--border-md); border-radius: var(--radius); }
.cs-test-form { display: flex; gap: 10px; }
@media (max-width: 560px) { .cs-test-form { flex-direction: column; } .cs-test-form .btn { justify-content: center; } }

/* WhatsApp Connection page: the "waiting for QR scan" pulse indicator. */
.cs-whatsapp-pulse-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--state-warning); animation: cs-whatsapp-pulse 1.4s ease-in-out infinite; }
@keyframes cs-whatsapp-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }

/* ── Phase 2J: shared workspace patterns ─────────────────────────────────────────────────────────────────────────
   One way to show "the state of this area" (cs-hero), key numbers that are also links (cs-kpis), a search + view
   switcher that replaces select-and-submit filters (cs-toolbar / cs-seg / cs-search), and lists that read on a phone
   instead of wide tables (cs-list / cs-item). */
.cs-hero { display: flex; gap: 14px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; padding: 18px 20px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg-elevated); }
.cs-hero[data-tone="green"] { border-color: rgba(74,222,128,0.28); }
.cs-hero[data-tone="amber"] { border-color: rgba(251,191,36,0.3); }
.cs-hero[data-tone="red"] { border-color: rgba(248,113,113,0.35); }
.cs-hero-main { min-width: 0; flex: 1 1 260px; }
.cs-hero-kicker { display: inline-flex; align-items: center; gap: 7px; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); margin-bottom: 6px; }
.cs-hero-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); flex: none; }
.cs-hero[data-tone="green"] .cs-hero-dot { background: #4ade80; }
.cs-hero[data-tone="amber"] .cs-hero-dot { background: #fbbf24; }
.cs-hero[data-tone="red"] .cs-hero-dot { background: #f87171; }
.cs-hero-title { margin: 0; font-size: 19px; font-weight: 800; color: var(--text-1); line-height: 1.3; }
.cs-hero-sub { font-size: 13.5px; color: var(--text-2); line-height: 1.55; margin: 4px 0 0; }
.cs-hero-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
@media (max-width: 560px) { .cs-hero-actions { width: 100%; } .cs-hero-actions .btn-primary { flex: 1; justify-content: center; } }

.cs-kpis { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.cs-kpi { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-elevated); text-decoration: none; color: inherit; min-width: 0; }
a.cs-kpi:hover { border-color: var(--border-lg); background: var(--bg-hover); }
a.cs-kpi:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cs-kpi-value { font-size: 24px; font-weight: 800; color: var(--text-1); line-height: 1.15; }
.cs-kpi-label { font-size: 12.5px; color: var(--text-2); }
.cs-kpi[data-attention="1"] { border-color: rgba(251,191,36,0.4); }
.cs-kpi[data-attention="1"] .cs-kpi-value { color: #fbbf24; }

.cs-toolbar { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 12px; }
.cs-seg { display: inline-flex; gap: 4px; flex-wrap: wrap; padding: 3px; border: 1px solid var(--border); border-radius: 10px; background: rgba(255,255,255,0.02); }
.cs-seg a { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; min-height: 32px; border-radius: 8px; font-size: 12.5px; font-weight: 600; color: var(--text-2); text-decoration: none; white-space: nowrap; }
.cs-seg a:hover { color: var(--text-1); background: var(--bg-hover); }
.cs-seg a[aria-current="true"], .cs-seg a[aria-current="page"] { color: var(--text-1); background: var(--accent-glow); }
.cs-seg a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.cs-seg-count { font-size: 11px; font-weight: 700; color: var(--text-3); }
.cs-search { position: relative; flex: 1 1 220px; max-width: 360px; display: flex; gap: 6px; }
.cs-search input { flex: 1; min-width: 0; padding-left: 32px; }
.cs-search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--text-3); pointer-events: none; }
@media (max-width: 560px) { .cs-search { max-width: none; flex-basis: 100%; } .cs-seg { width: 100%; } .cs-seg a { flex: 1; justify-content: center; } }

.cs-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg-elevated); overflow: hidden; }
.cs-item { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; padding: 14px 18px; border-top: 1px solid var(--border); }
.cs-item:first-child { border-top: 0; }
.cs-item-main { min-width: 0; flex: 1 1 260px; }
.cs-item-title { font-size: 14px; font-weight: 600; color: var(--text-1); overflow-wrap: anywhere; }
.cs-item-title a { color: inherit; text-decoration: none; }
.cs-item-title a:hover { text-decoration: underline; }
.cs-item-text { font-size: 13px; color: var(--text-2); line-height: 1.55; margin-top: 4px; overflow-wrap: anywhere; }
.cs-clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.cs-item-meta { display: flex; gap: 6px 12px; flex-wrap: wrap; align-items: center; font-size: 12px; color: var(--text-3); margin-top: 6px; }
.cs-item-side { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.cs-item[data-muted="1"] .cs-item-title { color: var(--text-2); }

.cs-summary { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.cs-summary span { font-size: 11.5px; color: var(--text-2); padding: 2px 8px; border: 1px solid var(--border); border-radius: 99px; }

.cs-disclose > summary { list-style: none; cursor: pointer; }
.cs-disclose > summary::-webkit-details-marker { display: none; }
.cs-disclose > summary .cs-chevron { transition: transform .15s; color: var(--text-3); flex: none; }
.cs-disclose[open] > summary .cs-chevron { transform: rotate(90deg); }
.cs-disclose > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: var(--radius-lg); }

.cs-agent-layout { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 1180px) { .cs-agent-layout { grid-template-columns: minmax(0, 1fr) 360px; } .cs-agent-aside { position: sticky; top: 16px; } }

/* Inbox rows (Phase 2J): the reason a conversation needs a person is written out, not implied by stacked badges. */
.cs-convo-alert { display: flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 12px; font-weight: 600; color: #fbbf24; }
.cs-convo-alert > span[aria-hidden] { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; border-radius: 50%; background: rgba(251,191,36,0.15); font-size: 11px; }
.cs-convo-row[data-attention="1"] { border-color: rgba(251,191,36,0.35); }
.cs-inbox-list { display: grid; gap: 8px; grid-template-columns: minmax(0, 1fr); }

/* Phones (Phase 2J): the top bar already names the page, so the in-page repeat of the title goes; header actions get
   compact so the menu button, title, action and notification bell all fit; a fold's chevron stays beside its text. */
.cs-disclose > summary.cs-sec-head { flex-wrap: nowrap; align-items: center; }
@media (max-width: 640px) {
    .cs-page .page-header-title { display: none; }
    .cs-page .page-header { margin-bottom: 12px; }
    .main-header .header-title { font-size: 15px; line-height: 1.25; }
    .main-header .header-actions { gap: 6px; flex-shrink: 0; }
    .main-header .header-actions .btn { padding: 7px 10px; font-size: 12.5px; }
}

/* Inbox rows on a phone stack vertically: the main column must not keep its 260px basis (it would become a height),
   and name/time share one line with the name truncating instead of pushing the time off-screen. */
.cs-convo-main > div:first-child { min-width: 0; }
.cs-convo-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cs-convo-time { flex: none; }
@media (max-width: 480px) {
    .cs-convo-main { flex: 1 1 auto; width: 100%; }
    .cs-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ── Inbox (Conversations) ───────────────────────────────────────────────────────────────────────────────────────
   Toolbar (search + period, channels), status tabs with counts, a summary line with removable filter chips, and rows
   with a channel avatar. */
.cs-live { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 600; color: var(--text-3); padding: 5px 10px; border: 1px solid var(--border); border-radius: 99px; }
.cs-live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); }
.cs-live[data-state="live"] { color: #4ade80; border-color: rgba(74,222,128,0.3); }
.cs-live[data-state="live"] .cs-live-dot { background: #4ade80; box-shadow: 0 0 0 3px rgba(74,222,128,0.18); }
.cs-live[data-state="reconnecting"] .cs-live-dot { background: #fbbf24; }

.cs-inbox-bar { display: flex; gap: 10px 14px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 10px; }
.cs-inbox-find { display: flex; gap: 8px; align-items: center; flex: 1 1 360px; min-width: 0; max-width: 560px; }
.cs-inbox-find .cs-search { max-width: none; flex: 1 1 auto; }
.cs-inbox-period { width: auto; flex: none; }
.cs-inbox-channels { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.cs-inbox-channels a { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; min-height: 34px; border: 1px solid var(--border-md); border-radius: 99px; font-size: 12.5px; font-weight: 600; color: var(--text-2); text-decoration: none; white-space: nowrap; }
.cs-inbox-channels a:hover { color: var(--text-1); border-color: var(--border-lg); }
.cs-inbox-channels a[aria-current="true"] { color: var(--text-1); background: var(--accent-glow); border-color: rgba(208,46,244,0.45); }
.cs-inbox-channels a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cs-ch-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); }
.cs-ch-dot[data-channel="whatsapp"] { background: #25d366; }
.cs-ch-dot[data-channel="web_chat"] { background: #e879f9; }
.cs-ch-dot[data-channel="telegram"] { background: #29a9eb; }
.cs-ch-dot[data-channel="messenger"] { background: #0a7cff; }
.cs-ch-dot[data-channel="instagram"] { background: #e1306c; }

.cs-inbox-tabs { display: flex; gap: 2px; overflow-x: auto; border-bottom: 1px solid var(--border); margin-bottom: 10px; scrollbar-width: none; }
.cs-inbox-tabs::-webkit-scrollbar { display: none; }
.cs-inbox-tabs a { display: inline-flex; align-items: center; gap: 7px; padding: 10px 12px; font-size: 13px; font-weight: 600; color: var(--text-2); text-decoration: none; white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.cs-inbox-tabs a:hover { color: var(--text-1); }
.cs-inbox-tabs a[aria-current="true"] { color: var(--text-1); border-bottom-color: var(--accent); }
.cs-inbox-tabs a:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.cs-tab-count { font-size: 11px; font-weight: 700; color: var(--text-3); background: rgba(255,255,255,0.06); border-radius: 99px; padding: 1px 7px; }
.cs-tab-count.is-alert { color: #1c1917; background: #fbbf24; }

.cs-inbox-summary { display: flex; gap: 8px 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; font-size: 12.5px; color: var(--text-3); margin-bottom: 10px; }
.cs-inbox-chips { display: inline-flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.cs-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; background: rgba(255,255,255,0.06); color: var(--text-2); text-decoration: none; font-weight: 600; }
.cs-chip:hover { background: rgba(255,255,255,0.1); color: var(--text-1); }
.cs-chip-clear { color: #e879f9; text-decoration: none; font-weight: 600; }

.cs-convo-row { align-items: flex-start; flex-wrap: nowrap; }
.cs-convo-avatar { flex: none; width: 38px; height: 38px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: rgba(255,255,255,0.06); color: var(--text-2); }
.cs-convo-avatar svg { width: 20px; height: 20px; display: none; }
.cs-convo-row[data-channel="whatsapp"] .cs-convo-avatar { background: rgba(37,211,102,0.14); color: #25d366; }
.cs-convo-row[data-channel="whatsapp"] .cs-ch-wa { display: block; }
.cs-convo-row[data-channel="web_chat"] .cs-convo-avatar { background: rgba(232,121,249,0.14); color: #e879f9; }
.cs-convo-row[data-channel="web_chat"] .cs-ch-web, .cs-convo-row:not([data-channel="whatsapp"]):not([data-channel="web_chat"]):not([data-channel="telegram"]):not([data-channel="messenger"]):not([data-channel="instagram"]) .cs-ch-web { display: block; }
.cs-convo-row[data-channel="telegram"] .cs-convo-avatar { background: rgba(41,169,235,0.14); color: #29a9eb; }
.cs-convo-row[data-channel="messenger"] .cs-convo-avatar { background: rgba(10,124,255,0.14); color: #3b95ff; }
.cs-convo-row[data-channel="instagram"] .cs-convo-avatar { background: rgba(225,48,108,0.14); color: #e1306c; }
.cs-convo-row[data-channel="telegram"] .cs-ch-tg, .cs-convo-row[data-channel="messenger"] .cs-ch-fb, .cs-convo-row[data-channel="instagram"] .cs-ch-ig { display: block; }
.cs-convo-top { display: flex; gap: 8px; align-items: baseline; justify-content: space-between; min-width: 0; }
.cs-convo-meta { flex-direction: column; align-items: flex-end; gap: 6px; }
@media (max-width: 640px) {
    .cs-inbox-find { flex-basis: 100%; max-width: none; }
    .cs-inbox-channels { width: 100%; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
    /* More options off to the side: a soft fade says "scroll" (the last item stays reachable). */
    .cs-inbox-channels, .cs-inbox-tabs { -webkit-mask-image: linear-gradient(to right, #000 88%, transparent); mask-image: linear-gradient(to right, #000 88%, transparent); padding-right: 24px; }
    .cs-inbox-channels::-webkit-scrollbar { display: none; }
}
@media (max-width: 480px) {
    .cs-convo-row { flex-direction: row; flex-wrap: wrap; }
    .cs-convo-main { flex: 1 1 0; width: auto; min-width: 0; }
    .cs-convo-meta { flex-direction: row; width: 100%; padding-left: 50px; justify-content: space-between; }
}

/* ── Knowledge: "Tell us about your business" and the review ─────────────────────────────────────────────────── */
.kb-describe { display: grid; gap: 12px; }
.kb-describe-title { font-size: 18px; font-weight: 800; color: var(--text-1); }
.kb-describe-sub { margin: 4px 0 0; font-size: 13.5px; line-height: 1.6; color: var(--text-2); max-width: 680px; }
.kb-describe-prompts { display: flex; flex-wrap: wrap; gap: 6px; }
.kb-prompt { border: 1px dashed var(--border-lg); background: transparent; color: var(--text-2); border-radius: 99px; padding: 5px 12px; font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.kb-prompt:hover { color: var(--text-1); border-color: var(--accent); }
.kb-prompt:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.kb-prompt.is-used { border-style: solid; color: var(--text-3); }
.kb-describe-text { min-height: 220px; resize: vertical; line-height: 1.65; font-size: 14px; }
.kb-describe-foot { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 12px; color: var(--text-3); }
.kb-describe-error { color: #f87171; font-weight: 600; }
.kb-describe-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.kb-describe-note { font-size: 12.5px; color: var(--text-3); }
.kb-spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid rgba(255,255,255,0.35); border-top-color: #fff; border-radius: 50%; animation: kb-spin .8s linear infinite; vertical-align: -2px; }
@keyframes kb-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .kb-spinner { animation: none; } }

.kb-missing { padding: 14px 16px; border: 1px solid rgba(251,191,36,0.35); background: rgba(251,191,36,0.07); border-radius: var(--radius-lg); font-size: 13.5px; line-height: 1.6; color: var(--text-2); margin-bottom: 14px; }
.kb-missing strong { color: var(--text-1); }
.kb-missing-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

.kb-review-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.kb-review-new { margin-top: 10px; }
.kb-review-item { display: grid; gap: 6px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg-elevated); transition: opacity .15s; }
.kb-review-item .cs-field-label { margin: 4px 0 0; }
.kb-review-item.is-new { border-style: dashed; }
.kb-review-item.is-removed { opacity: .45; }
.kb-review-item.is-removed input[type="text"], .kb-review-item.is-removed textarea { text-decoration: line-through; }
.kb-review-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kb-review-num { width: 24px; height: 24px; border-radius: 50%; background: rgba(255,255,255,0.06); color: var(--text-3); font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.kb-review-tag { font-size: 12px; font-weight: 700; color: var(--text-3); }
.kb-review-remove { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--text-2); cursor: pointer; padding: 4px 8px; border-radius: 8px; }
.kb-review-remove:hover { background: rgba(248,113,113,0.1); color: #f87171; }
.kb-review-answer { resize: vertical; line-height: 1.6; }
.kb-review-bar { position: sticky; bottom: 0; z-index: 5; margin-top: 16px; display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px)); border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg-elevated); box-shadow: 0 -8px 24px rgba(0,0,0,0.25); }
.kb-review-summary { font-size: 13px; font-weight: 600; color: var(--text-2); }
.kb-review-actions { display: flex; gap: 8px; align-items: center; }
@media (max-width: 560px) {
    .kb-review-actions { width: 100%; }
    .kb-review-actions .btn-primary { flex: 1; justify-content: center; }
}

/* ── Quick replies: the management list and the composer picker ── */
.cs-qr-item { border-top: 1px solid var(--border); }
.cs-qr-summary { display: flex; align-items: baseline; gap: 12px; padding: 12px 16px; cursor: pointer; list-style: none; }
.cs-qr-summary::-webkit-details-marker { display: none; }
.cs-qr-title { flex: none; font-size: 13.5px; font-weight: 600; color: var(--text-1); }
.cs-qr-preview { flex: 1; min-width: 0; font-size: 13px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cs-qr-form { display: grid; gap: 12px; padding: 4px 16px 16px; }
.cs-qr-tools { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px; }
.cs-qr-picker { position: absolute; left: 0; right: 0; bottom: calc(100% + 6px); z-index: 20; max-height: 260px; overflow-y: auto; background: var(--bg-elevated, #1a1a24); border: 1px solid var(--border-md, rgba(255,255,255,.12)); border-radius: 10px; box-shadow: 0 12px 32px rgba(0,0,0,.45); padding: 4px; }
.cs-qr-picker[hidden] { display: none; }
.cs-qr-option { display: block; width: 100%; text-align: start; background: transparent; border: 0; border-radius: 8px; padding: 8px 10px; color: var(--text-1); cursor: pointer; font: inherit; }
.cs-qr-option[aria-selected="true"], .cs-qr-option:hover { background: rgba(208,46,244,0.14); }
.cs-qr-option-title { display: block; font-size: 13px; font-weight: 600; }
.cs-qr-option-body { display: block; font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cs-qr-empty { padding: 10px; font-size: 12.5px; color: var(--text-3); }
@media (max-width: 639px) {
    #cs-qr-hint { display: none; } /* the reply box placeholder already says "type /" */
    .cs-qr-summary { flex-wrap: wrap; }
    .cs-qr-preview { flex-basis: 100%; order: 3; }
}

/* ── Team schedule (Company information) ── */
.cs-hours { display: grid; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; }
.cs-hours-toggle { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; line-height: 1.5; color: var(--text-2); cursor: pointer; }
.cs-hours-toggle input { margin-top: 3px; accent-color: var(--accent); }
.cs-hours-toggle strong { color: var(--text-1); }
.cs-hours-grid { display: grid; gap: 8px; }
.cs-hours-grid[hidden] { display: none; }
.cs-hours-row { display: grid; grid-template-columns: 130px minmax(0, 1fr) auto minmax(0, 1fr); gap: 8px; align-items: center; }
.cs-hours-day { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--text-1); cursor: pointer; }
.cs-hours-day input { accent-color: var(--accent); }
.cs-hours-sep { color: var(--text-3); }
.cs-hours-row:has(.cs-hours-day input[type="checkbox"]:not(:checked)) input[type="time"] { opacity: .4; }
.cs-hours-row input[type="time"] { min-width: 0; padding-left: 10px; padding-right: 6px; }
.cs-hours-tz { max-width: 280px; margin-top: 4px; }
@media (max-width: 479px) {
    .cs-hours-row { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); }
    .cs-hours-day { grid-column: 1 / -1; }
}

/* ── Performance ── */
.cs-perf-bar { display: flex; flex-wrap: wrap; gap: 10px 16px; justify-content: space-between; }
.cs-perf-tabs { display: flex; flex-wrap: wrap; gap: 4px; padding: 3px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-surface, transparent); }
.cs-perf-tab { font-size: 12.5px; font-weight: 600; color: var(--text-2); text-decoration: none; padding: 5px 10px; border-radius: 7px; }
.cs-perf-tab[aria-current="page"] { background: rgba(208,46,244,0.16); color: var(--text-1); }
.cs-kpi-note { font-size: 12px; color: var(--text-3); line-height: 1.4; }
[data-performance] .cs-kpi-value { font-variant-numeric: tabular-nums; }
@media (min-width: 900px) { .cs-perf-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.cs-perf-question { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; padding: 7px 0; font-size: 13px; color: var(--text-1); border-bottom: 1px solid var(--border); overflow-wrap: anywhere; }
.cs-perf-question:last-child { border-bottom: 0; }
.cs-daily { display: flex; align-items: flex-end; gap: 2px; height: 120px; }
.cs-daily-bar { flex: 1; min-width: 2px; background: rgba(208,46,244,0.55); border-radius: 3px 3px 0 0; }
.cs-daily-bar[data-empty] { background: rgba(255,255,255,0.08); }
.cs-daily-axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-3); margin-top: 6px; }
.cs-perf-grid { align-items: start; }
.cs-hbar { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 6px 0; font-size: 13px; }
.cs-hbar-label { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cs-hbar-track { height: 8px; border-radius: 99px; background: rgba(255,255,255,0.06); overflow: hidden; }
.cs-hbar-track > span { display: block; height: 100%; border-radius: 99px; background: rgba(208,46,244,0.7); }
.cs-hbar-track[data-tone="good"] > span { background: #22c55e; }
.cs-hbar-track[data-tone="mid"] > span { background: #f59e0b; }
.cs-hbar-track[data-tone="low"] > span { background: #ef4444; }
.cs-hbar-value { font-variant-numeric: tabular-nums; color: var(--text-1); font-weight: 600; min-width: 24px; text-align: end; }

/* ── Assignment ── */
.cs-ws-assign { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 12.5px; color: var(--text-2); }
.cs-ws-assign strong { color: var(--text-1); font-weight: 600; }
.cs-assign-form, .cs-routing { display: flex; gap: 8px; align-items: center; font-size: 12.5px; color: var(--text-2); }
.cs-assign-form .form-select, .cs-routing .form-select { width: auto; min-width: 150px; padding: 5px 30px 5px 10px; font-size: 12.5px; }

/* ── Media a customer sent (voice notes, pictures, files) ── */
.cs-bubble-media { margin-top: 8px; }
.cs-bubble-media audio { width: 240px; max-width: 100%; height: 36px; }
.cs-bubble-media img { display: block; max-width: 240px; max-height: 240px; width: auto; height: auto; border-radius: 8px; border: 1px solid var(--border); }

/* ── Agent page ── */
.cs-agent-glance-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.cs-agent-checks { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 8px; }
.cs-agent-checks li { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-1); }
.cs-agent-checks li .card-link { margin-left: auto; }
.cs-agent-check-icon { flex: none; width: 20px; height: 20px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; background: rgba(34,197,94,0.15); color: #4ade80; }
.cs-agent-checks li[data-done="0"] .cs-agent-check-icon { background: rgba(251,191,36,0.15); color: #fbbf24; }
.cs-agent-checks li[data-done="0"] > span:nth-child(2) { color: var(--text-2); }
.cs-agent-step { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; margin-right: 6px; border-radius: 50%; background: rgba(208,46,244,0.16); color: #e879f9; font-size: 11px; font-weight: 700; vertical-align: 1px; }
.cs-agent-row { display: grid; gap: 6px; }
.cs-seg { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 3px; border: 1px solid var(--border-md); border-radius: 10px; background: rgba(255,255,255,0.02); }
.cs-seg-option { position: relative; cursor: pointer; }
.cs-seg-option input { position: absolute; opacity: 0; pointer-events: none; }
.cs-seg-option span { display: inline-block; padding: 6px 12px; border-radius: 7px; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.cs-seg-option input:checked + span { background: rgba(208,46,244,0.18); color: var(--text-1); }
.cs-seg-option input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
.cs-goal-options { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.cs-goal { position: relative; display: grid; gap: 4px; padding: 12px 14px 12px 38px; border: 1px solid var(--border-md); border-radius: 12px; cursor: pointer; background: rgba(255,255,255,0.02); }
.cs-goal input { position: absolute; left: 14px; top: 14px; accent-color: var(--accent); margin: 0; }
.cs-goal:has(input:checked) { border-color: var(--mk-action-line, rgba(208,46,244,0.5)); background: rgba(208,46,244,0.08); }
.cs-goal-title { font-size: 13.5px; font-weight: 700; color: var(--text-1); }
.cs-goal-desc { font-size: 12.5px; color: var(--text-3); line-height: 1.45; }
.cs-agent-more > summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--text-2); }
[data-when-leads][hidden], [data-when-meetings][hidden], [data-when-handoff][hidden], [data-when-orders][hidden] { display: none; }
/* Agent page (owner, 2026-10-15): the goals grouped under their outcome, and each setting in a labelled sub-block. */
.cs-goal-groups { display: grid; gap: 16px; }
.cs-goal-group { display: grid; gap: 8px; }
.cs-goal-group-title { font-size: 12px; font-weight: 700; letter-spacing: 0.02em; color: var(--text-2); }
.cs-sub { display: grid; gap: 8px; padding-top: 14px; border-top: 1px solid var(--border-md); }
.cs-sub-title { font-size: 12.5px; font-weight: 700; color: var(--text-1); }
.cs-goal-badge { justify-self: start; font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 999px; background: rgba(208,46,244,0.14); color: var(--text-1); }
.cs-choice-locked { cursor: default; opacity: 0.9; }
.cs-choice-locked input { pointer-events: none; }
.cs-agent-row > .cs-seg { justify-self: start; }
.cs-agent-checks li .card-link { white-space: nowrap; }

/* ── Knowledge: three ways to build answers ── */
.kb-sources { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.kb-source { border: 1px solid var(--border-md); background: rgba(255,255,255,0.02); color: var(--text-2); border-radius: 99px; padding: 6px 12px; font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.kb-source[aria-selected="true"] { border-color: rgba(208,46,244,0.5); background: rgba(208,46,244,0.14); color: var(--text-1); }
.kb-import[hidden], [data-kb-panel][hidden] { display: none; }
.kb-import { display: grid; gap: 10px; }

/* ── Team notes on a conversation ── */
.cs-note-form { display: grid; gap: 6px; margin-bottom: 10px; }
.cs-note-form .btn { justify-self: start; }
.cs-note-item { padding: 8px 10px; margin-top: 6px; border-radius: 8px; background: rgba(251,191,36,0.06); border: 1px solid rgba(251,191,36,0.18); }
.cs-note-meta { font-size: 11px; color: var(--text-3); margin-bottom: 3px; }
.cs-note-body { font-size: 13px; color: var(--text-1); white-space: pre-wrap; overflow-wrap: anywhere; }
.cs-note-delete { border: 0; background: transparent; color: var(--text-3); font: inherit; font-size: 11px; text-decoration: underline; cursor: pointer; padding: 0 0 0 4px; }
.cs-ws-sidecol { display: flex; flex-direction: column; gap: 12px; min-width: 0; min-height: 0; }
.cs-notes-title { font-size: 13.5px; font-weight: 600; color: var(--text-1); margin-bottom: 10px; }
.cs-notes-title span { font-size: 11.5px; font-weight: 400; color: var(--text-3); }
@media (min-width: 1024px) { .cs-ws-sidecol { overflow-y: auto; } }

/* ── Conversation tags ── */
.cs-tag-list { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.cs-tag { display: inline-flex; align-items: center; gap: 2px; padding: 2px 4px 2px 9px; border-radius: 999px; background: rgba(192,38,211,0.12); border: 1px solid rgba(192,38,211,0.3); font-size: 12px; }
.cs-tag a { color: var(--text-1); text-decoration: none; }
.cs-tag a:hover { text-decoration: underline; }
.cs-tag form { margin: 0; display: inline; }
.cs-tag-remove { border: 0; background: transparent; color: var(--text-3); font-size: 14px; line-height: 1; cursor: pointer; padding: 0 4px; border-radius: 50%; }
.cs-tag-remove:hover { color: var(--text-1); }
.cs-tag-form { display: flex; gap: 6px; }
.cs-tag-form .form-input { flex: 1; min-width: 0; }
.cs-convo-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; font-size: 11px; color: var(--text-3); align-items: center; }
.cs-tag-mini { padding: 1px 7px; border-radius: 999px; background: rgba(192,38,211,0.12); color: var(--text-2); font-size: 11px; }
