/* 助手对话 — devices → assistants → conversations, one full-height workspace.
   FIOS language: warm neutral ground, white surfaces, flat colour. Motion
   explains state: a ring turns while an assistant works, a pill slides to the
   selected assistant, new messages rise, pending sends wait as ghosts. */

.page.full > .agents { display: block; height: 100%; }
.chat-host { height: 100%; }
/* clip, not hidden: off-canvas panels must never be scrolled into view sideways. */
.wb { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr); height: 100%; overflow: hidden; overflow: clip; background: var(--bg); }
.wb.inspector-open { grid-template-columns: auto minmax(0, 1fr) 312px; }
.wb .still { animation: none !important; }
.unread { min-width: 18px; height: 18px; padding: 0 5px; flex: none; border-radius: 99px; display: inline-grid; place-items: center; font-size: 10.5px; font-weight: 700; color: #fff; background: var(--c8); }
.wb .spinner { width: 12px; height: 12px; border-width: 1.6px; border-color: currentColor; border-right-color: transparent; flex: none; }

/* ---------------- Dock: every device, every assistant ---------------- */
.wb-side { display: flex; min-height: 0; border-right: 1px solid var(--line); }
.wb-dock { width: 68px; flex: none; display: flex; flex-direction: column; align-items: center; gap: 4px; min-height: 0; padding: 12px 0 10px; background: var(--bg-2); border-right: 1px solid var(--line); }
.wb-dock-btn { width: 40px; height: 34px; border-radius: 11px; display: grid; place-items: center; color: var(--muted); transition: background 0.15s, color 0.15s, transform 0.15s var(--spring); }
.wb-dock-btn:hover { background: var(--surface); color: var(--ink); }
.wb-dock-btn:active { transform: scale(0.92); }
.wb-dock-rule { width: 26px; height: 1px; flex: none; margin: 4px 0 6px; background: var(--line-2); }
.wb-dock-list { flex: 1; min-height: 0; width: 100%; overflow-y: auto; scrollbar-width: none; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 2px 0 10px; }
.wb-dock-list::-webkit-scrollbar { display: none; }
.wb-dock-device { position: relative; display: flex; flex-direction: column; align-items: center; gap: 1px; width: 56px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); color: var(--faint); font-size: 9.5px; font-weight: 650; letter-spacing: 0.02em; }
.wb-dock-device:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.wb-dock-device span { max-width: 56px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wb-dock-device i { position: absolute; right: 15px; bottom: 13px; width: 6px; height: 6px; border-radius: 50%; background: var(--faint); box-shadow: 0 0 0 2px var(--bg-2); }
.wb-dock-device:first-child i { bottom: 13px; }
.wb-dock-device.on { color: var(--muted); }
.wb-dock-device.on i { background: var(--good); }
.wb-dock-item { position: relative; display: grid; place-items: center; width: 50px; height: 50px; flex: none; border-radius: 16px; transition: background 0.18s, transform 0.22s var(--spring), box-shadow 0.18s; }
.wb-dock-item:hover { background: color-mix(in srgb, var(--surface) 72%, transparent); transform: translateY(-1px); }
.wb-dock-item:active { transform: scale(0.95); }
.wb-dock-item::before { content: ""; position: absolute; left: -9px; top: 50%; width: 4px; height: 8px; border-radius: 0 4px 4px 0; background: var(--ink-2); transform: translateY(-50%) scaleY(0); transition: transform 0.28s var(--spring), height 0.28s var(--spring), background 0.2s; }
.wb-dock-item:hover::before { transform: translateY(-50%) scaleY(1); }
.wb-dock-item.selected { background: var(--surface); box-shadow: 0 0 0 1px var(--line), var(--shadow-sm); }
.wb-dock-item.selected::before { height: 28px; background: var(--ac); transform: translateY(-50%) scaleY(1); }
.wb-dock-item .avatar.lg { width: 38px; height: 38px; border-radius: 12px; font-size: 14.5px; }
.wb-dock-item .avatar .dot { box-shadow: 0 0 0 2px var(--bg-2); }
.wb-dock-item.selected .avatar .dot { box-shadow: 0 0 0 2px var(--surface); }
.wb-dock-item.offline .avatar { filter: saturate(0.3); opacity: 0.72; }
.wb-dock-item.deleted { opacity: 0.45; }
.wb-dock-item .unread { position: absolute; top: -1px; right: -2px; box-shadow: 0 0 0 2px var(--bg-2); animation: pop 0.35s var(--spring); }
.wb-eye { position: absolute; left: 2px; bottom: 2px; width: 15px; height: 15px; border-radius: 5px; display: grid; place-items: center; color: var(--c-yellow); background: var(--c-yellow-bg); box-shadow: 0 0 0 2px var(--bg-2); }
.wb-dock-empty { font-size: 11px; color: var(--faint); }
.wb-flyout { position: fixed; z-index: 95; display: grid; gap: 3px; min-width: 150px; max-width: 260px; padding: 9px 12px 10px; border-radius: 11px; background: var(--ink); color: var(--bg); box-shadow: var(--shadow-lg); pointer-events: none; transform: translateY(-50%); animation: flyout-in 0.16s var(--ease) both; }
.wb-flyout::before { content: ""; position: absolute; left: -4px; top: 50%; width: 9px; height: 9px; border-radius: 2px; background: var(--ink); transform: translateY(-50%) rotate(45deg); }
.wb-flyout strong { font-size: 13px; }
.wb-flyout span { font-size: 12px; opacity: 0.82; }
.wb-flyout small { display: flex; align-items: center; gap: 5px; font-size: 11.5px; opacity: 0.68; }
.wb-state { width: 6px; height: 6px; border-radius: 50%; background: var(--faint); flex: none; }
.wb-state.on { background: #4cc27f; }
@keyframes flyout-in { from { opacity: 0; transform: translate(-4px, -50%); } to { opacity: 1; transform: translateY(-50%); } }

/* Quick switcher (⌘K) */
.menu.wb-switch { width: 340px; padding: 8px; }
.wb-switch-input { height: 34px; margin-bottom: 4px; font-size: 13px; }
.wb-switch-list { display: grid; gap: 1px; max-height: min(420px, 60vh); overflow-y: auto; }
.wb-switch-row { padding: 7px 8px; }
.wb-switch-row b { display: block; font-size: 13px; font-weight: 600; color: var(--ink); }
.wb-switch-row.hot { background: var(--surface-3); }

/* ---------------- Conversation column ---------------- */
.wb-nav { width: 264px; display: flex; flex-direction: column; min-height: 0; background: color-mix(in srgb, var(--bg-2) 42%, var(--bg)); }
.wb-who { display: grid; gap: 10px; padding: 14px 14px 13px; border-bottom: 1px solid var(--line); animation: fade 0.25s var(--ease) both; }
.wb-who-main { display: flex; align-items: center; gap: 11px; min-width: 0; }
.wb-who-main strong { display: block; font-size: 15px; letter-spacing: -0.01em; line-height: 1.3; }
.wb-who-main small { display: block; font-size: 12px; color: var(--muted); }
.wb-who-meta { display: flex; align-items: center; gap: 10px; min-width: 0; font-size: 11.5px; color: var(--muted); }
.wb-who-meta > span:first-child { display: inline-flex; align-items: center; gap: 5px; }
.wb-who-meta svg { color: var(--faint); }
.wb-who-state { display: inline-flex; align-items: center; gap: 5px; flex: none; margin-left: auto; font-weight: 600; }
.wb-who-state i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.wb-who-state.green { color: var(--c-green); }
.wb-who-state.yellow { color: var(--c-yellow); }
.wb-who-state.gray { color: var(--c-gray); }
.wb-who-empty strong { display: block; font-size: 15px; }
.wb-who-empty small { font-size: 12px; color: var(--muted); }
.wb-assign { display: flex; align-items: center; gap: 7px; height: 32px; padding: 0 11px; border-radius: 9px; font-size: 12.5px; font-weight: 600; color: var(--c-purple); background: var(--c-purple-bg); transition: filter 0.15s, transform 0.15s var(--spring); }
.wb-assign small { margin-left: auto; font-size: 11px; font-weight: 450; opacity: 0.72; }
.wb-assign:hover { filter: brightness(0.97); }
.wb-assign:active { transform: scale(0.98); }
.wb-nav-tools { display: flex; gap: 6px; padding: 12px 12px 4px; }
.wb-new { display: inline-flex; align-items: center; gap: 5px; height: 32px; padding: 0 12px; flex: none; border-radius: 9px; font-size: 12.5px; font-weight: 600; color: var(--bg); background: var(--ink); transition: opacity 0.15s, transform 0.15s var(--spring); }
.wb-new:hover:not(:disabled) { opacity: 0.88; }
.wb-new:active:not(:disabled) { transform: scale(0.96); }
.wb-new:disabled { opacity: 0.4; }
.wb-conv-find { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; height: 32px; padding: 0 9px; border-radius: 9px; color: var(--faint); background: var(--surface); border: 1px solid var(--line); transition: border-color 0.15s, box-shadow 0.15s; }
.wb-conv-find:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.wb-conv-search { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 12.5px; color: var(--ink); }
.wb-conv-list { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 1px; padding: 2px 8px 14px; }
.wb-conv-group { padding: 12px 8px 4px; font-size: 11px; font-weight: 650; letter-spacing: 0.04em; color: var(--faint); }
.wb-conv { display: flex; align-items: flex-start; gap: 8px; width: 100%; padding: 8px 10px; border-radius: 9px; text-align: left; color: var(--ink-2); transition: background 0.15s, color 0.15s; flex: none; }
.wb-conv:hover { background: color-mix(in srgb, var(--surface) 72%, transparent); color: var(--ink); }
.wb-conv.selected { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--line), var(--shadow-sm); }
.wb-conv-title { flex: 1; min-width: 0; font-size: 13px; line-height: 1.45; overflow: hidden; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.wb-conv.selected .wb-conv-title { font-weight: 600; }
.wb-conv-side { flex: none; padding-top: 1px; }
.wb-conv-side small { font-size: 11px; color: var(--faint); white-space: nowrap; }
.wb-conv.archived { opacity: 0.6; }
.wb-conv-pending { align-items: center; color: var(--muted); background: var(--surface); border: 1px dashed var(--line-2); }
.wb-conv-pending b { display: block; font-size: 13px; color: var(--ink); }
.wb-conv-pending small { display: block; font-size: 11.5px; }
.wb-conv-note { padding: 18px 10px; text-align: center; font-size: 12.5px; color: var(--muted); }
.wb-conv-note.bad { color: var(--bad); }
.wb-conv-archived { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 8px; padding: 8px; border-radius: 9px; font-size: 12px; color: var(--muted); }
.wb-conv-archived:hover { color: var(--ink); background: var(--surface-3); }

/* ---------------- Main: heading ---------------- */
.wb-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.wb-head { flex: none; display: flex; align-items: center; gap: 8px; height: 58px; padding: 0 14px 0 24px; border-bottom: 1px solid var(--line); }
.wb-head-title { display: grid; min-width: 0; flex: 0 1 auto; }
.wb-head-title strong { font-size: 14.5px; font-weight: 650; letter-spacing: -0.01em; }
.wb-head-title small { font-size: 11.5px; color: var(--muted); }
.wb-nav-toggle { display: none; align-items: center; gap: 3px; height: 34px; padding: 0 6px 0 4px; border-radius: 10px; color: var(--muted); flex: none; }
.wb-nav-toggle:hover { background: var(--surface-3); }
.wb-chip { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 10px; flex: none; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; color: var(--ink-2); background: var(--surface-3); }
.wb-chip i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.wb-chip.live { color: var(--c-blue); background: var(--c-blue-bg); }
.wb-chip.live i { animation: pulse 1.4s ease-in-out infinite; }
.wb-chip.off { color: var(--c-gray); background: var(--c-gray-bg); }
.wb-chip.warn { color: var(--c-yellow); background: var(--c-yellow-bg); }
.wb-chip.task { color: var(--c-purple); background: var(--c-purple-bg); transition: filter 0.15s; }
.wb-chip.task:hover { filter: brightness(0.96); }
.wb-inspector-toggle.on { color: var(--ink); background: var(--surface-3); }

/* ---------------- Main: thread ---------------- */
.wb-stage { position: relative; flex: 1; min-height: 0; }
.wb-timeline { position: absolute; inset: 0; overflow-y: auto; padding: 26px 28px 28px; }
.wb-thread { max-width: 780px; margin: 0 auto; display: flex; flex-direction: column; }
.wb-jump { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 13px; border-radius: 99px; font-size: 12px; background: var(--ink); color: var(--bg); box-shadow: var(--shadow-lg); animation: toast-in 0.25s var(--spring) both; }
.wb-day { display: flex; align-items: center; gap: 12px; margin: 28px 0 4px; font-size: 11.5px; font-weight: 600; color: var(--faint); animation: fade 0.3s both; }
.wb-day::before, .wb-day::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.wb-day:first-child, .wb-older + .wb-day { margin-top: 2px; }
.wb-older { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 2px 0 10px; font-size: 12px; color: var(--muted); }
.wb-older-btn { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px; border-radius: 99px; font-size: 12px; font-weight: 600; color: var(--ink-2); background: var(--surface); border: 1px solid var(--line-2); transition: border-color 0.15s, color 0.15s; }
.wb-older-btn:hover:not(:disabled) { color: var(--ink); border-color: color-mix(in srgb, var(--ink) 24%, transparent); }
.wb-notice { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 10px; font-size: 12.5px; color: var(--muted); }

.chat-message { position: relative; animation: rise 0.32s var(--ease) both; }
.chat-message.from-user { align-self: flex-end; display: grid; justify-items: end; max-width: min(620px, 86%); margin-top: 20px; }
.chat-message.from-user.cont { margin-top: 6px; }
.wb-bubble { padding: 10px 15px; border-radius: 18px 18px 6px 18px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm); font-size: 14px; line-height: 1.7; color: var(--ink); white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-message.from-assistant { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 12px; margin-top: 24px; }
.chat-message.from-assistant.cont { margin-top: 0; }
.wb-avatar-col .face { margin: -3px; }
.wb-msg-col { min-width: 0; }
.wb-msg-meta { display: flex; align-items: baseline; gap: 8px; min-height: 22px; margin-bottom: 2px; }
.wb-msg-meta strong { font-size: 13px; color: color-mix(in srgb, var(--ac) 55%, var(--ink)); }
.wb-msg-meta time, .wb-msg-foot time { font-size: 11px; color: var(--faint); font-variant-numeric: tabular-nums; }
.wb-md { font-size: 14.5px; line-height: 1.85; }
.wb-md h2, .wb-md h3, .wb-md h4 { margin-top: 1.1em; }
.wb-md pre { font-size: 12.5px; }
.wb-md.streaming > :last-child::after { content: ""; display: inline-block; width: 7px; height: 1.05em; margin-left: 2px; vertical-align: -0.15em; border-radius: 2px; background: var(--ac, var(--accent)); animation: caret 1s steps(1) infinite; }
.wb-content { position: relative; min-width: 0; }
.from-user .wb-content { display: grid; justify-items: end; }
.wb-content.folded > .wb-md, .wb-content.folded > .wb-bubble { max-height: 360px; overflow: hidden; -webkit-mask-image: linear-gradient(#000 58%, transparent); mask-image: linear-gradient(#000 58%, transparent); }
.from-user .wb-content.folded > .wb-bubble { max-height: 230px; }
.wb-fold { display: inline-flex; align-items: center; gap: 5px; margin-top: 4px; height: 28px; padding: 0 12px; border-radius: 99px; font-size: 12px; font-weight: 600; color: var(--ink-2); background: var(--surface); border: 1px solid var(--line-2); box-shadow: var(--shadow-sm); transition: color 0.15s, border-color 0.15s, transform 0.15s var(--spring); }
.wb-fold:hover { color: var(--ink); border-color: color-mix(in srgb, var(--ink) 24%, transparent); }
.wb-fold:active { transform: scale(0.97); }
.wb-content:not(.folded) > .wb-fold { margin-top: 8px; box-shadow: none; }
.wb-msg-foot { display: flex; align-items: center; gap: 4px; height: 22px; opacity: 0; transition: opacity 0.15s; }
.chat-message:hover .wb-msg-foot, .chat-message:focus-within .wb-msg-foot { opacity: 1; }
.from-user .wb-msg-foot { flex-direction: row-reverse; }
.wb-copy { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 7px; color: var(--muted); }
.wb-copy:hover { color: var(--ink); background: var(--surface-3); }

/* Pending sends wait as ghosts until the device echoes the real message. */
.wb-outbox { align-self: flex-end; display: grid; justify-items: end; gap: 6px; max-width: min(620px, 86%); margin-top: 20px; animation: rise 0.3s var(--ease) both; }
.wb-bubble.ghost { background: color-mix(in srgb, var(--surface) 50%, transparent); border: 1px dashed var(--line-2); box-shadow: none; color: var(--ink-2); max-height: 220px; overflow: hidden; }
.wb-outbox.bad .wb-bubble.ghost { border-color: color-mix(in srgb, var(--bad) 45%, transparent); }
.wb-outbox.gone { opacity: 0.5; }
.wb-outbox-files { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; white-space: normal; }
.wb-receipt { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; font-size: 11.5px; color: var(--muted); }
.wb-receipt.bad { color: var(--bad); }
.wb-receipt small { flex-basis: 100%; text-align: right; font-size: 11px; color: var(--muted); }
.wb-receipt-btn { height: 22px; padding: 0 8px; border-radius: 6px; font-size: 11.5px; font-weight: 600; color: var(--ink-2); background: var(--surface-3); }
.wb-receipt-btn:hover { color: var(--ink); }
.wb-op { align-self: center; max-width: 92%; margin: 14px 0 0; padding: 5px 12px; border-radius: 99px; background: var(--surface); border: 1px solid var(--line); animation: fade 0.3s both; }
.wb-op .wb-receipt small { flex-basis: auto; }
.wb-live { display: flex; align-items: center; gap: 12px; margin-top: 20px; padding: 10px 12px 10px 10px; border-radius: 15px; background: color-mix(in srgb, var(--ac) 7%, var(--surface)); border: 1px solid color-mix(in srgb, var(--ac) 22%, transparent); animation: scale-in 0.35s var(--ease) both; }
.wb-live strong { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.wb-live small { display: block; font-size: 11.5px; color: var(--muted); }
.wb-live .dots i { background: var(--ac); }
.wb-banner { display: flex; align-items: center; gap: 10px; margin-top: 18px; padding: 10px 12px; border-radius: 13px; font-size: 13px; color: var(--warn); background: var(--warn-soft); border: 1px solid color-mix(in srgb, var(--warn) 22%, transparent); animation: rise 0.3s var(--ease) both; }
.wb-banner .grow { color: var(--ink-2); }
.wb-blank, .wb-welcome { display: grid; justify-items: center; gap: 6px; padding: 14vh 20px 30px; text-align: center; animation: rise 0.4s var(--ease) both; }
.wb-blank strong, .wb-welcome strong { margin-top: 8px; font-size: 18px; letter-spacing: -0.02em; }
.wb-blank small, .wb-welcome small { font-size: 13px; color: var(--muted); }
.wb-welcome .btn { margin-top: 14px; }
.wb-welcome .avatar.xl { box-shadow: 0 14px 30px -16px var(--ac); }
.wb-welcome .orb { width: 56px; height: 56px; border-radius: 18px; display: grid; place-items: center; color: var(--accent); background: var(--accent-soft); }
.wb-welcome-note { display: inline-flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 12.5px; color: var(--muted); }
.wb-loading { display: grid; gap: 18px; padding-top: 12px; }

/* ---------------- Bottom: questions, approvals, composer ---------------- */
.wb-bottom { flex: none; padding: 0 28px 12px; }
.wb-attention, .wb-composer, .wb-bottom .chat-status { max-width: 780px; margin: 0 auto; }
.wb-attention { display: grid; gap: 8px; }
.wb-attention:not(:empty) { margin-bottom: 10px; }
.wb-ask { display: grid; gap: 9px; padding: 12px 14px 12px; border-radius: 16px; background: var(--surface); border: 1px solid color-mix(in srgb, var(--c2) 38%, var(--line)); box-shadow: 0 0 0 4px color-mix(in srgb, var(--c2) 8%, transparent), var(--shadow-sm); animation: scale-in 0.3s var(--ease) both; }
.wb-ask header { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-2); }
.wb-ask header small { margin-left: auto; font-size: 11.5px; color: var(--muted); }
.wb-ask-ic { width: 24px; height: 24px; flex: none; border-radius: 8px; display: grid; place-items: center; color: var(--c-orange); background: var(--c-orange-bg); }
.wb-ask-ic.warn { color: var(--c-yellow); background: var(--c-yellow-bg); }
.wb-ask-q { font-size: 14px; font-weight: 600; line-height: 1.55; }
.wb-options { display: flex; flex-wrap: wrap; gap: 6px; }
.wb-option { height: 32px; padding: 0 14px; border-radius: 99px; font-size: 13px; color: var(--ink-2); background: var(--surface); border: 1px solid var(--line-2); transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.15s var(--spring); }
.wb-option:hover:not(:disabled) { border-color: color-mix(in srgb, var(--ink) 26%, transparent); color: var(--ink); }
.wb-option:active:not(:disabled) { transform: scale(0.96); }
.wb-option[aria-pressed="true"] { color: var(--bg); background: var(--ink); border-color: var(--ink); }
.wb-ask-input { height: 34px; font-size: 13px; }
.wb-ask footer { display: flex; align-items: center; gap: 6px; }
.wb-text-btn { height: 28px; padding: 0 8px; border-radius: 7px; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.wb-text-btn:hover:not(:disabled) { color: var(--ink); background: var(--surface-3); }
.wb-approve { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px; background: var(--surface); border: 1px solid color-mix(in srgb, var(--c4) 42%, var(--line)); animation: scale-in 0.3s var(--ease) both; }
.wb-approve strong { font-size: 12px; color: var(--c-yellow); }
.wb-approve p { font-size: 13px; color: var(--ink); }
.wb-approve-acts { display: flex; gap: 6px; flex: none; }

.wb-box { position: relative; border: 1px solid var(--line-2); border-radius: 20px; background: var(--surface); box-shadow: var(--shadow-hover); transition: border-color 0.2s, box-shadow 0.2s; }
.wb-box:focus-within { border-color: var(--accent-line); box-shadow: 0 0 0 4px var(--accent-glow), var(--shadow-hover); }
.wb-composer.running .wb-box { border-color: color-mix(in srgb, var(--c1) 38%, transparent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--c1) 10%, transparent), var(--shadow-hover); }
.wb-box.drop { border-style: dashed; border-color: var(--accent); background: var(--accent-soft); }
.wb-input { display: block; width: 100%; max-height: 240px; padding: 14px 16px 4px; border: 0; outline: 0; resize: none; background: transparent; font-size: 14.5px; line-height: 1.65; }
.wb-input::placeholder { color: var(--faint); }
.composer-attachments:not(:empty), .wb-uploads:not(:empty) { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 12px 0; }
.file-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 260px; height: 30px; padding: 0 4px 0 9px; border-radius: 9px; font-size: 12px; color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--line); animation: pop-in 0.3s var(--spring) both; }
.file-chip > svg { color: var(--c-blue); }
.file-chip small { flex: none; font-size: 11px; color: var(--faint); }
.file-chip button { width: 20px; height: 20px; flex: none; display: grid; place-items: center; border-radius: 6px; color: var(--muted); }
.file-chip button:hover { color: var(--ink); background: var(--surface-3); }
.wb-outbox .file-chip { height: 24px; padding-right: 8px; }
.wb-upload { position: relative; display: inline-flex; align-items: center; gap: 6px; max-width: 280px; height: 30px; padding: 0 4px 0 9px; border-radius: 9px; overflow: hidden; font-size: 12px; color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--line); }
.wb-upload-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--surface-3); }
.wb-upload-bar i { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--accent); transition: width 0.3s var(--ease); }
.wb-upload button { width: 20px; height: 20px; display: grid; place-items: center; border-radius: 6px; color: var(--muted); }
.wb-box-foot { display: flex; align-items: center; gap: 4px; min-width: 0; padding: 4px 8px 8px; }
.wb-attach { width: 32px; height: 32px; border-radius: 10px; color: var(--muted); }
.wb-hint { flex: none; font-size: 11.5px; color: var(--faint); white-space: nowrap; margin-right: 4px; }
.wb-send, .wb-stop { width: 34px; height: 34px; flex: none; border-radius: 11px; display: grid; place-items: center; transition: transform 0.15s var(--spring), opacity 0.15s, background 0.2s; }
.wb-send { color: var(--on-accent); background: var(--accent); }
.wb-send:hover:not(:disabled) { transform: translateY(-1px); }
.wb-send:disabled { opacity: 0.5; }
.wb-composer.running .wb-send { color: #fff; background: var(--c1); }
.wb-stop { color: var(--bad); background: var(--bad-soft); animation: pop-in 0.3s var(--spring) both; }
.wb-locked { display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 16px; border-radius: 18px; color: var(--muted); background: var(--surface); border: 1px dashed var(--line-2); }
.wb-locked strong { display: block; font-size: 13px; color: var(--ink); }
.wb-locked small { display: block; font-size: 12px; line-height: 1.55; }
.wb-bottom .chat-status { padding: 7px 4px 0; text-align: center; font-size: 11px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------------- Runtime chip and the configuration panel ---------------- */
.wb-runtime { position: relative; display: inline-flex; align-items: center; gap: 6px; min-width: 0; height: 32px; padding: 0 7px 0 5px; border-radius: 10px; color: var(--ink-2); transition: background 0.15s, color 0.15s; }
.wb-runtime:hover { color: var(--ink); background: var(--surface-3); }
.wb-runtime > svg:last-child { color: var(--faint); }
.wb-mark { width: 22px; height: 22px; flex: none; border-radius: 7px; display: grid; place-items: center; font-size: 9.5px; font-weight: 750; letter-spacing: 0.02em; color: #fff; background: hsl(var(--ah, 200) 46% 50%); }
.wb-runtime-text { display: inline-flex; align-items: baseline; gap: 5px; min-width: 0; font-size: 12.5px; }
.wb-runtime-text b { font-weight: 650; white-space: nowrap; }
.wb-runtime-model { min-width: 0; max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.wb-runtime-tag { display: inline-flex; align-items: center; height: 18px; padding: 0 6px; flex: none; border-radius: 6px; font-size: 11px; font-weight: 650; color: var(--ink-2); background: var(--surface-3); }
.wb-runtime-tag.fast { padding: 0 4px; color: var(--c-orange); background: var(--c-orange-bg); }
.wb-runtime-tag.mode { padding: 0 4px; color: var(--c-green); background: var(--c-green-bg); }
.wb-dirty { width: 7px; height: 7px; flex: none; border-radius: 50%; background: var(--c2); animation: pop 0.35s var(--spring); }

.menu.wb-config { display: flex; flex-direction: column; width: min(448px, calc(100vw - 24px)); max-height: min(660px, calc(100vh - 90px)); padding: 0; overflow: hidden; border-radius: 16px; }
.wb-cfg-head { display: flex; align-items: flex-start; gap: 10px; padding: 14px 16px 12px; border-bottom: 1px solid var(--line); }
.wb-cfg-head strong { display: block; font-size: 14px; }
.wb-cfg-head small { display: block; margin-top: 2px; font-size: 11.5px; color: var(--muted); }
.wb-cfg-body { flex: 1; min-height: 0; overflow-y: auto; padding: 2px 16px 14px; }
.wb-cfg-sec { padding-top: 14px; }
.wb-cfg-sec > header { display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.wb-cfg-sec h4 { font-size: 12.5px; font-weight: 700; }
.wb-cfg-sec > header small { font-size: 11.5px; color: var(--faint); }
.wb-cfg-providers { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.wb-cfg-provider { display: flex; align-items: center; gap: 9px; min-width: 0; padding: 8px 10px; border-radius: 11px; text-align: left; background: var(--surface); border: 1px solid var(--line); transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s var(--spring); }
.wb-cfg-provider .wb-mark { width: 28px; height: 28px; border-radius: 9px; font-size: 10.5px; }
.wb-cfg-provider b { display: block; font-size: 12.5px; }
.wb-cfg-provider small { display: block; font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wb-cfg-provider:hover:not(:disabled) { border-color: var(--line-2); transform: translateY(-1px); }
.wb-cfg-provider.on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.wb-cfg-provider.on > svg { color: var(--accent); }
.wb-cfg-provider:disabled { opacity: 0.45; }
.wb-model-search { height: 32px; margin-bottom: 6px; font-size: 12.5px; }
.wb-cfg-models { display: grid; gap: 1px; max-height: 216px; overflow-y: auto; margin: 0 -6px; padding: 0 6px; }
.wb-cfg-model { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 8px; border-radius: 9px; text-align: left; transition: background 0.12s; }
.wb-cfg-model:hover:not(:disabled) { background: var(--surface-3); }
.wb-cfg-model b { display: block; font-size: 13px; font-weight: 550; }
.wb-cfg-model small { display: block; font-size: 11px; color: var(--muted); }
.wb-cfg-model.on b { font-weight: 650; }
.wb-radio { position: relative; width: 16px; height: 16px; flex: none; border-radius: 50%; border: 1.6px solid var(--line-2); transition: border-color 0.15s; }
.wb-cfg-model.on .wb-radio { border-color: var(--accent); }
.wb-cfg-model.on .wb-radio::after { content: ""; position: absolute; inset: 3px; border-radius: 50%; background: var(--accent); animation: pop 0.3s var(--spring); }
.wb-cfg-cap { width: 20px; height: 20px; flex: none; border-radius: 6px; display: grid; place-items: center; color: var(--muted); background: var(--surface-3); }
.wb-seg { display: flex; flex-wrap: wrap; gap: 3px; padding: 3px; border-radius: 11px; background: var(--surface-3); }
.wb-seg-btn { flex: 1 1 auto; display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; padding: 0 10px; border-radius: 8px; font-size: 12.5px; white-space: nowrap; color: var(--muted); transition: background 0.18s, color 0.15s, box-shadow 0.18s; }
.wb-seg-btn:hover:not(:disabled) { color: var(--ink); }
.wb-seg-btn.on { color: var(--ink); font-weight: 650; background: var(--surface); box-shadow: 0 0 0 1px var(--line), var(--shadow-sm); }
.wb-seg-btn.on > svg { color: var(--c-orange); }
.wb-meter { display: inline-flex; align-items: flex-end; gap: 2px; height: 11px; }
.wb-meter i { width: 3px; border-radius: 1px; background: var(--line-2); }
.wb-meter i:nth-child(1) { height: 4px; }
.wb-meter i:nth-child(2) { height: 6px; }
.wb-meter i:nth-child(3) { height: 8px; }
.wb-meter i:nth-child(4) { height: 10px; }
.wb-meter i:nth-child(n+5) { height: 11px; }
.wb-meter i.on { background: var(--accent); }
.wb-cfg-modes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.wb-cfg-mode { display: flex; align-items: flex-start; gap: 9px; padding: 10px; border-radius: 11px; text-align: left; background: var(--surface); border: 1px solid var(--line); transition: border-color 0.15s, box-shadow 0.15s; }
.wb-cfg-mode b { display: block; font-size: 13px; }
.wb-cfg-mode small { display: block; font-size: 11.5px; line-height: 1.45; color: var(--muted); }
.wb-cfg-mode-ic { width: 28px; height: 28px; flex: none; border-radius: 9px; display: grid; place-items: center; color: var(--c-green); background: var(--c-green-bg); }
.wb-cfg-mode.m-fast .wb-cfg-mode-ic { color: var(--c-orange); background: var(--c-orange-bg); }
.wb-cfg-mode:hover:not(:disabled) { border-color: var(--line-2); }
.wb-cfg-mode.on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.wb-cfg-wait { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; padding: 8px; font-size: 12px; color: var(--muted); }
.wb-cfg-wait .bad { color: var(--bad); }
.wb-cfg-note { padding: 6px 2px; font-size: 12px; color: var(--muted); }
.wb-cfg-foot { display: flex; align-items: center; gap: 6px; padding: 10px 12px 10px 16px; border-top: 1px solid var(--line); background: var(--surface-2); }
.wb-cfg-state { font-size: 12px; color: var(--muted); }
.wb-cfg-state.bad { color: var(--bad); }

/* ---------------- Inspector ---------------- */
.wb-inspector { display: none; flex-direction: column; gap: 10px; min-height: 0; overflow-y: auto; padding: 12px; border-left: 1px solid var(--line); background: color-mix(in srgb, var(--bg-2) 40%, var(--bg)); }
.wb.inspector-open .wb-inspector { display: flex; }
.wb-inspector-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 2px 0 4px; font-size: 13px; }
.wb-panel { flex: none; border-radius: 13px; background: var(--surface); border: 1px solid var(--line); overflow: hidden; animation: fade 0.25s both; }
.wb-panel > summary { display: flex; align-items: center; gap: 8px; padding: 11px 13px; cursor: pointer; list-style: none; font-size: 13px; font-weight: 650; }
.wb-panel > summary::-webkit-details-marker { display: none; }
.wb-panel > summary .count { padding: 0 7px; border-radius: 99px; font-size: 11px; font-weight: 650; color: var(--ink-2); background: var(--surface-3); }
.wb-panel > summary > svg { color: var(--faint); transition: transform 0.2s var(--ease); }
.wb-panel:not([open]) > summary > svg { transform: rotate(-90deg); }
.wb-panel > :not(summary) { margin: 0 13px 12px; }
.wb-kvs { display: grid; }
.wb-kv { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 30px; font-size: 12.5px; }
.wb-kv > span { flex: none; color: var(--muted); }
.wb-kv > b { display: inline-flex; align-items: center; gap: 6px; min-width: 0; font-weight: 600; }
.wb-kv > b > svg { color: var(--c-green); }
.wb-kv .wb-mark { width: 18px; height: 18px; border-radius: 6px; font-size: 8.5px; }
.wb-panel-foot { display: flex; align-items: center; gap: 8px; padding-top: 10px; border-top: 1px solid var(--line); }
.wb-panel-foot small { font-size: 11.5px; color: var(--muted); }
.wb-items { display: grid; gap: 6px; }
.wb-item { display: grid; gap: 8px; padding: 9px 10px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); }
.wb-item strong { font-size: 12.5px; line-height: 1.45; }
.wb-item-acts { display: flex; flex-wrap: wrap; gap: 6px; }
.wb-item-acts .mini-btn { height: 26px; padding: 0 9px; font-size: 12px; }
.wb-file { display: flex; align-items: center; gap: 9px; padding: 4px 0; }
.wb-file-ic { width: 30px; height: 30px; flex: none; border-radius: 9px; display: grid; place-items: center; color: var(--c-blue); background: var(--c-blue-bg); }
.wb-file b { display: block; font-size: 12.5px; font-weight: 600; }
.wb-file small { display: block; font-size: 11px; color: var(--muted); }
.wb-tools { display: grid; gap: 2px; max-height: 300px; overflow-y: auto; }
.wb-tool { display: flex; align-items: flex-start; gap: 8px; padding: 6px 0; font-size: 12px; }
.wb-tool > i { width: 7px; height: 7px; flex: none; margin-top: 6px; border-radius: 50%; background: var(--c3); }
.wb-tool.s-failed > i, .wb-tool.s-refused > i { background: var(--c8); }
.wb-tool.s-running > i { background: var(--c1); animation: pulse 1.4s ease-in-out infinite; }
.wb-tool.s-unknown > i { background: var(--c4); }
.wb-tool b { display: block; font-weight: 600; }
.wb-tool small { font-size: 11px; color: var(--muted); }
.wb-tool > small { flex: none; }
.wb-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.wb-stats > div { padding: 9px 10px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); }
.wb-stats b { display: block; font-size: 17px; font-weight: 700; letter-spacing: -0.02em; }
.wb-stats small { font-size: 11px; color: var(--muted); }
.wb-note { font-size: 12px; line-height: 1.6; color: var(--muted); }
.wb-note.warn { color: var(--c-orange); }
.wb-panel .wb-note { margin-top: 8px; }
.wb-panel .wb-note:first-of-type:not(.warn) { margin-top: 0; }
.wb-cloud-task { display: flex; align-items: center; gap: 8px; width: 100%; padding: 9px 10px; border-radius: 10px; text-align: left; color: var(--c-purple); background: var(--c-purple-bg); transition: transform 0.15s var(--ease); }
.wb-cloud-task:hover { transform: translateX(2px); }
.wb-cloud-task small { flex: none; font-size: 11px; font-weight: 650; }
.wb-cloud-task b { flex: 1; font-size: 12.5px; color: var(--ink); }

/* ---------------- Overlays on narrower screens ---------------- */
.wb-scrim { display: none; position: absolute; inset: 0; z-index: 24; background: var(--scrim); animation: fade 0.2s both; }
@media (max-width: 1559px) {
  .wb.inspector-open { grid-template-columns: auto minmax(0, 1fr); }
  .wb-inspector { display: flex; position: absolute; z-index: 25; top: 0; right: 0; bottom: 0; width: min(340px, 92vw); background: var(--bg); box-shadow: var(--shadow-lg); transform: translateX(104%); visibility: hidden; transition: transform 0.28s var(--ease), visibility 0s linear 0.28s; }
  .wb.inspector-open .wb-inspector { transform: none; visibility: visible; transition: transform 0.28s var(--ease), visibility 0s; }
  .wb.inspector-open .wb-scrim { display: block; }
}
@media (max-width: 1179px) {
  .wb, .wb.inspector-open { grid-template-columns: minmax(0, 1fr); }
  .wb-side { position: absolute; z-index: 26; top: 0; bottom: 0; left: 0; max-width: 94vw; box-shadow: var(--shadow-lg); transform: translateX(-104%); visibility: hidden; transition: transform 0.28s var(--ease), visibility 0s linear 0.28s; }
  .wb[data-nav="open"] .wb-side { transform: none; visibility: visible; transition: transform 0.28s var(--ease), visibility 0s; }
  .wb[data-nav="open"] .wb-scrim { display: block; }
  .wb-nav-toggle { display: inline-flex; }
  .wb-head { padding-left: 10px; }
}
@media (max-width: 720px) {
  .wb-nav { width: min(276px, calc(94vw - 68px)); }
  .wb-head { height: 52px; gap: 6px; padding-right: 8px; }
  .wb-head .wb-chip:not(.live) { display: none; }
  .wb-timeline { padding: 14px 14px 20px; }
  .wb-bottom { padding: 0 10px 10px; }
  .wb-hint, .wb-bottom .chat-status { display: none; }
  .wb-runtime-text b, .wb-runtime-tag.mode { display: none; }
  .wb-runtime-model { max-width: 110px; }
  .chat-message.from-user, .wb-outbox { max-width: 92%; }
  .chat-message.from-assistant { grid-template-columns: 30px minmax(0, 1fr); gap: 10px; }
  .wb-avatar-col .avatar { width: 28px; height: 28px; border-radius: 9px; font-size: 11.5px; }
  .wb-md { font-size: 14px; }
  .wb-msg-foot { opacity: 1; }
  .wb-cfg-modes { grid-template-columns: minmax(0, 1fr); }
  .wb-approve { flex-wrap: wrap; }
  .wb-approve-acts { margin-left: auto; }
}
@media (hover: none) { .wb-msg-foot { opacity: 1; } }
