.chat-icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }
.chat-icons { position: absolute; pointer-events: none; }
.chat-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.mobile-chat-header { display: none; }
.chat-page [hidden], .chat-sheet [hidden] { display: none !important; }
.chat-ready { --chat-ink: #252a3b; --chat-muted: #697186; --chat-line: #e8e9f0; --chat-purple: #5850df; background: #f7f8fc; }
.chat-ready .task-detail-wrap.chat-mode { height: calc(var(--chat-viewport-height, 100dvh) - 60px); max-width: 1000px; padding: 12px 24px; }
.chat-ready .task-chat-panel { position: relative; padding: 0; border: 1px solid var(--chat-line); border-radius: 16px; overflow: hidden; box-shadow: none; }
.chat-ready .mobile-chat-header { display: block; flex: 0 0 auto; padding: 8px 20px 0; border-bottom: 1px solid var(--chat-line); background: #fff; }
.mobile-chat-topline { display: flex; align-items: center; justify-content: space-between; height: 35px; }
.chat-back { display: inline-flex; gap: 3px; align-items: center; min-height: 44px; margin-left: -6px; font-size: 13px; color: var(--chat-muted); }
.chat-back .chat-icon { width: 16px; }
.chat-brand { color: var(--chat-muted); font-size: 11px; }
.chat-icon-button { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 12px; background: transparent; border: 0; border-radius: 11px; color: var(--chat-muted); cursor: pointer; flex: 0 0 auto; }
.mobile-chat-header h1 { margin: 8px 0 0; font-size: 22px; letter-spacing: -.6px; line-height: 1.25; font-weight: 650; color: var(--chat-ink); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.chat-context { display: flex; align-items: center; gap: 12px; min-height: 42px; font-size: 12px; color: var(--chat-muted); }
.chat-context a { display: flex; align-items: center; gap: 5px; color: inherit; min-height: 44px; min-width: 0; }
.chat-context a span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-context .chat-icon { width: 12px; height: 12px; }
#chat-live-status { margin-left: auto; text-align: right; flex: 0 0 auto; font-size: 11px; }
.chat-ready .task-status-row, .chat-ready .retry-adjust { display: none; }
.chat-ready .task-chat-panel .chat-shell { margin: 0; padding: 20px 24px 12px; background: linear-gradient(#fbfbfd, #fff 140px); border: 0; border-radius: 0; }
.chat-ready .chat-list { margin-top: 0; gap: 24px; }
.chat-ready .chat-turn { display: grid; gap: 20px; }
.chat-ready .message { max-width: 90%; gap: 7px; }
.chat-ready .assistant-message, .chat-ready .error-message { max-width: 100%; }
.chat-ready .message-meta { gap: 6px; font-size: 11px; flex-wrap: wrap; color: var(--chat-muted); }
.chat-ready .message-meta > a { display: none; }
.chat-ready .message-meta .status { font-size: 10px; padding: 1px 5px; }
.chat-ready .cli-meta { flex-basis: auto; order: initial; }
.chat-ready .user-message .message-meta { justify-content: flex-end; }
.chat-ready .user-message .bubble { background: #efedfe; color: #35314e; border: 0; border-radius: 17px 17px 5px 17px; padding: 12px 15px; }
.chat-ready .message-body { width: 100%; flex-direction: column; align-items: flex-start; gap: 0; }
.chat-ready .user-message .message-body { flex-direction: column; align-items: flex-end; }
.chat-ready .bubble { font-size: 15px; line-height: 1.65; overflow-wrap: anywhere; }
.chat-ready .assistant-message .bubble { color: var(--chat-ink); background: transparent; border: 0; border-radius: 0; padding: 0; box-shadow: none; }
.chat-ready .assistant-message .message-meta > span:first-child { font-weight: 650; color: var(--chat-ink); }
.chat-ready .message-copy-btn { opacity: 1; font-size: 11px; min-height: 44px; padding: 8px 10px; margin: 0 -10px; border-radius: 10px; color: var(--chat-muted); }
.chat-ready .queue-menu > summary { width: 44px; height: 44px; }
.chat-ready .attachment-card img { max-height: 180px; object-fit: cover; }
.chat-ready .composer { flex: 0 0 auto; padding: 8px 12px max(0px, env(safe-area-inset-bottom)); margin: 0; border: 0; background: #fff; }
.chat-ready .composer-note, .chat-ready .composer-spacer, .chat-ready .composer .kbd-hint { display: none; }
.chat-ready .composer-box { padding: 10px 7px 4px; border: 1px solid #dcddea; border-radius: 18px; background: #fff; box-shadow: 0 2px 8px #25203904; }
.chat-ready .composer-box:focus-within { border-color: #aaa2ed; box-shadow: 0 0 0 2px #5850df0b; }
.chat-ready .composer-box textarea { padding: 0 8px 4px; min-height: 48px; max-height: min(140px, 22dvh); font-size: 16px; line-height: 1.5; }
.chat-ready .composer-toolbar { border: 0; padding: 0; gap: 2px; flex-wrap: nowrap; }
.chat-ready .composer-toolbar > .composer-tool { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; width: 44px; height: 44px; padding: 10px; position: relative; flex: 0 0 auto; }
.chat-ready .composer-toolbar > .composer-tool .composer-count { position: absolute; top: 0; right: -2px; }
.chat-ready .composer-toolbar > .composer-more-btn { order: 7; font-size: 20px; }
.chat-ready .composer-toolbar > .composer-send { display: flex; align-items: center; justify-content: center; order: 9; flex: 0 0 44px; width: 44px; height: 44px; min-height: 44px; padding: 10px; margin-left: 2px; border-radius: 13px; background: var(--chat-purple); border-color: var(--chat-purple); }
.chat-ready .chat-send-label { display: none; }
.chat-ready .composer .speech-status { display: block; margin: 3px 8px; font-size: 12px; }
.chat-ready .composer .speech-status:empty { display: none; }
.chat-model-trigger { flex: 1 1 auto; min-width: 0; min-height: 44px; display: flex; align-items: center; justify-content: center; gap: 4px; border: 0; background: transparent; font-size: 12px; font-weight: 600; color: #434759; cursor: pointer; padding: 0 3px; }
.chat-model-trigger span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-model-trigger .chat-icon { width: 13px; height: 13px; }
.chat-draft-status { min-height: 20px; margin: 4px 0 0; text-align: center; font-size: 11px; line-height: 1.4; color: var(--chat-muted); }
.chat-image-previews { display: flex; gap: 8px; padding: 2px 8px 10px; overflow-x: auto; max-height: 110px; }
.chat-image-preview { width: 74px; position: relative; flex: 0 0 auto; }
.chat-image-preview img { width: 68px; height: 64px; object-fit: cover; border-radius: 9px; border: 1px solid var(--chat-line); }
.chat-image-preview figcaption { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 10px; color: var(--chat-muted); }
.chat-image-preview { margin: 0; }
.chat-image-preview button { position: absolute; top: -8px; right: -6px; display: grid; place-items: center; width: 44px; height: 44px; border: 0; background: transparent; padding: 11px; cursor: pointer; }
.chat-image-preview button .chat-icon { width: 20px; height: 20px; padding: 3px; color: white; background: #4c4b64; border-radius: 50%; border: 1px solid white; }
.chat-ready .composer-recurring-options[hidden] { display: none; }
.chat-ready .composer-secondary { display: none; }
.chat-ready .composer-box.more-open .composer-secondary { display: flex; flex-direction: column; position: absolute; bottom: calc(100% + 8px); left: 0; right: 0; z-index: 4; padding: 10px; background: white; border: 1px solid var(--chat-line); border-radius: 12px; box-shadow: var(--shadow-md); }
.chat-ready .composer-secondary .btn, .chat-ready .composer-secondary .composer-tool { min-height: 44px; margin: 0; }
.chat-ready .chat-queue-trigger { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; min-height: 52px; margin: 8px 12px 0; padding: 9px 12px; background: #f5f4ff; border: 1px solid #e8e4fa; border-radius: 12px; text-align: left; color: #55517c; cursor: pointer; }
.chat-queue-trigger strong { font-size: 12px; display: block; }
.chat-queue-trigger small { display: block; font-size: 11px; color: #706c8b; }
.chat-queue-trigger > .chat-icon:last-child { margin-left: auto; width: 15px; }
#chat-new-messages { position: absolute; bottom: 190px; left: 50%; transform: translateX(-50%); border: 1px solid #ddd8f7; background: #fff; box-shadow: var(--shadow-sm); border-radius: 24px; padding: 10px 16px; min-height: 44px; color: #574fc1; cursor: pointer; z-index: 3; }
.chat-sheet { width: min(520px, calc(100vw - 32px)); max-height: calc(var(--chat-viewport-height, 100dvh) - 32px); padding: 0; border: 1px solid #ecebf2; border-radius: 20px; color: #262b3c; background: white; overflow: hidden; }
.chat-sheet[open] { display: flex; flex-direction: column; }
.chat-sheet::backdrop { background: #20253b60; backdrop-filter: blur(2px); }
.chat-sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 16px 16px 8px 20px; flex: 0 0 auto; }
.chat-sheet-head h2 { font-size: 20px; font-weight: 650; letter-spacing: -.4px; margin: 0; }
.chat-sheet-head h2:focus { outline: none; }
.chat-sheet-body { padding: 0 20px 16px; overflow: auto; min-height: 0; }
.chat-sheet-description { font-size: 12px; color: #697186; margin: 0 0 15px; }
.chat-sheet-footer { padding: 8px 20px max(16px, env(safe-area-inset-bottom)); flex: 0 0 auto; border-top: 1px solid #f0f0f5; }
.chat-sheet-footer .btn { width: 100%; min-height: 44px; background: #5850df; border-color: #5850df; }
.chat-sheet .btn { min-height: 44px; font-size: 12px; }
.chat-sheet [aria-pressed="true"] { background: #f3f0ff; border-color: #beb5f1; color: #5146b5; }
.chat-provider-options, .chat-effort-options { display: grid; gap: 6px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.chat-provider-options { background: #f5f5f9; padding: 4px; border-radius: 12px; gap: 3px; }
.chat-effort-options { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.chat-provider-options button, .chat-effort-options button { min-height: 44px; border: 1px solid #e8e9f0; background: #fff; border-radius: 9px; font-size: 12px; color: #626a7e; padding: 6px; cursor: pointer; }
.chat-model-options { display: grid; gap: 6px; }
.chat-model-option { display: flex; align-items: center; justify-content: space-between; text-align: left; min-height: 50px; background: #fff; border: 1px solid #e8e9f0; border-radius: 11px; padding: 10px 12px; font-size: 14px; color: #353b4c; cursor: pointer; }
.chat-model-option[aria-pressed="true"]::after { content: '✓'; font-weight: bold; }
.chat-additional-models > summary { min-height: 44px; padding: 12px 4px; color: #655bb8; cursor: pointer; font-size: 12px; }
.chat-additional-models .chat-model-option { width: 100%; margin-top: 6px; }
.chat-option-title { font-size: 12px; font-weight: 600; color: #72798c; margin: 18px 0 9px; }
.chat-option-note { font-size: 12px; color: #697186; }
.chat-queue-item { border-bottom: 1px solid #e8e9f0; padding: 15px 0; }
.chat-queue-item-head { display: flex; align-items: flex-start; gap: 10px; }
.chat-queue-position { flex: 0 0 23px; height: 23px; display: grid; place-items: center; border-radius: 6px; font-size: 11px; color: #747b8c; background: #f2f3f8; }
.chat-queue-item-head > div { min-width: 0; }
.chat-queue-item-head strong { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; font-size: 14px; font-weight: 600; }
.chat-queue-item small { font-size: 11px; color: #72798b; overflow-wrap: anywhere; }
.chat-retry-banner { border: 1px solid #efdfbd; background: #fffbf3; color: #80591f; border-radius: 10px; padding: 10px; margin-top: 12px; }
.chat-retry-banner strong, .chat-retry-banner > span { display: block; font-size: 12px; }
.chat-retry-banner > span { margin-top: 5px; }
.chat-retry-banner form { margin: 8px 0 0; }
.chat-queue-edit > summary { min-height: 44px; padding: 12px 0; font-size: 12px; cursor: pointer; color: #6156bf; }
.chat-queue-edit textarea { min-height: 90px; font-size: 16px; }
.chat-queue-edit .btn { margin-top: 7px; }
.chat-queue-edit form { margin: 8px 0 16px; }
.chat-queue-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.chat-queue-actions form { margin: 0; }
.chat-queue-actions form:last-child { margin-left: auto; }
.chat-queue-feedback { padding: 0 20px; margin: 0; font-size: 12px; color: #555d72; }
.chat-queue-feedback:not(:empty) { padding: 10px 20px; }
.chat-recurring-plans { margin-top: 20px; border-top: 1px solid var(--chat-line); }
.chat-recurring-plans h3 { font-size: 15px; }
.chat-recurring-plan { padding: 12px 0; border-bottom: 1px solid var(--chat-line); overflow-wrap: anywhere; }
.chat-recurring-plan p { font-size: 13px; margin: 6px 0; }
.chat-recurring-plan > a { display: flex; align-items: center; min-height: 44px; font-size: 13px; }
.chat-sheet .chat-head { display: block; }
.chat-sheet .chat-head h1 { font-size: 15px; }
.chat-sheet .task-info-disclosure, .chat-sheet .info-popover { display: block; position: static; border: 0; padding: 0; box-shadow: none; }
.chat-sheet .info-popover-links, .chat-sheet .task-info-disclosure > summary { display: none; }
.chat-sheet .chat-head > .actions { margin-top: 12px; display: flex; gap: 8px; flex-wrap: wrap; }
.chat-sheet .chat-head .chat-head-link { display: inline-flex; }
.chat-ready .bug-report-inbox { max-height: 30dvh; overflow: auto; flex: 0 0 auto; margin: 8px 12px; }
.chat-icon-button:focus-visible, .chat-model-trigger:focus-visible, .chat-sheet button:focus-visible { outline: 3px solid #9b90eb; outline-offset: 2px; }
.chat-ready [aria-busy="true"] .composer-send { opacity: .55; }
.container-card:target { outline: 2px solid var(--primary); outline-offset: 4px; scroll-margin-top: 80px; }
@media (max-width: 760px) {
    .chat-ready > .topbar { display: none; }
    .chat-ready .task-detail-wrap.chat-mode { position: fixed; top: var(--chat-viewport-top, 0px); left: 0; right: 0; height: var(--chat-viewport-height, 100dvh); padding: 0; width: 100%; }
    .chat-ready .task-chat-panel { border: 0; border-radius: 0; padding: 0; }
    .chat-ready .mobile-chat-header { padding: 6px 16px 0; }
    .mobile-chat-header h1 { font-size: 20px; }
    .chat-ready .task-chat-panel .chat-shell { padding: 17px 18px 10px; }
    .chat-ready .message-meta a { display: none; }
    .chat-ready .cli-meta { flex-basis: auto; order: initial; }
    .chat-ready .message-meta { row-gap: 4px; }
    .chat-sheet { position: fixed; inset: auto 0; top: calc(var(--chat-viewport-top, 0px) + var(--chat-viewport-height, 100dvh)); transform: translateY(-100%); width: 100%; max-width: 100%; max-height: calc(var(--chat-viewport-height, 100dvh) - 24px); margin: 0; border: 0; border-radius: 22px 22px 0 0; }
    .chat-sheet::before { content: ''; width: 32px; height: 4px; margin: 9px auto 0; background: #dcdde5; border-radius: 5px; flex: 0 0 auto; }
    .chat-sheet-head { padding-top: 9px; }
    .chat-ready .composer .speech-status { font-size: 11px; }
    .chat-ready .task-detail-wrap > .error, .chat-ready .task-detail-wrap > .notice { margin: 5px 12px; max-height: 20dvh; overflow: auto; flex: 0 0 auto; }
}
@media (max-width: 360px) {
    .chat-ready .composer { padding-left: 8px; padding-right: 8px; }
    .chat-ready .composer-toolbar { gap: 0; }
    .chat-model-trigger { font-size: 11px; }
    .chat-model-trigger .chat-icon:first-child { display: none; }
}
