:root {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.55;
  color: #171717;
  background: #fff;
  --text: #171717;
  --muted: #666;
  --faint: #707070;
  --border: #e5e5e5;
  --border-strong: #d4d4d4;
  --surface: #fff;
  --subtle: #fafafa;
  --primary: #171717;
  --link: #0068d9;
  --focus: #0070f3;
}
* { box-sizing: border-box; }
html { scroll-padding-top: 24px; }
body { margin: 0; min-width: 320px; }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { touch-action: manipulation; }
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  min-height: 36px;
  padding: .45rem .8rem;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-size: .88rem;
  font-weight: 550;
  line-height: 1.35;
  cursor: pointer;
  transition: background .15s, border-color .15s, box-shadow .15s;
}
button:hover { background: #f7f7f7; border-color: #b8b8b8; }
button:active { background: #f0f0f0; }
button:disabled { opacity: .5; cursor: not-allowed; }
button.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
button.primary:hover { background: #333; border-color: #333; }
button.danger { color: #b42318; border-color: #f1c6c1; background: #fff; }
button.danger:hover { background: #fff5f4; }
button.quiet { border-color: transparent; background: transparent; color: var(--muted); }
button.quiet:hover { background: #f5f5f5; color: var(--text); }
.ui-icon { display: inline-block; flex: 0 0 auto; width: 16px; height: 16px; vertical-align: middle; }
.official-link { display: inline-flex; align-items: center; gap: 5px; }
.official-link .ui-icon { width: 13px; height: 13px; }
a { color: var(--link); text-decoration: none; overflow-wrap: anywhere; }
a:hover { text-decoration: underline; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible,
textarea:focus-visible, summary:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
input, select, textarea {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 40px;
  padding: .55rem .75rem;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
}
input:hover, select:hover, textarea:hover { border-color: #a7a7a7; }
input:focus, select:focus, textarea:focus { border-color: var(--focus); }
input::placeholder, textarea::placeholder { color: #929292; }
input[type=checkbox] { display: inline-block; width: auto; min-height: 0; accent-color: var(--primary); }
textarea { resize: vertical; line-height: 1.65; }
h1, h2, h3, p { margin: 0 0 .65rem; }
h1 { font-size: 1.7rem; line-height: 1.25; letter-spacing: -.025em; }
h2 { font-size: 1.18rem; line-height: 1.35; letter-spacing: -.015em; }
h3 { font-size: 1rem; line-height: 1.4; }
.muted, .hint, small { color: var(--muted); }
.hint, small { font-size: .86rem; }
.hint:last-child { margin-bottom: 0; }
.eyebrow { margin-bottom: .35rem; color: var(--faint); font-size: .76rem; font-weight: 650; letter-spacing: .045em; }
.loading { padding: 4rem 1rem; text-align: center; color: var(--muted); }
.card { min-width: 0; margin-bottom: 1rem; padding: 1.2rem; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
.actions { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; }
.actions.compact button { min-height: 32px; padding: .35rem .6rem; font-size: .82rem; }
.field { margin: 0 0 1.1rem; }
.field > label { display: block; margin-bottom: .4rem; font-size: .88rem; font-weight: 650; }
.field > .hint { margin: .4rem 0 0; line-height: 1.55; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1rem; }
.full { grid-column: 1 / -1; }
.check-line { display: flex; align-items: center; gap: .55rem; margin: .9rem 0; font-size: .9rem; }
.badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: .16rem .5rem;
  border: 1px solid #e7e7e7;
  border-radius: 999px;
  background: #f5f5f5;
  color: #5f5f5f;
  font-size: .76rem;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
}
.badge.good { background: #eaf7ee; border-color: #d3ebda; color: #19734b; }
.badge.warn { background: #fff5df; border-color: #f5e4b9; color: #855800; }
.badge.bad { background: #fff0ef; border-color: #f4d8d5; color: #b42318; }
.badge.blue { background: #eef5ff; border-color: #d8e8ff; color: #155fb7; }
.readable { white-space: pre-wrap; overflow-wrap: anywhere; }
.error { color: #b42318; }
.empty { padding: 2rem 1rem; text-align: center; color: var(--muted); }
.notice {
  position: fixed;
  top: 1rem;
  left: 50%;
  z-index: 20;
  width: max-content;
  max-width: min(90vw, 700px);
  padding: .7rem 1rem;
  transform: translateX(-50%);
  border: 1px solid #cfe7d4;
  border-radius: 8px;
  background: #f0faf2;
  box-shadow: 0 8px 30px #00000014;
  color: #17643d;
  font-size: .88rem;
  white-space: pre-wrap;
}
.notice.error { background: #fff5f4; border-color: #f1c6c1; color: #a21d15; }
[hidden] { display: none !important; }

.login { max-width: 440px; margin: 12vh auto; padding: 2rem; border-color: var(--border-strong); box-shadow: 0 16px 48px #0000000a; }
.login .primary { width: 100%; margin-top: .5rem; }
.topbar { border-bottom: 1px solid var(--border); background: var(--surface); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; min-height: 68px; max-width: 1360px; margin: auto; padding: .75rem 1.75rem; }
.brand { display: flex; align-items: center; gap: .65rem; min-width: 0; }
.brand-mark { display: grid; place-items: center; width: 29px; height: 29px; border-radius: 6px; background: var(--primary); color: #fff; font-size: .9rem; font-weight: 750; line-height: 1; }
.brand-copy { display: flex; align-items: baseline; flex-wrap: wrap; gap: .4rem; }
.brand-copy strong { font-size: .9rem; letter-spacing: .015em; }
.brand-copy span { color: var(--muted); font-size: .82rem; }
.topbar .actions { justify-content: flex-end; }
.topbar .actions button { border-color: transparent; background: transparent; color: var(--muted); }
.topbar .actions button:hover { background: #f5f5f5; color: var(--text); }

.workspace { min-height: calc(100vh - 68px); }
.home { max-width: 1360px; margin: auto; padding: 1.6rem 1.75rem 4rem; }
.home-heading { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; margin-bottom: 1.25rem; }
.home-heading-title { display: flex; align-items: baseline; flex-wrap: wrap; gap: .7rem; min-width: 0; }
.home-heading > .actions { flex-shrink: 0; }
.home-heading h1 { margin: 0; font-size: 1.55rem; font-weight: 650; }
.source-count { color: var(--faint); font-size: .82rem; white-space: nowrap; }
.home-heading .primary { min-height: 36px; }
.source-status-summary { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 1px; overflow: hidden; margin-bottom: 1.35rem; border: 1px solid var(--border); border-radius: 8px; background: var(--border); }
.source-summary-item { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: .2rem; min-width: 0; min-height: 75px; padding: .8rem .95rem; border: 0; border-radius: 0; background: var(--surface); text-align: left; }
.source-summary-item:hover { background: var(--subtle); }
.source-summary-item.selected { background: #f7f7f7; box-shadow: inset 0 -2px var(--primary); }
.source-summary-label { color: var(--muted); font-size: .78rem; font-weight: 500; white-space: nowrap; }
.source-summary-value { color: var(--text); font-size: 1.35rem; font-weight: 650; font-variant-numeric: tabular-nums; line-height: 1.2; }
.source-filters { display: grid; grid-template-columns: minmax(220px, 2fr) repeat(3, minmax(140px, 1fr)) auto; align-items: end; gap: .8rem; margin-bottom: 1rem; }
.source-filter-control { min-width: 0; }
.source-filter-control label { display: block; margin-bottom: .35rem; color: var(--muted); font-size: .78rem; font-weight: 550; }
.source-filters input, .source-filters select { width: 100%; min-height: 38px; }
.source-filters .clear-source-filters { min-height: 38px; padding: .4rem .55rem; font-size: .82rem; white-space: nowrap; }
.bot-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .8rem; }
.bot-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-width: 0;
  min-height: 205px;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  text-align: left;
  font-weight: 400;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.bot-card:hover { border-color: #bcbcbc; background: var(--surface); box-shadow: 0 4px 14px #0000000a; }
.bot-card-link { justify-content: flex-start; min-width: 0; min-height: 0; padding: 0; border: 0; border-radius: 0; background: transparent; text-align: left; }
.bot-card-link:hover, .bot-card-link:active { background: transparent; }
.bot-card-link::after { position: absolute; inset: 0; border-radius: 8px; content: ''; }
.bot-card-link:focus-visible { outline: 0; }
.bot-card:has(.bot-card-link:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.bot-card.is-running { border-color: #b9d6f8; box-shadow: inset 2px 0 #3383e9; }
.bot-card.is-running:hover { border-color: #8bbcf6; box-shadow: inset 2px 0 #3383e9, 0 4px 14px #0000000a; }
.bot-card-top { display: flex; align-items: center; justify-content: space-between; gap: .7rem; min-width: 0; }
.bot-name { min-width: 0; overflow-wrap: anywhere; color: var(--text); font-size: 1.03rem; font-weight: 650; line-height: 1.35; }
.bot-card-arrow { color: #999; }
.bot-card:hover .bot-card-arrow { color: var(--text); }
.bot-card-state { display: grid; gap: .4rem; margin-top: .85rem; }
.bot-card-state-main { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .35rem .65rem; min-width: 0; }
.bot-card-monitor { color: var(--faint); font-size: .75rem; white-space: nowrap; }
.bot-card .badge { font-size: .78rem; }
.status-reason-wrap { position: relative; z-index: 1; display: inline-flex; }
.status-reason-badge { position: relative; min-height: 0; cursor: help; }
.status-reason-badge:hover { border-color: currentColor; }
.status-reason-tooltip { position: absolute; bottom: calc(100% + 8px); left: 0; z-index: 8; width: max-content; max-width: min(300px, calc(100vw - 64px)); padding: 8px 10px; border-radius: 6px; background: var(--text); color: #fff; font-size: 12px; font-weight: 400; line-height: 1.6; text-align: left; white-space: normal; overflow-wrap: anywhere; visibility: hidden; opacity: 0; }
.status-reason-tooltip::after { position: absolute; top: 100%; left: 12px; width: 8px; height: 8px; background: var(--text); transform: translateY(-50%) rotate(45deg); content: ''; }
.status-reason-wrap:not([data-dismissed=true]):hover .status-reason-tooltip,
.status-reason-wrap:not([data-dismissed=true]):focus-within .status-reason-tooltip,
.status-reason-wrap[data-open=true] .status-reason-tooltip { visibility: visible; opacity: 1; }
.bot-card.is-running .badge { animation: bot-badge-pulse 2s ease-in-out infinite; }
@keyframes bot-badge-pulse { 50% { box-shadow: 0 0 0 4px #2183eb1b; } }
.bot-card-metrics { margin-top: .8rem; padding-top: .65rem; border-top: 1px solid var(--border); }
.bot-card-metrics-heading { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; color: var(--muted); font-size: .75rem; }
.bot-card-metrics-heading span:last-child:not(:first-child) { color: var(--faint); font-size: .72rem; }
.bot-card-metric-values { display: flex; align-items: baseline; gap: 1.15rem; margin-top: .2rem; }
.bot-card-metric { display: inline-flex; align-items: baseline; gap: .3rem; font-variant-numeric: tabular-nums; }
.bot-card-metric strong { color: var(--text); font-size: 1.35rem; font-weight: 650; line-height: 1.25; }
.bot-card-metric > span { color: var(--muted); font-size: .76rem; }
.bot-card-metric + .bot-card-metric { padding-left: 1.15rem; border-left: 1px solid var(--border); }
.bot-card-metric-empty { display: flex; align-items: baseline; gap: .45rem; margin-top: .25rem; color: var(--faint); font-size: .8rem; }
.bot-card-metric-empty strong { font-size: 1.25rem; font-weight: 450; line-height: 1.25; }
.bot-card-time { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: .15rem .75rem; margin-top: auto; padding-top: .7rem; color: var(--faint); font-size: .76rem; font-weight: 400; }
.bot-card-time time { font-variant-numeric: tabular-nums; }
.recent-task-time { color: var(--faint); font-size: .78rem; font-variant-numeric: tabular-nums; }
.bot-run-note { font-size: .78rem; font-weight: 600; }
.bot-run-note.active { color: #155fb7; }
.bot-run-note.problem { color: #b42318; }
.empty-bots { grid-column: 1 / -1; padding: 4rem 1rem; border: 1px dashed var(--border-strong); border-radius: 8px; background: var(--subtle); }
.empty-bots h3 { color: var(--text); font-size: 1.08rem; }
.empty-bots button { margin-top: .6rem; }

.content { max-width: 1360px; margin: auto; padding: 1.5rem 1.75rem 4rem; min-width: 0; }
html:has(.content:not([hidden])) { scrollbar-gutter: stable; }
html:has(.detail-dialog[open]) { overflow: hidden; }
.back-button { min-height: 32px; margin: 0 0 .75rem -.65rem; padding: .3rem .65rem; color: var(--muted); }
.source-heading { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; margin-bottom: 1.35rem; }
.source-heading h1 { min-width: 0; margin: 0; overflow-wrap: anywhere; font-size: 1.48rem; font-weight: 650; letter-spacing: -.025em; }
.source-heading-actions { display: flex; align-items: center; justify-content: flex-end; flex: 0 0 auto; gap: .55rem; }
.source-heading-actions a { padding: .35rem .55rem; color: var(--muted); font-size: .83rem; }
.source-heading-actions a:hover { color: var(--text); }
.source-heading-actions button { min-height: 32px; padding: .32rem .6rem; font-size: .82rem; }
.scope { margin: .7rem 0; color: #444; }
.task-workspace { display: grid; grid-template-columns: 248px minmax(0, 1fr); align-items: start; gap: 1.25rem; margin-top: 0; }
.task-main { min-width: 0; overflow: visible; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.task-board { min-width: 0; margin: 0; }
.task-board-heading { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .75rem; }
.task-board-heading h2 { margin: 0; font-size: 1rem; font-weight: 650; white-space: nowrap; }
.task-board-new { flex: 0 0 auto; width: auto; min-height: 32px; margin: 0; padding: .33rem .55rem; font-size: .78rem; }
.task-cards { display: grid; grid-template-columns: minmax(0, 1fr); gap: .55rem; max-height: min(68vh, 760px); overflow: auto; padding: .1rem; }
.task-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: .5rem;
  width: 100%;
  min-width: 0;
  min-height: 82px;
  padding: .8rem .9rem;
  border-color: var(--border);
  border-radius: 8px;
  background: #fff;
  text-align: left;
}
.task-card:hover { border-color: #c8c8c8; background: var(--subtle); }
.task-card[aria-current=true] { border-color: #c8c8c8; border-left: 2px solid var(--text); background: var(--subtle); box-shadow: none; }
.task-card[aria-current=true]:hover { border-color: #c8c8c8; border-left-color: var(--text); }
.task-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: .45rem; }
.task-card-top strong { overflow-wrap: anywhere; font-size: .88rem; font-weight: 600; line-height: 1.4; }
.task-card-footer { display: flex; align-items: center; justify-content: space-between; gap: .4rem; margin-top: auto; }
.task-card-footer .run-time { margin-top: 0; }
.task-activity { color: var(--link); font-size: .75rem; white-space: nowrap; }
.task-pagination { margin: .25rem 0 .7rem; }
.task-detail-heading { position: relative; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-width: 0; min-height: 64px; padding: .9rem 1.25rem; border-bottom: 1px solid var(--border); border-radius: 8px 8px 0 0; background: var(--surface); }
.task-detail-heading > div { min-width: 0; }
.task-detail-heading > div:first-child { flex: 1 1 auto; }
.task-title-row { display: flex; align-items: center; flex-wrap: wrap; gap: .55rem; }
.task-detail-heading h2 { margin: 0; font-size: 1.1rem; font-weight: 650; overflow-wrap: anywhere; }
.task-detail-heading .eyebrow { margin-bottom: .25rem; }
.task-description { max-width: 860px; margin: .4rem 0 0; color: var(--muted); font-size: .85rem; line-height: 1.65; }
.task-detail-heading .danger { flex-shrink: 0; }
.task-scope-warning { margin: .65rem 0 0; color: #966000; font-size: .85rem; }
.task-header-actions { display: flex; align-items: center; gap: .35rem; flex: 0 0 auto; }
.task-header-actions > button { min-height: 32px; padding: .32rem .6rem; font-size: .82rem; }
.task-header-actions > .task-conversation-button { border-color: var(--border-strong); background: var(--surface); color: var(--text); }
.task-header-actions > .task-conversation-button:hover { border-color: #b8b8b8; background: var(--subtle); }
.task-info-content { display: grid; gap: .55rem; }
.task-info-content h3, .task-info-content p { margin: 0; }
.task-info-content h3 { font-size: 1rem; }
.task-info-content p { line-height: 1.65; }
.task-actions-menu { position: relative; margin: 0; padding: 0; border: 0; }
.task-actions-menu[open] { border: 0; }
.task-actions-menu > summary { display: inline-flex; align-items: center; min-height: 32px; padding: .32rem .65rem; border: 1px solid transparent; border-radius: 6px; background: var(--surface); color: var(--muted); font-size: .82rem; font-weight: 550; list-style: none; }
.task-actions-menu > summary:hover { background: var(--subtle); }
.task-actions-menu > summary::-webkit-details-marker { display: none; }
.task-actions-menu > summary .disclosure-icon { margin-left: 6px; width: 14px; height: 14px; color: var(--muted); }
.task-actions-menu[open] > summary { margin-bottom: 0; }
.task-menu-items { position: absolute; top: calc(100% + .35rem); right: 0; z-index: 5; display: grid; gap: .1rem; width: max-content; min-width: 160px; padding: .25rem; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); box-shadow: 0 10px 30px #00000018; }
.task-menu-items > button, .task-menu-items > a { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 32px; justify-content: flex-start; padding: .4rem .65rem; border: 0; border-radius: 6px; background: transparent; color: var(--text); font-size: .82rem; font-weight: 550; line-height: 1.35; text-decoration: none; }
.task-menu-items > button:hover, .task-menu-items > a:hover { background: var(--subtle); }
.task-menu-items > button.danger { color: #b42318; }
.task-menu-items > button.danger:hover { background: #fff5f4; }
.task-reset-message { margin-top: .85rem; padding: .75rem .9rem; border: 1px solid var(--border); border-radius: 6px; background: var(--subtle); font-size: .84rem; }
.task-reset-message strong { display: block; margin-bottom: .2rem; color: var(--text); }
.task-reset-message p { margin: 0; color: var(--muted); }
.task-reset-message button { margin-top: .6rem; }
.task-reset-message.error { border-color: #f1c6c1; background: #fff5f4; }
.task-panel { min-width: 0; padding: 1.15rem 1.25rem 1.5rem; }
.task-panel[hidden] { display: none !important; }

.conversation { display: flex; flex-direction: column; min-height: 440px; overflow: hidden; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.message-paging { text-align: center; }
.message-paging:empty { display: none; }
.message-paging button { min-height: 31px; margin: 1rem 0 0; padding: .3rem .7rem; font-size: .8rem; }
.messages { min-height: 220px; max-height: 58vh; overflow: auto; padding: 1.35rem 1.4rem; scrollbar-gutter: stable; }
.chat-message { max-width: 90%; padding: .85rem 1rem; margin: 0 0 .9rem; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); }
.chat-message:last-child { margin-bottom: 0; }
.chat-message.user { margin-left: auto; background: #f6f6f6; border-color: #ececec; }
.chat-message.assistant { margin-right: auto; background: #fff; }
.chat-message.system { max-width: 100%; padding: .55rem .75rem; background: var(--subtle); border-color: transparent; color: var(--muted); }
.message-meta { display: flex; align-items: center; flex-wrap: wrap; gap: .3rem .65rem; margin-bottom: .4rem; color: var(--faint); font-size: .76rem; }
.message-meta strong { color: var(--text); font-weight: 650; }
.message-meta time, .run-time { font-variant-numeric: tabular-nums; }
.message-body { white-space: pre-wrap; overflow-wrap: anywhere; font-size: .91rem; line-height: 1.75; }
.chat-empty { padding: 3rem 1rem; color: var(--muted); text-align: center; }
.chat-empty h2 { color: var(--text); }
.chat-empty p { max-width: 520px; margin: 0 auto; }
.chat-status { display: flex; align-items: center; gap: .6rem; padding: .65rem 1.4rem; border-top: 1px solid var(--border); background: var(--subtle); color: var(--muted); font-size: .84rem; }
.composer { padding: 1rem 1.35rem; border-top: 1px solid var(--border); background: var(--subtle); }
.composer textarea { min-height: 86px; max-height: 260px; background: #fff; }
.composer-footer { display: flex; align-items: center; justify-content: space-between; gap: .8rem; padding-top: .65rem; }
.composer-footer .hint { max-width: 75%; color: var(--faint); font-size: .78rem; }
.composer .error { margin: .5rem 0 0; font-size: .84rem; }
.composer button { min-width: 76px; }

.task-main > details { margin: .85rem 0 0; background: var(--surface); }
.task-main > details .card { margin: 0; padding: .55rem 0; border: 0; }
.task-main > details .card h2 { font-size: 1.05rem; }
.history-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .55rem; }
.history-list .pagination { grid-column: 1 / -1; }
.history-section { margin-bottom: 0; }
.history-button { display: block; width: 100%; min-height: 100px; padding: .75rem; text-align: left; }
.history-button[aria-current=true] { border-color: var(--text); background: var(--subtle); }
.history-button .status-row { gap: .4rem; margin: .35rem 0; }
.run-time { display: block; color: var(--faint); font-size: .78rem; }
.status-row { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem 1rem; margin: .65rem 0; }
.stat-line { display: flex; flex-wrap: wrap; gap: 1rem; margin: .7rem 0; color: var(--muted); font-size: .85rem; }
.connection-summary { margin: .8rem 0; padding: .8rem 1rem; border: 1px solid var(--border); border-radius: 6px; background: var(--subtle); font-size: .88rem; }
.connection-summary p { margin: .35rem 0 0; }
.result-view { display: grid; gap: .8rem; min-width: 0; }
.result-view > :first-child:empty { display: none; }
.result-run-picker { display: flex; align-items: center; flex-wrap: wrap; gap: .35rem .85rem; padding-bottom: .75rem; border-bottom: 1px solid var(--border); }
.result-run-picker label { flex: 0 0 auto; color: var(--muted); font-size: .82rem; font-weight: 600; }
.result-run-select { flex: 1 1 auto; width: min(100%, 550px); max-width: 550px; min-width: 0; }
.result-run-picker .hint { flex-basis: 100%; margin: 0; }
.result-run-pager { display: flex; justify-content: flex-end; gap: .5rem; margin-top: .7rem; }
.result-run-pager button { min-height: 31px; padding: .35rem .65rem; font-size: .8rem; }
.result-overview { display: grid; gap: .7rem; min-width: 0; }
.result-overview > p { margin: 0; }
.result-run-error { margin: 0; padding: .7rem .9rem; border: 1px solid #f1c6c1; border-radius: 6px; background: #fff5f4; font-size: .85rem; }
.result-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-width: 0; border-bottom: 1px solid var(--border); }
.result-toolbar-actions { display: flex; align-items: center; flex: 0 0 auto; gap: .45rem; }
.result-toolbar-actions button { min-height: 32px; padding: .35rem .6rem; font-size: .81rem; }
.result-explanation-button .explanation-attention { width: 15px; height: 15px; color: #855800; }
.result-delivery-meta { display: flex; align-items: center; flex-wrap: wrap; gap: .35rem .75rem; margin: 0; color: var(--faint); font-size: .78rem; font-variant-numeric: tabular-nums; }
.result-activity { display: flex; align-items: center; flex-wrap: wrap; gap: .45rem; margin: 0; color: var(--muted); font-size: .82rem; }
.result-notice { min-width: 0; padding: .75rem .9rem; border: 1px solid var(--border); border-radius: 6px; background: var(--subtle); color: var(--text); font-size: .84rem; }
.result-notice.warn { border-color: #f0dbab; background: #fffbf0; }
.result-notice.error { border-color: #f1c6c1; background: #fff5f4; }
.result-notice strong, .result-notice h3 { display: block; margin: 0 0 .2rem; font-size: .87rem; }
.result-notice p { margin: 0; color: var(--muted); line-height: 1.6; }
.result-notice .actions { margin-top: .6rem; }
.result-notice > details { margin: .55rem 0 0; padding: .5rem 0 0; border: 0; border-top: 1px solid var(--border); border-radius: 0; background: transparent; }
.result-notice > details > summary { color: var(--muted); font-size: .82rem; }
.result-notice > details[open] > summary { margin-bottom: .45rem; }
.result-notice > details > ul { margin: 0; padding-left: 1.2rem; }
.collection-explanation-content { display: grid; gap: .85rem; min-width: 0; }
.collection-explanation-content section + section { padding-top: .9rem; border-top: 1px solid var(--border); }
.collection-explanation-content h3 { margin: 0 0 .4rem; font-size: .88rem; }
.collection-explanation-content p { margin: 0; font-size: .88rem; line-height: 1.7; }
.collection-explanation-content .issues { margin: 0; }
.collection-explanation-content .knowledge { max-height: 360px; padding: .8rem; border: 1px solid var(--border); border-radius: 6px; background: var(--subtle); }
.collection-explanation-content .knowledge + .hint { margin-top: .55rem; }
.knowledge-entry-points { margin: .65rem 0; font-size: .88rem; overflow-wrap: anywhere; }
.knowledge-entry-points ul { margin: .35rem 0; padding-left: 1.3rem; }
.knowledge-entry-points li + li { margin-top: .25rem; }
.receipt-details { margin: 0; }
.result-tabs { display: flex; align-items: stretch; flex-wrap: wrap; gap: .2rem; min-width: 0; margin: 0; border: 0; }
.result-tabs button { margin-bottom: -1px; padding: .58rem .7rem; border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent; color: var(--muted); font-size: .85rem; font-weight: 600; white-space: nowrap; }
.result-tabs button:hover { background: var(--subtle); color: var(--text); }
.result-tabs button[aria-pressed=true] { border-bottom-color: var(--text); color: var(--text); }
.result-item { padding: 1.2rem 0; border-top: 1px solid var(--border); }
.result-item:first-child { border-top: 0; }
.result-item h3 { overflow-wrap: anywhere; font-size: 1.02rem; }
.result-entries { display: grid; min-width: 0; }
.result-entries .result-item { min-width: 0; margin: 0; padding: 0; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; }
.result-entries .result-item:last-child { border-bottom: 0; }
.result-item-summary { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 35%) 64px 16px; align-items: center; gap: .75rem; min-width: 0; padding: .85rem .1rem; color: var(--text); }
.result-item-summary h3, .result-item-summary strong { grid-column: 1; min-width: 0; margin: 0; font-size: .91rem; font-weight: 600; line-height: 1.5; overflow-wrap: anywhere; }
.result-item-category { grid-column: 2; color: var(--muted); font-size: .86rem; font-weight: 400; line-height: 1.5; overflow-wrap: anywhere; }
.result-item-warning { grid-column: 3; color: #855800; font-size: .76rem; font-weight: 600; white-space: nowrap; }
.result-item-summary:not(:has(> .result-item-category)) { grid-template-columns: minmax(0, 1fr) auto 16px; }
.result-item-summary:not(:has(> .result-item-category)) .result-item-warning { grid-column: 2; }
.result-item-summary .result-meta { justify-content: flex-end; margin: 0; }
.result-item-content { min-width: 0; padding: 0 .1rem 1.15rem; }
.result-item-content .result-body { margin: .75rem 0; }
.result-body { max-height: 380px; overflow: auto; margin: .7rem 0; padding: .9rem; border: 1px solid var(--border); border-radius: 8px; background: var(--subtle); white-space: pre-wrap; overflow-wrap: anywhere; font-size: .88rem; line-height: 1.7; }
.result-meta { display: flex; align-items: center; flex-wrap: wrap; gap: .4rem; margin: .6rem 0; }
.issues { margin: .8rem 0; padding: .8rem 1rem; border-left: 3px solid #d8a52a; background: #fffbf0; }
.issues ul { margin: .35rem 0; padding-left: 1.25rem; }
.issues li { white-space: pre-wrap; overflow-wrap: anywhere; font-size: .86rem; }
.knowledge { max-height: 500px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; font-size: .9rem; }
.result-empty { padding: 1.1rem; color: var(--muted); }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin: 1rem 0; color: var(--faint); font-size: .8rem; }

details { margin: .8rem 0; padding: .85rem 1rem; border: 1px solid var(--border); border-radius: 7px; }
details[open] { border-color: var(--border-strong); }
summary { cursor: pointer; color: var(--text); font-size: .88rem; font-weight: 650; }
summary:has(> .disclosure-icon) { display: flex; align-items: center; justify-content: space-between; gap: 8px; list-style: none; }
summary:has(> .disclosure-icon)::-webkit-details-marker { display: none; }
summary > .disclosure-icon { color: var(--faint); }
details[open] > summary > .disclosure-icon { transform: rotate(180deg); }
details[open] > summary { margin-bottom: .8rem; }
.result-issues { margin: 0; padding: .75rem 1rem; border-color: #f5e4b9; background: #fffbf0; }
.result-issues[open] { border-color: #e6ca88; }
.result-issues > summary { color: #855800; }
.result-issues > ul { margin: .75rem 0 0; padding-left: 1.2rem; }
.result-issues > ul li { white-space: pre-wrap; overflow-wrap: anywhere; font-size: .86rem; line-height: 1.65; }
.result-issues .issues { margin: .75rem 0 0; padding: 0; border: 0; background: transparent; }
.result-entries details.result-item > summary.result-item-summary { display: grid; margin-bottom: 0; list-style: none; }
.result-entries details.result-item > summary.result-item-summary::-webkit-details-marker { display: none; }
.result-entries details.result-item > summary.result-item-summary > .disclosure-icon { grid-column: 4; justify-self: end; }
.result-entries details.result-item > summary.result-item-summary:not(:has(> .result-item-category)) > .disclosure-icon { grid-column: 3; }
.result-entries details.result-item > summary.result-item-summary:hover { color: #000; }
.budget-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 .75rem; }
.dialog { width: min(740px, calc(100vw - 32px)); max-height: min(90vh, 880px); overflow: auto; padding: 1.5rem; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); color: var(--text); box-shadow: 0 24px 80px #00000029; }
.dialog::backdrop { background: #11111180; }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.35rem; padding-bottom: .9rem; border-bottom: 1px solid var(--border); }
.dialog-head h2 { margin: 0; font-size: 1.15rem; }
.dialog-head button { min-height: 29px; padding: .25rem .5rem; }
.dialog-actions { display: flex; justify-content: flex-end; gap: .6rem; margin-top: 1.3rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.import-errors ul { margin: .75rem 0; padding-left: 1.3rem; overflow-wrap: anywhere; }
.import-results { list-style: none; margin: 1rem 0; padding: 0; max-height: 45vh; overflow: auto; }
.import-results li { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .7rem 0; border-bottom: 1px solid var(--border); }
.import-results li > div { min-width: 0; overflow-wrap: anywhere; }
.import-results strong, .import-results .hint { display: block; }
.import-results .badge { flex-shrink: 0; }
.dialog.detail-dialog { border-color: var(--border); border-radius: 8px; box-shadow: 0 20px 64px #00000024; }
.detail-dialog .dialog-head { align-items: center; gap: 1.25rem; }
.detail-dialog .dialog-heading { min-width: 0; }
.detail-dialog .dialog-head h2 { font-size: 1.08rem; font-weight: 650; }
.detail-dialog .dialog-close { flex: 0 0 auto; min-width: 32px; min-height: 32px; }
.detail-dialog .conversation-context { margin: .2rem 0 0; color: var(--muted); font-size: .78rem; line-height: 1.45; overflow-wrap: anywhere; }
.dialog.detail-dialog.conversation-dialog { width: min(940px, calc(100vw - 64px)); height: min(760px, calc(100dvh - 64px)); max-height: min(760px, calc(100dvh - 64px)); overflow: hidden; padding: 0; }
.dialog.detail-dialog.conversation-dialog[open] { display: flex; flex-direction: column; }
.conversation-dialog > .dialog-head { flex: 0 0 auto; margin: 0; padding: 1rem 1.25rem; }
.detail-dialog.conversation-dialog > .conversation { flex: 1 1 auto; min-height: 0; overflow: hidden; border: 0; border-radius: 0; }
.conversation-dialog .message-paging { flex: 0 0 auto; }
.conversation-dialog .messages { flex: 1 1 auto; min-height: 0; max-height: none; overflow: auto; overscroll-behavior: contain; padding: 1.25rem 1.5rem; }
.conversation-dialog .chat-status { flex: 0 0 auto; }
.conversation-dialog .composer { flex: 0 0 auto; padding: 1rem 1.25rem; }
.conversation-dialog .composer textarea { min-height: 76px; max-height: 160px; }

@media (max-width: 1120px) {
  .source-status-summary { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .source-filters { grid-template-columns: minmax(220px, 2fr) repeat(2, minmax(140px, 1fr)); }
  .source-filter-sort { grid-column: 1 / 2; }
  .source-filters .clear-source-filters { justify-self: start; }
  .bot-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .history-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 880px) {
  .task-workspace { display: block; margin-top: 1.5rem; }
  .task-board { margin-bottom: 1.1rem; }
  .task-board-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
  .task-board-new { width: auto; margin-top: 0; }
  .task-cards { display: flex; max-height: none; overflow-x: auto; padding: .15rem .1rem .7rem; }
  .task-card { flex: 0 0 235px; width: auto; }
}
@media (max-width: 720px) {
  .status-reason-badge::before { position: absolute; inset: -12px -5px; content: ''; }
  .topbar-inner { align-items: flex-start; flex-wrap: wrap; gap: .55rem; padding: .85rem 1rem; }
  .brand-copy { display: block; }
  .brand-copy span { display: block; margin-top: -.1rem; font-size: .72rem; }
  .topbar .actions { flex: 1 1 auto; }
  .topbar .actions button { min-height: 32px; padding: .3rem .45rem; font-size: .8rem; }
  .home { padding: 1.55rem 1rem 3rem; }
  .home-heading { align-items: flex-start; flex-wrap: wrap; gap: .75rem; margin-bottom: 1.45rem; }
  .home-heading h1 { font-size: 1.4rem; }
  .home-heading p:last-child { font-size: .84rem; }
  .home-heading > .actions button { padding: .45rem .55rem; }
  .source-status-summary { margin-bottom: 1.15rem; }
  .source-summary-item { min-height: 66px; padding: .6rem .5rem; }
  .source-summary-value { font-size: 1.2rem; }
  .source-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; }
  .source-filter-search { grid-column: 1 / -1; }
  .source-filter-sort { grid-column: auto; }
  .source-filters .clear-source-filters { align-self: end; }
  .bot-grid { grid-template-columns: 1fr; }
  .bot-card { min-height: 205px; }
  .content { padding: 1.25rem 1rem 3rem; }
  .source-heading { align-items: flex-start; flex-direction: column; gap: .8rem; }
  .source-heading h1 { font-size: 1.4rem; }
  .source-heading .recent-task-status { justify-content: flex-start; max-width: 100%; text-align: left; }
  .task-board { margin-bottom: 1rem; }
  .task-board-heading { align-items: center; gap: .6rem; }
  .task-board-heading > div { min-width: 0; }
  .task-board-heading p { margin-top: .2rem; font-size: .78rem; }
  .task-board-new { padding: .38rem .55rem; font-size: .8rem; }
  .task-card { flex-basis: 235px; min-height: 118px; }
  .task-detail-heading { display: block; padding: 1rem; }
  .task-detail-heading .danger { margin-top: .8rem; }
  .messages { max-height: 52vh; padding: 1rem .75rem; scrollbar-gutter: auto; }
  .chat-message { max-width: 98%; padding: .8rem; }
  .chat-empty { padding: 2rem .5rem; }
  .chat-status { padding: .65rem .8rem; }
  .composer { padding: .8rem; }
  .composer-footer { align-items: flex-end; }
  .composer-footer .hint { max-width: 70%; font-size: .74rem; }
  .form-grid { grid-template-columns: 1fr; }
  .budget-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .history-list { grid-template-columns: 1fr; }
  .dialog { padding: 1rem; }
  .empty-bots { padding: 3rem 1rem; }
  .pagination { flex-wrap: wrap; }
  input, select, textarea { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  button, .bot-card { transition: none; }
  .bot-card.is-running .badge { animation: none; }
}

/* Scoped mapping of Geist's neutral surfaces and type roles for the task view. */
.collector-detail, .collector-detail-dialog {
  --text: #171717;
  --muted: #666;
  --faint: #707070;
  --border: #eaeaea;
  --border-strong: #d4d4d4;
  --surface: #fff;
  --subtle: #fafafa;
}
.collector-detail .source-heading { margin-bottom: 24px; }
.collector-detail .source-heading h1 { font-size: 24px; line-height: 1.35; font-weight: 600; }
.collector-detail .task-workspace { grid-template-columns: 224px minmax(0, 1fr); gap: 24px; }
.collector-detail .task-board-heading { margin-bottom: 12px; }
.collector-detail .task-board-heading h2 { font-size: 14px; font-weight: 500; color: var(--muted); }
.collector-detail .task-board-new { min-height: 32px; font-size: 12px; }
.collector-detail .task-card { min-height: 76px; gap: 12px; padding: 12px; border-radius: 6px; }
.collector-detail .task-card[aria-current=true] { border-color: var(--border-strong); border-left-width: 1px; background: var(--subtle); }
.collector-detail .task-card-top { align-items: center; }
.collector-detail .task-card-top strong { font-size: 13px; font-weight: 500; }
.collector-detail .task-card .run-time { font-size: 12px; font-weight: 400; }
.collector-detail .task-main { border-radius: 8px; }
.collector-detail .task-detail-heading { align-items: flex-start; gap: 16px; padding: 20px 24px; }
.collector-detail .task-title-row { gap: 10px; min-height: 32px; }
.collector-detail .task-detail-heading h2 { font-size: 18px; line-height: 1.4; font-weight: 600; }
.collector-detail .task-reason { max-width: 880px; margin: 8px 0 0; color: var(--muted); font-size: 14px; line-height: 1.65; }
.collector-detail .badge { padding: 2px 7px; border-radius: 5px; font-size: 12px; font-weight: 500; }
.collector-detail .badge.warn { border-color: #f5e4b9; background: #fffbeb; color: #855800; }
.collector-detail .badge.bad { border-color: #f1c6c1; background: #fff5f4; color: #b42318; }
.collector-detail .task-header-actions { gap: 4px; }
.collector-detail .task-header-actions > .task-conversation-button { min-height: 32px; padding: 6px 12px; background: var(--primary); border-color: var(--primary); color: #fff; }
.collector-detail .task-header-actions > .task-conversation-button:hover { background: #333; border-color: #333; }
.collector-detail .task-panel { padding: 16px 24px 24px; }
.collector-detail .result-view { gap: 12px; }
.collector-detail .result-run-picker { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; align-items: center; padding-bottom: 0; border-bottom: 0; }
.collector-detail .result-run-picker label { font-size: 13px; font-weight: 400; }
.collector-detail .result-run-select { width: 100%; max-width: 640px; min-height: 36px; padding: 7px 10px; font-size: 13px; text-overflow: ellipsis; }
.collector-detail .result-toolbar { gap: 12px; }
.collector-detail .result-tabs button { min-height: 40px; padding: 10px 12px; font-size: 13px; font-weight: 500; }
.collector-detail .result-toolbar-actions button { padding: 6px 8px; font-size: 12px; }
.collector-detail .result-item-summary { min-height: 48px; padding: 12px 0; }
.collector-detail .result-item-summary strong { font-size: 14px; font-weight: 500; }
.collector-detail .result-item-category { font-size: 13px; }
.collector-detail-dialog .dialog-head h2 { font-size: 18px; font-weight: 600; }
.collector-detail-dialog .message-body, .collector-detail-dialog .collection-explanation-content p { font-size: 14px; }

@media (max-width: 880px) {
  .collector-detail .task-workspace { display: block; margin-top: 0; }
  .collector-detail .task-cards { padding-bottom: 8px; }
  .collector-detail .task-card { flex-basis: 224px; }
}
@media (max-width: 720px) {
  .collector-detail .source-heading { flex-direction: row; align-items: center; gap: 12px; margin-bottom: 20px; }
  .collector-detail .source-heading h1 { font-size: 20px; }
  .collector-detail .source-heading-actions { gap: 0; }
  .collector-detail .source-heading-actions a { padding: 8px; font-size: 12px; }
  .collector-detail .source-heading-actions button { padding: 8px; font-size: 12px; }
  .collector-detail .task-detail-heading { display: flex; flex-wrap: wrap; padding: 16px; }
  .collector-detail .task-detail-heading > div:first-child { flex-basis: 100%; }
  .collector-detail .task-detail-heading h2 { font-size: 17px; }
  .collector-detail .task-header-actions { margin-left: auto; }
  .collector-detail .task-card { min-height: 80px; }
  .collector-detail .task-panel { padding: 12px 16px 20px; }
  .collector-detail .result-run-picker { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .collector-detail .result-run-select { font-size: 16px; }
  .collector-detail .result-toolbar { flex-wrap: wrap; gap: 4px; }
  .collector-detail .result-toolbar-actions { margin-left: auto; }
  .collector-detail .result-item-summary { grid-template-columns: minmax(0, 1fr) auto 16px; gap: 4px 8px; }
  .collector-detail .result-item-category { grid-column: 1; grid-row: 2; }
  .collector-detail .result-item-warning { grid-column: 2; grid-row: 1 / span 2; }
  .collector-detail .result-entries details.result-item > summary.result-item-summary > .disclosure-icon { grid-column: 3; grid-row: 1 / span 2; }
  .collector-detail .task-detail-heading .danger { margin-top: 0; }
  .collector-detail button, .collector-detail summary.task-actions-menu, .collector-detail .task-actions-menu > summary,
  .collector-detail-dialog button { min-height: 44px; }
  .collector-detail .task-header-actions > button, .collector-detail .task-header-actions > .task-conversation-button,
  .collector-detail .task-board-new,
  .collector-detail .result-tabs > button, .collector-detail .result-toolbar-actions button,
  .collector-detail .task-menu-items > button, .collector-detail .task-menu-items > a { min-height: 44px; }
  .collector-detail .source-heading-actions a, .collector-detail .back-button { min-height: 44px; display: inline-flex; align-items: center; }
  .collector-detail-dialog.conversation-dialog { width: calc(100vw - 24px); height: calc(100dvh - 24px); max-height: calc(100dvh - 24px); }
}
