/* Background task board, approval inbox and the inline approval card.
   Status palette, shared by lanes, cards and badges:
   queued slate · running sky · waiting amber · done green · failed rose.
   Everything else stays neutral grey. */

/* ---- Board ------------------------------------------------------------- */
.board-summary:empty { display: none; }
.board-summary {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 18px;
    margin-bottom: 12px;
    font-size: 12px;
    color: rgb(var(--cw-slate-400));
}
.board-summary-item { display: inline-flex; align-items: center; gap: 6px; }
.board-summary-item b { font-weight: 600; color: rgb(var(--cw-slate-600)); font-variant-numeric: tabular-nums; }
.dark .board-summary-item b { color: rgb(var(--cw-slate-300)); }
.board-summary-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: rgb(var(--cw-primary-500));
    cursor: pointer;
}
.board-summary-link:hover { color: rgb(var(--cw-primary-600)); }
.board-summary-link.is-quiet { color: rgb(var(--cw-slate-500)); }
.board-summary-link.is-quiet:hover { color: rgb(var(--cw-slate-700)); }
.dark .board-summary-link.is-quiet { color: rgb(var(--cw-slate-400)); }
.dark .board-summary-link.is-quiet:hover { color: rgb(var(--cw-slate-200)); }

/* Five columns that fit one screen, each scrolling on its own: a board you
   have to page down through to reach the second column is not a board. */
.board-lanes {
    display: grid;
    grid-template-columns: repeat(5, minmax(220px, 1fr));
    gap: 12px;
    height: calc(100vh - 260px);
    min-height: 380px;
    overflow-x: auto;
}
.board-lane {
    min-width: 0;
    display: flex;
    flex-direction: column;
    padding: 8px;
    border-radius: 14px;
    background: rgba(241, 245, 249, 0.7);
}
.dark .board-lane { background: rgba(255, 255, 255, 0.03); }
.board-lane-head {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 6px 10px;
}
.board-lane-dot { width: 6px; height: 6px; border-radius: 9999px; flex-shrink: 0; }
.board-lane-title { font-size: 13px; font-weight: 600; color: rgb(var(--cw-slate-700)); }
.dark .board-lane-title { color: rgb(var(--cw-slate-200)); }
.board-lane-count {
    margin-left: auto;
    min-width: 22px;
    padding: 1px 6px;
    border-radius: 6px;
    background: #fff;
    color: rgb(var(--cw-slate-400));
    font-size: 11px;
    font-variant-numeric: tabular-nums;
    text-align: center;
}
.dark .board-lane-count { background: rgba(255, 255, 255, 0.06); color: rgb(var(--cw-slate-400)); }
.board-lane-count.is-alert { background: #FEF3C7; color: #B45309; font-weight: 600; }
.dark .board-lane-count.is-alert { background: rgba(245, 158, 11, 0.18); color: #FCD34D; }
.board-lane-body {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    scrollbar-width: none;
}
.board-lane-body::-webkit-scrollbar { width: 0; display: none; }
.board-lane-empty {
    padding: 28px 8px;
    border: 1px dashed rgb(var(--cw-slate-200));
    border-radius: 12px;
    font-size: 12px;
    color: rgb(var(--cw-slate-300));
    text-align: center;
}
.dark .board-lane-empty { border-color: rgba(255, 255, 255, 0.07); color: rgb(var(--cw-slate-600)); }
.board-lane-more {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 8px 4px;
    border-radius: 8px;
    font-size: 11.5px;
    color: rgb(var(--cw-slate-500));
    cursor: pointer;
    transition: background 0.12s ease, color 0.12s ease;
}
.board-lane-more i { font-size: 9px; }
.board-lane-more:hover { background: rgba(255, 255, 255, 0.8); color: rgb(var(--cw-slate-700)); }
.dark .board-lane-more { color: rgb(var(--cw-slate-400)); }
.dark .board-lane-more:hover { background: rgba(255, 255, 255, 0.05); color: rgb(var(--cw-slate-200)); }

/* All-tasks dialog: segmented filters and one row per task. */
.board-seg {
    display: inline-flex;
    padding: 2px;
    border-radius: 8px;
    background: rgb(var(--cw-slate-100));
}
.dark .board-seg { background: rgba(255, 255, 255, 0.05); }
.board-seg-btn {
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 12px;
    color: rgb(var(--cw-slate-500));
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.12s ease, color 0.12s ease;
}
.board-seg-btn:hover { color: rgb(var(--cw-slate-700)); }
.board-seg-btn.is-active { background: #fff; color: rgb(var(--cw-slate-800)); font-weight: 500; box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06); }
.dark .board-seg-btn { color: rgb(var(--cw-slate-400)); }
.dark .board-seg-btn:hover { color: rgb(var(--cw-slate-200)); }
.dark .board-seg-btn.is-active { background: rgba(255, 255, 255, 0.1); color: rgb(var(--cw-slate-100)); box-shadow: none; }
.board-hrow {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    margin: 0 -12px;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.12s ease;
}
.board-hrow + .board-hrow { border-top: 1px solid rgb(var(--cw-slate-100)); }
.dark .board-hrow + .board-hrow { border-top-color: rgba(255, 255, 255, 0.04); }
.board-hrow:hover { background: rgb(var(--cw-slate-50)); }
.dark .board-hrow:hover { background: rgba(255, 255, 255, 0.03); }
.board-hrow .board-card-dot,
.board-hrow .board-card-pulse { margin-top: 0; }
.board-hrow-main { flex: 1; min-width: 0; }
.board-hrow-main .board-card-sub { margin-top: 3px; }
.board-hrow-title {
    font-size: 13px;
    font-weight: 500;
    color: rgb(var(--cw-slate-800));
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.dark .board-hrow-title { color: rgb(var(--cw-slate-200)); }
.board-hrow-owner { flex-shrink: 0; width: 120px; font-size: 12px; }
.board-hrow-owner .board-card-owner { max-width: 100%; }
.board-hrow-time {
    flex-shrink: 0;
    width: 76px;
    text-align: right;
    font-size: 11px;
    line-height: 1.5;
    color: rgb(var(--cw-slate-400));
    font-variant-numeric: tabular-nums;
}

.dot-queued { background: rgb(var(--cw-slate-300)); }
.dot-running { background: #0EA5E9; }
.dot-waiting { background: #F59E0B; }
.dot-done { background: rgb(var(--cw-primary-500)); }
.dot-failed { background: #F43F5E; }
.dot-cancelled { background: rgb(var(--cw-slate-200)); }
.dark .dot-queued { background: rgb(var(--cw-slate-500)); }
.dark .dot-cancelled { background: rgb(var(--cw-slate-600)); }

/* ---- Cards -------------------------------------------------------------- */
.board-card {
    position: relative;
    flex-shrink: 0;
    padding: 12px 14px;
    border: 1px solid rgb(var(--cw-slate-200));
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.board-card:hover { border-color: rgb(var(--cw-slate-300)); box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04); }
.dark .board-card { border-color: rgba(255, 255, 255, 0.08); background: #1C1C1C; }
.dark .board-card:hover { border-color: rgba(255, 255, 255, 0.18); box-shadow: none; }
.board-card.is-muted .board-card-title { color: rgb(var(--cw-slate-400)); }
/* The running card carries a bar down its left edge, so a glance across the
   board finds what is moving. */
.board-card.is-running::before {
    content: '';
    position: absolute;
    left: 0;
    top: 12px;
    bottom: 12px;
    width: 3px;
    border-radius: 9999px;
    background: #0EA5E9;
}
.board-card-head { display: flex; align-items: flex-start; gap: 8px; padding-right: 14px; }
.board-card-dot { width: 6px; height: 6px; margin-top: 7px; border-radius: 9999px; flex-shrink: 0; }
.board-card-pulse { position: relative; display: flex; width: 8px; height: 8px; margin-top: 5px; flex-shrink: 0; }
.board-card-pulse::before,
.board-card-pulse::after { content: ''; position: absolute; inset: 0; border-radius: 9999px; background: #0EA5E9; }
.board-card-pulse::before { opacity: 0.6; animation: boardPing 1.4s cubic-bezier(0, 0, 0.2, 1) infinite; }
@keyframes boardPing { 75%, 100% { transform: scale(2.2); opacity: 0; } }
.board-card-title {
    flex: 1;
    min-width: 0;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.45;
    color: rgb(var(--cw-slate-800));
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}
.dark .board-card-title { color: rgb(var(--cw-slate-200)); }
.board-card-sub {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    font-size: 11px;
    color: rgb(var(--cw-slate-400));
    min-width: 0;
}
.board-card-sub .sep { color: rgb(var(--cw-slate-300)); }
.dark .board-card-sub .sep { color: rgb(var(--cw-slate-600)); }
.board-card-sub i { font-size: 10px; }
.board-card-id { font-family: 'JetBrains Mono', 'Fira Code', Consolas, monospace; }
.board-card-callout {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    margin-top: 8px;
    padding: 6px 8px;
    border-radius: 8px;
    font-size: 11.5px;
    line-height: 1.5;
}
.board-card-callout i { font-size: 10px; margin-top: 3px; flex-shrink: 0; }
.board-card-callout span {
    min-width: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}
.board-card-callout.is-wait { background: #FFFBEB; color: #B45309; }
.board-card-callout.is-error { background: #FFF1F2; color: #E11D48; }
.dark .board-card-callout.is-wait { background: rgba(245, 158, 11, 0.1); color: #FCD34D; }
.dark .board-card-callout.is-error { background: rgba(244, 63, 94, 0.1); color: #FDA4AF; }
.board-card-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 10px;
    font-size: 11px;
    color: rgb(var(--cw-slate-400));
}
.board-card-owner { display: inline-flex; align-items: center; gap: 6px; min-width: 0; color: rgb(var(--cw-slate-500)); }
.dark .board-card-owner { color: rgb(var(--cw-slate-400)); }
.board-card-owner .agent-avatar { flex-shrink: 0; border-radius: 50%; }
.board-card-owner span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-card-time { flex-shrink: 0; font-variant-numeric: tabular-nums; }
.board-card-time.is-live { color: #0284C7; }
.dark .board-card-time.is-live { color: #7DD3FC; }
.board-card-pill {
    flex-shrink: 0;
    padding: 1px 7px;
    border-radius: 6px;
    background: #FEF3C7;
    color: #B45309;
    font-size: 10.5px;
    font-weight: 500;
}
.dark .board-card-pill { background: rgba(245, 158, 11, 0.15); color: #FCD34D; }
/* Hover action: stop what is active, delete what is finished, without the
   detour through the detail dialog. */
.board-card-action {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    color: rgb(var(--cw-slate-400));
    font-size: 11px;
    opacity: 0;
    cursor: pointer;
    transition: opacity 0.12s ease, background 0.12s ease, color 0.12s ease;
}
.board-card:hover .board-card-action,
.board-card-action:focus-visible { opacity: 1; }
.board-card-action:hover { background: #FFF1F2; color: #F43F5E; }
.dark .board-card-action:hover { background: rgba(244, 63, 94, 0.12); color: #FDA4AF; }

.board-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 1px 7px;
    border-radius: 9999px;
    background: rgb(var(--cw-slate-100));
    color: rgb(var(--cw-slate-500));
    font-size: 10.5px;
    line-height: 16px;
    white-space: nowrap;
}
.dark .board-chip { background: rgba(255, 255, 255, 0.07); color: rgb(var(--cw-slate-400)); }
.board-chip i { font-size: 9px; }

/* ---- Approval block (inbox, task page, chat) ----------------------------- */
.approval-block {
    margin-top: 8px;
    padding: 8px 10px;
    border: 1px solid #FDE68A;
    border-radius: 9px;
    background: #FFFBEB;
}
.dark .approval-block { border-color: rgba(245, 158, 11, 0.28); background: rgba(245, 158, 11, 0.06); }
.approval-block-head {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: #92400E;
}
.dark .approval-block-head { color: #FCD34D; }
.approval-block-head i { font-size: 11px; }
.approval-block-head .aid { margin-left: auto; font-weight: 500; opacity: 0.7; }
.approval-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
}
.approval-actions .grow { flex: 1; }

.board-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 3px 10px;
    border: 1px solid transparent;
    border-radius: 7px;
    font-size: 12px;
    font-weight: 500;
    line-height: 18px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
.board-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.board-btn i { font-size: 10px; }
.board-btn-primary { background: rgb(var(--cw-primary-500)); color: #fff; }
.board-btn-primary:hover:not(:disabled) { background: rgb(var(--cw-primary-600)); }
.board-btn-ghost { border-color: rgb(var(--cw-slate-200)); background: #fff; color: rgb(var(--cw-slate-600)); }
.board-btn-ghost:hover:not(:disabled) { background: rgb(var(--cw-slate-50)); border-color: rgb(var(--cw-slate-300)); }
.dark .board-btn-ghost { border-color: rgba(255, 255, 255, 0.12); background: transparent; color: rgb(var(--cw-slate-300)); }
.dark .board-btn-ghost:hover:not(:disabled) { background: rgba(255, 255, 255, 0.06); }
.board-btn-link { padding: 3px 4px; color: rgb(var(--cw-slate-400)); background: transparent; }
.board-btn-link:hover:not(:disabled) { color: rgb(var(--cw-slate-600)); }
.dark .board-btn-link:hover:not(:disabled) { color: rgb(var(--cw-slate-200)); }

.approval-state {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 500;
}
.approval-state.is-approved { color: rgb(var(--cw-primary-600)); }
.approval-state.is-rejected { color: #DC2626; }
.approval-state.is-expired { color: rgb(var(--cw-slate-400)); }
.dark .approval-state.is-approved { color: rgb(var(--cw-primary-300)); }
.dark .approval-state.is-rejected { color: #FCA5A5; }

/* ---- Header bell + inbox ------------------------------------------------- */
.approval-bell-badge {
    position: absolute;
    top: 3px;
    right: 2px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 9999px;
    background: #EF4444;
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    line-height: 16px;
    text-align: center;
    box-shadow: 0 0 0 2px #fff;
}
.dark .approval-bell-badge { box-shadow: 0 0 0 2px rgb(var(--cw-panel)); }
#approval-bell-btn.has-pending i { animation: bellNudge 2.4s ease-in-out 1; }
@keyframes bellNudge {
    0%, 70%, 100% { transform: rotate(0); }
    75% { transform: rotate(14deg); }
    82% { transform: rotate(-12deg); }
    89% { transform: rotate(6deg); }
}
.approval-inbox {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    width: 380px;
    max-width: calc(100vw - 24px);
    max-height: 72vh;
    display: flex;
    flex-direction: column;
    border: 1px solid rgb(var(--cw-slate-200));
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.14);
    z-index: 60;
    overflow: hidden;
}
.approval-inbox.hidden { display: none; }
.dark .approval-inbox {
    border-color: rgba(255, 255, 255, 0.1);
    background: #1F1F1F;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}
.approval-inbox-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-bottom: 1px solid rgb(var(--cw-slate-100));
}
.dark .approval-inbox-head { border-bottom-color: rgba(255, 255, 255, 0.06); }
.approval-inbox-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: rgb(var(--cw-primary-500));
    cursor: pointer;
}
.approval-inbox-link:hover { color: rgb(var(--cw-primary-600)); }
.approval-inbox-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.approval-inbox-empty {
    padding: 32px 12px;
    text-align: center;
    font-size: 13px;
    color: rgb(var(--cw-slate-400));
}
.approval-inbox-empty i { display: block; font-size: 22px; margin-bottom: 8px; color: rgb(var(--cw-primary-300)); }
.inbox-item .approval-block { margin-top: 0; }
.inbox-item-origin {
    margin-top: 4px;
    font-size: 11px;
    color: rgb(var(--cw-slate-400));
    cursor: pointer;
}
.inbox-item-origin:hover { color: rgb(var(--cw-primary-500)); }

/* ---- Tab badge ------------------------------------------------------------ */
.board-count-badge {
    min-width: 16px;
    height: 16px;
    padding: 0 5px;
    border-radius: 9999px;
    background: #F59E0B;
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    line-height: 16px;
    text-align: center;
}

/* ---- Create dialog ---------------------------------------------------------- */
.board-select-wrap { position: relative; }
.board-select {
    width: 100%;
    appearance: none;
    padding: 8px 32px 8px 12px;
    border: 1px solid rgb(var(--cw-slate-200));
    border-radius: 8px;
    background: rgb(var(--cw-slate-50));
    font-size: 14px;
    color: rgb(var(--cw-slate-800));
    cursor: pointer;
}
.board-select:focus { outline: none; border-color: rgb(var(--cw-primary-500)); }
.dark .board-select { border-color: rgb(var(--cw-slate-600)); background: rgba(255, 255, 255, 0.05); color: rgb(var(--cw-slate-100)); }
.dark .board-select option { background: #1F1F1F; }
.board-select-wrap > i {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 10px;
    color: rgb(var(--cw-slate-400));
    pointer-events: none;
}

/* ---- Task page: a ticket with its activity and properties ------------------ */
/* Same width as the board (max-w-7xl), so opening a task never resizes. */
.td-page { max-width: 80rem; margin: 0 auto; container-type: inline-size; }
.td-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 14px;
    font-size: 13px;
    color: rgb(var(--cw-slate-500));
    cursor: pointer;
    transition: color 0.12s ease;
}
.td-back i { font-size: 11px; }
.td-back:hover { color: rgb(var(--cw-primary-600)); }
.dark .td-back { color: rgb(var(--cw-slate-400)); }
.td-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 20px; }
.td-head-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.td-title {
    font-size: 20px;
    font-weight: 600;
    line-height: 1.35;
    color: rgb(var(--cw-slate-800));
    word-break: break-word;
}
.dark .td-title { color: rgb(var(--cw-slate-100)); }
.td-sub { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 4px; font-size: 12px; color: rgb(var(--cw-slate-400)); }
.td-sub .sep { opacity: 0.6; }
.td-sub-id { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.td-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 28px; align-items: start; }
/* Sized by the page, not the window: the console sidebar takes its share. */
@container (max-width: 900px) { .td-layout { grid-template-columns: minmax(0, 1fr); } .td-side { position: static; } }
.td-main { min-width: 0; }
.td-side {
    position: sticky;
    top: 0;
    padding: 16px;
    border: 1px solid rgb(var(--cw-slate-200));
    border-radius: 12px;
    background: rgb(var(--cw-panel));
}
.dark .td-side { border-color: rgba(255, 255, 255, 0.08); }
.td-side .cfg-dropdown .cfg-dropdown-selected { font-size: 13px; }

/* Entries hang off one thread line, the opening post first. */
.td-activity { position: relative; }
.td-item { position: relative; display: flex; gap: 12px; padding-bottom: 18px; }
.td-item::before, .td-event::before {
    content: '';
    position: absolute;
    left: 15px;
    top: 36px;
    bottom: 0;
    width: 2px;
    background: rgb(var(--cw-slate-100));
}
.dark .td-item::before, .dark .td-event::before { background: rgba(255, 255, 255, 0.06); }
.td-avatar {
    position: relative;
    z-index: 1;
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    border-radius: 9999px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.td-avatar.is-user { background: rgb(var(--cw-slate-100)); color: rgb(var(--cw-slate-500)); font-size: 13px; }
.dark .td-avatar.is-user { background: rgba(255, 255, 255, 0.08); color: rgb(var(--cw-slate-400)); }
.td-item-main { min-width: 0; flex: 1; }
.td-item-head { display: flex; align-items: center; gap: 8px; min-height: 32px; font-size: 13px; }
.td-item-head .grow { flex: 1; }
.td-item-who { font-weight: 600; color: rgb(var(--cw-slate-700)); }
.dark .td-item-who { color: rgb(var(--cw-slate-200)); }
.td-item-what { color: rgb(var(--cw-slate-500)); }
.td-item-time { font-size: 12px; color: rgb(var(--cw-slate-400)); }
.td-item .td-card {
    margin-top: 2px;
    padding: 12px 16px;
    border: 1px solid rgb(var(--cw-slate-200));
    border-radius: 16px;
    background: rgb(var(--cw-panel));
    font-size: 14px;
    line-height: 1.65;
    color: rgb(var(--cw-slate-700));
}
.dark .td-item .td-card { border-color: rgba(255, 255, 255, 0.1); color: rgb(var(--cw-slate-200)); }
.td-item.is-queued .td-card { opacity: 0.65; }
.td-icon-btn { padding: 2px 4px; font-size: 12px; color: rgb(var(--cw-slate-300)); cursor: pointer; transition: color 0.12s ease; }
.td-icon-btn:hover { color: rgb(var(--cw-slate-500)); }
.dark .td-icon-btn { color: rgb(var(--cw-slate-600)); }
.td-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 1px 8px;
    border-radius: 9999px;
    font-size: 11.5px;
    font-weight: 500;
    background: #EEF9F1;
    color: #2F9A52;
}
.td-badge i { font-size: 10px; }
.dark .td-badge { background: rgba(74, 190, 110, 0.12); color: #86EFAC; }
.td-item.is-result .td-card { border-color: rgba(74, 190, 110, 0.45); box-shadow: 0 0 0 3px rgba(74, 190, 110, 0.08); }
.td-trace-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 12px;
    color: rgb(var(--cw-slate-500));
    cursor: pointer;
    transition: background-color 0.12s ease;
}
.td-trace-btn i { font-size: 9px; transition: transform 0.15s ease; }
.td-trace-btn:hover { background: rgb(var(--cw-slate-100)); }
.dark .td-trace-btn { color: rgb(var(--cw-slate-400)); }
.dark .td-trace-btn:hover { background: rgba(255, 255, 255, 0.06); }
.td-item.show-trace .td-trace-btn i { transform: rotate(180deg); }
.td-item.is-agent:not(.show-trace) .agent-steps { display: none; }
.td-queued-tag { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; color: rgb(var(--cw-slate-400)); }
/* The description, under the title like an issue's body. */
.td-desc {
    margin-bottom: 24px;
    border: 1px solid rgb(var(--cw-slate-200));
    border-radius: 12px;
    background: rgb(var(--cw-panel));
}
.dark .td-desc { border-color: rgba(255, 255, 255, 0.08); }
.td-desc-head {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 16px;
    border-bottom: 1px solid rgb(var(--cw-slate-100));
    font-size: 12.5px;
}
.dark .td-desc-head { border-bottom-color: rgba(255, 255, 255, 0.06); }
.td-desc-title { font-weight: 600; color: rgb(var(--cw-slate-700)); }
.dark .td-desc-title { color: rgb(var(--cw-slate-200)); }
.td-desc-meta { color: rgb(var(--cw-slate-400)); }
.td-desc-body { position: relative; padding: 14px 16px; font-size: 14px; line-height: 1.7; color: rgb(var(--cw-slate-700)); }
.dark .td-desc-body { color: rgb(var(--cw-slate-200)); }
.td-desc-body.is-folded { max-height: 320px; overflow: hidden; }
.td-desc-body.is-folded::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 72px;
    background: linear-gradient(to bottom, rgb(var(--cw-panel) / 0), rgb(var(--cw-panel)));
}
.td-desc-more {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 8px;
    border-top: 1px solid rgb(var(--cw-slate-100));
    font-size: 12.5px;
    color: rgb(var(--cw-slate-500));
    cursor: pointer;
}
.td-desc-more i { font-size: 10px; transition: transform 0.15s ease; }
.td-desc-more.is-open i { transform: rotate(180deg); }
.td-desc-more:hover { color: rgb(var(--cw-primary-600)); }
.dark .td-desc-more { border-top-color: rgba(255, 255, 255, 0.06); }
.td-desc-foot { padding: 0 16px 12px; }
.td-desc-jump {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 12.5px;
    cursor: pointer;
}
.td-desc-jump i { font-size: 11px; }
.td-desc-jump.is-done { background: #EEF9F1; color: #2F9A52; }
.td-desc-jump.is-wait { background: #FFFBEB; color: #B45309; }
.dark .td-desc-jump.is-done { background: rgba(74, 190, 110, 0.12); color: #86EFAC; }
.dark .td-desc-jump.is-wait { background: rgba(245, 158, 11, 0.12); color: #FCD34D; }
.td-section-title { margin-bottom: 12px; font-size: 13px; font-weight: 600; color: rgb(var(--cw-slate-500)); }

/* Events (approvals, the end of a run) are slimmer than comments. */
.td-event { position: relative; display: flex; gap: 12px; padding-bottom: 18px; }
.td-event::before { top: 30px; }
.td-event-icon {
    position: relative;
    z-index: 1;
    width: 32px;
    height: 26px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
}
.td-event-icon i {
    width: 24px;
    height: 24px;
    border-radius: 9999px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    background: rgb(var(--cw-slate-100));
    color: rgb(var(--cw-slate-500));
}
.td-event-icon.is-pending i { background: #FEF3C7; color: #D97706; }
.td-event-icon.is-approved i { background: #EEF9F1; color: #2F9A52; }
.td-event-icon.is-rejected i { background: #FEF2F2; color: #DC2626; }
.dark .td-event-icon i { background: rgba(255, 255, 255, 0.08); color: rgb(var(--cw-slate-400)); }
.dark .td-event-icon.is-pending i { background: rgba(245, 158, 11, 0.15); color: #FCD34D; }
.dark .td-event-icon.is-approved i { background: rgba(74, 190, 110, 0.15); color: #86EFAC; }
.dark .td-event-icon.is-rejected i { background: rgba(239, 68, 68, 0.15); color: #FCA5A5; }
.td-event-main { min-width: 0; flex: 1; }
.td-event-line { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; min-height: 26px; font-size: 13px; color: rgb(var(--cw-slate-500)); }
.td-event-line b { font-weight: 600; color: rgb(var(--cw-slate-700)); }
.dark .td-event-line b { color: rgb(var(--cw-slate-200)); }
.td-event-ref { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.td-event-main > .approval-block { margin-top: 4px; }
.td-event-card {
    margin-top: 4px;
    padding: 10px 12px;
    border: 1px solid rgb(var(--cw-slate-200));
    border-radius: 10px;
    font-size: 13px;
}
.dark .td-event-card { border-color: rgba(255, 255, 255, 0.08); }
.td-event-title { font-weight: 500; color: rgb(var(--cw-slate-700)); }
.dark .td-event-title { color: rgb(var(--cw-slate-200)); }
.td-event-details { margin-top: 6px; font-size: 13px; color: rgb(var(--cw-slate-600)); max-height: 240px; overflow-y: auto; }
.dark .td-event-details { color: rgb(var(--cw-slate-300)); }
.td-event-outcome { display: flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 12px; font-weight: 500; }
.td-event-outcome i { font-size: 12px; }
.td-event-outcome.is-approved { color: #2F9A52; }
.td-event-outcome.is-rejected { color: #DC2626; }
.td-event-outcome.is-expired { color: rgb(var(--cw-slate-400)); }
.dark .td-event-outcome.is-approved { color: #86EFAC; }
.dark .td-event-outcome.is-rejected { color: #FCA5A5; }
.td-event-note { margin-top: 4px; font-size: 12.5px; color: rgb(var(--cw-slate-500)); white-space: pre-wrap; word-break: break-word; }
.td-notice {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0 18px 44px;
    font-size: 13px;
    color: rgb(var(--cw-slate-400));
}
.td-composer { padding: 4px 0 0 44px; }
.bd-stream-image { max-width: 600px; border-radius: 8px; margin: 8px 0; cursor: zoom-in; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1); }

/* ---- Properties sidebar ----------------------------------------------------- */
.bd-meta-label { font-size: 12px; color: rgb(var(--cw-slate-400)); margin-bottom: 2px; }
.bd-meta-value { color: rgb(var(--cw-slate-700)); }
.dark .bd-meta-value { color: rgb(var(--cw-slate-200)); }
.bd-section { padding-bottom: 16px; margin-bottom: 16px; border-bottom: 1px solid rgb(var(--cw-slate-100)); }
.bd-section:last-child { padding-bottom: 0; margin-bottom: 0; border-bottom: 0; }
.dark .bd-section { border-bottom-color: rgba(255, 255, 255, 0.06); }
.bd-section-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 12px;
    font-weight: 500;
    color: rgb(var(--cw-slate-500));
}
.bd-section-head .grow { flex: 1; }
.bd-saved { display: inline-flex; align-items: center; gap: 4px; font-weight: 400; font-size: 11.5px; color: rgb(var(--cw-primary-500)); }
.bd-saved i { font-size: 10px; }
.bd-box {
    padding: 10px 12px;
    border: 1px solid rgb(var(--cw-slate-200));
    border-radius: 10px;
    background: rgb(var(--cw-slate-50));
    font-size: 13px;
    color: rgb(var(--cw-slate-800));
    word-break: break-word;
}
.dark .bd-box { border-color: rgba(255, 255, 255, 0.1); background: rgba(255, 255, 255, 0.04); color: rgb(var(--cw-slate-100)); }
.bd-box.is-error { border-color: #FECACA; background: #FEF2F2; color: #DC2626; white-space: pre-wrap; }
.dark .bd-box.is-error { border-color: rgba(239, 68, 68, 0.3); background: rgba(239, 68, 68, 0.08); color: #FCA5A5; }
.bd-head-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 32px;
    padding: 0 12px;
    border-radius: 8px;
    border: 1px solid rgb(var(--cw-slate-200));
    font-size: 13px;
    font-weight: 500;
    color: rgb(var(--cw-slate-600));
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s;
}
.bd-head-btn i { font-size: 11px; }
.bd-head-btn:hover { background: rgb(var(--cw-slate-50)); }
.bd-head-btn.is-danger { width: 32px; padding: 0; justify-content: center; border-color: transparent; color: rgb(var(--cw-slate-400)); }
.bd-head-btn.is-danger:hover { background: #FEF2F2; color: #EF4444; }
.dark .bd-head-btn { border-color: rgba(255, 255, 255, 0.1); color: rgb(var(--cw-slate-300)); }
.dark .bd-head-btn:hover { background: rgba(255, 255, 255, 0.05); }
.dark .bd-head-btn.is-danger { border-color: transparent; color: rgb(var(--cw-slate-500)); }
.dark .bd-head-btn.is-danger:hover { background: rgba(239, 68, 68, 0.1); color: #F87171; }


.bd-facts { display: flex; flex-direction: column; gap: 12px; font-size: 13px; }
.bd-status {
    display: inline-flex;
    align-items: center;
    padding: 1px 8px;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 500;
    background: rgb(var(--cw-slate-100));
    color: rgb(var(--cw-slate-500));
}
.bd-status.is-running { background: #F0F9FF; color: #0284C7; }
.bd-status.is-waiting { background: #FFFBEB; color: #D97706; }
.bd-status.is-done { background: #EEF9F1; color: #2F9A52; }
.bd-status.is-failed { background: #FEF2F2; color: #DC2626; }
.dark .bd-status { background: rgba(255, 255, 255, 0.08); color: rgb(var(--cw-slate-400)); }
.dark .bd-status.is-running { background: rgba(14, 165, 233, 0.12); color: #7DD3FC; }
.dark .bd-status.is-waiting { background: rgba(245, 158, 11, 0.12); color: #FCD34D; }
.dark .bd-status.is-done { background: rgba(74, 190, 110, 0.12); color: #86EFAC; }
.dark .bd-status.is-failed { background: rgba(239, 68, 68, 0.12); color: #FCA5A5; }
.bd-icon-btn { padding: 2px 4px; color: rgb(var(--cw-slate-400)); cursor: pointer; font-size: 11px; transition: color 0.12s ease; }
.bd-icon-btn:hover { color: rgb(var(--cw-primary-500)); }

/* ---- Where a task reports: bot, then chat ------------------------------------- */
.tp-row { display: flex; flex-direction: column; gap: 6px; }
.tp-row .cfg-dropdown.hidden { display: none; }
.tp-hint { display: flex; align-items: flex-start; gap: 6px; margin-top: 6px; font-size: 11.5px; line-height: 1.5; color: rgb(var(--cw-slate-400)); }
.tp-hint i { margin-top: 3px; font-size: 10px; }
.tp-hint.is-warn { color: #B45309; }
.dark .tp-hint.is-warn { color: #FCD34D; }

/* ---- Where a task stops to ask --------------------------------------------- */
.ckpt-list { display: flex; flex-direction: column; gap: 6px; }
.ckpt-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 7px 8px 7px 10px;
    border: 1px solid rgb(var(--cw-slate-200));
    border-radius: 8px;
    font-size: 13px;
    color: rgb(var(--cw-slate-700));
}
.dark .ckpt-item { border-color: rgba(255, 255, 255, 0.1); color: rgb(var(--cw-slate-200)); }
.ckpt-item-icon { margin-top: 3px; font-size: 11px; color: #D97706; }
.ckpt-item-text { flex: 1; min-width: 0; line-height: 1.5; word-break: break-word; }
.ckpt-remove { flex-shrink: 0; padding: 0 4px; font-size: 12px; line-height: 20px; color: rgb(var(--cw-slate-300)); cursor: pointer; }
.ckpt-remove:hover { color: #EF4444; }
.ckpt-empty { font-size: 12.5px; line-height: 1.5; color: rgb(var(--cw-slate-400)); }
.ckpt-add { display: flex; gap: 6px; margin-top: 8px; }
.ckpt-input {
    flex: 1;
    min-width: 0;
    padding: 6px 10px;
    border: 1px solid rgb(var(--cw-slate-200));
    border-radius: 8px;
    background: rgb(var(--cw-slate-50));
    font-size: 13px;
    color: rgb(var(--cw-slate-800));
    outline: none;
    transition: border-color 0.12s ease;
}
.ckpt-input:focus { border-color: rgb(var(--cw-primary-500)); }
.dark .ckpt-input { border-color: rgba(255, 255, 255, 0.12); background: rgba(255, 255, 255, 0.04); color: rgb(var(--cw-slate-100)); }
.ckpt-add-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
    padding: 0 10px;
    border-radius: 8px;
    font-size: 12.5px;
    font-weight: 500;
    color: rgb(var(--cw-primary-600));
    background: rgb(var(--cw-primary-50));
    cursor: pointer;
}
.ckpt-add-btn i { font-size: 10px; }
.ckpt-add-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.dark .ckpt-add-btn { background: rgba(74, 190, 110, 0.12); color: rgb(var(--cw-primary-300)); }
.td-side .ckpt-add { flex-direction: column; }
.td-side .ckpt-add-btn { justify-content: center; height: 30px; }

/* An approval's details are the Agent's own words. */
.approval-block-details {
    margin-top: 6px;
    padding: 8px 10px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.7);
    font-size: 13px;
    color: rgb(var(--cw-slate-700));
    max-height: 320px;
    overflow-y: auto;
}
.approval-block-details.is-compact { max-height: 140px; font-size: 12.5px; }
.dark .approval-block-details { background: rgba(0, 0, 0, 0.25); color: rgb(var(--cw-slate-300)); }
