/* Command / Inspect: a readable conversation, with a separate composer row. */
#detail[data-chat]{display:grid;grid-template-rows:auto minmax(0,1fr) auto;min-height:0;height:100%;padding:0;overflow:hidden;background:#fff}
.chat-topbar{padding:16px 30px 14px;display:flex;flex-wrap:wrap;align-items:center;gap:12px 24px;border-bottom:1px solid #f0f0f0;position:sticky;top:0;z-index:5;background:#fff}
.chat-heading{flex:1 1 180px;min-width:0}
.chat-topbar .chat-pinned{width:auto;max-width:none;margin:4px 0 0;justify-content:flex-start;gap:14px}
@media(max-width:1000px){.chat-heading{flex-basis:100%}}
.chat-topbar h2{font:600 16px Arial,Helvetica,sans-serif;letter-spacing:-.2px;line-height:1.4;margin:0;flex:1 1 180px;overflow-wrap:anywhere}
.chat-tabs{display:flex;gap:4px;padding:4px;background:#f4f4f4;border-radius:28px;max-width:100%}
.chat-tabs button{min-height:44px;min-width:0;font-size:12px;font-weight:500;line-height:1.4;text-align:center;border:0;border-radius:23px;padding:8px 15px;background:transparent;color:#666;overflow-wrap:anywhere}
.chat-tabs [aria-selected="true"]{background:#fff;color:#222;box-shadow:0 1px 4px #0000000c}
.chat-scroll{min-height:0;overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain;scrollbar-gutter:stable;padding:16px 28px 24px}
.chat-pinned,.chat-scroll>.muted,.chat-messages,.chat-library,#detail[data-chat] #project-archive{width:100%;max-width:760px;margin-left:auto;margin-right:auto}
.chat-pinned{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;padding:0;background:transparent;border:0;position:relative;font-size:12px;line-height:1.5}
.chat-status{font-weight:500;color:#555;display:flex;align-items:center}
.chat-status[data-busy="true"]{color:#333}
.chat-timer{font-size:11px;font-variant-numeric:tabular-nums;color:#707070}
.chat-scroll>.muted{font-size:11px;line-height:1.55;color:#737373;margin-top:8px;margin-bottom:18px}
.chat-messages{min-height:140px;max-height:none;padding:4px 0 12px;overflow:visible}
#detail .chat-message{min-height:0;padding:12px 0 22px;margin:0 0 12px;border:0;background:#fff;border-radius:0;max-width:100%;font-size:15px;line-height:1.8}
.chat-message strong{display:block;font-size:12px;color:#343434;font-weight:600;margin-bottom:6px}
.chat-message p{white-space:pre-wrap;overflow-wrap:anywhere;margin:0}
#detail .chat-message[data-role="user"]{background:#f4f4f4;border-radius:24px;padding:14px 20px;margin-left:auto;width:fit-content;max-width:83%}
.chat-message[data-role="user"] strong{font-size:11px;color:#707070;font-weight:400}
#detail .chat-message[data-role="system"]{background:#fafafa;border-radius:14px;padding:14px 16px;font-size:13px;color:#666}
.chat-dock{min-width:0;padding:10px 28px max(9px,env(safe-area-inset-bottom));background:#fff}
.chat-composer{position:relative;bottom:auto;display:grid;grid-template-columns:44px minmax(0,1fr) 44px;align-items:center;gap:4px 8px;max-width:760px;margin:0 auto;padding:12px;background:#f4f4f4;border:1px solid #ededed;border-radius:28px;box-shadow:0 2px 8px #00000003}
.chat-composer:focus-within{border-color:#bcbcbc}
.chat-composer>label:first-child{grid-column:1/-1;margin:0;padding:0 8px;font-size:11px;font-weight:400;color:#737373}
.chat-composer textarea{display:block;width:100%;min-width:0;max-width:100%;height:58px;min-height:58px;max-height:160px;resize:vertical;margin:3px 0 0;padding:5px 0;border:0;background:transparent;color:#242424;font:14px/1.6 Arial,Helvetica,sans-serif;border-radius:3px}
.chat-composer textarea:focus-visible{outline:0}
.chat-composer textarea::placeholder{color:#858585}
.chat-composer .chat-attach{position:relative;display:grid;place-items:center;width:44px;height:44px;margin:0;cursor:pointer;border-radius:50%;color:#333;font-size:28px;font-weight:400;line-height:1;overflow:hidden}
.chat-attach:hover{background:#e6e6e6}
.chat-attach:focus-within{outline:2px solid #666;outline-offset:2px}
.chat-composer .chat-attach input[type="file"]{position:absolute;inset:0;opacity:0;width:44px;height:44px;min-height:44px;margin:0;padding:0;cursor:pointer}
.chat-composer .primary{grid-column:3;width:44px;height:44px;min-height:44px;padding:0;border:0;border-radius:50%;background:#262626;color:#fff;text-align:center;font-size:25px;font-weight:400;line-height:1}
.chat-composer .primary:hover{background:#444}
.chat-composer .primary:disabled{opacity:.35}
.chat-keyboard-hint{grid-column:1/-1;font-size:10px;color:#797979;text-align:center;margin-top:1px}
.chat-picked{min-width:0;overflow-wrap:anywhere;color:#555;font-size:11px;max-height:48px;overflow:auto;line-height:1.4}
.chat-pending{grid-column:1/-1;display:flex;gap:5px;flex-wrap:wrap;margin:0 4px;font-size:11px;max-height:80px;overflow:auto}
.chat-pending:empty{display:none}
.chat-pending > .chat-pending-item{display:inline-flex;align-items:center;gap:4px;padding:2px 2px 2px 9px;border:1px solid #ddd;background:#fff;border-radius:10px;max-width:100%;min-width:0}
.chat-pending-name{min-width:0;overflow-wrap:anywhere}
.chat-pending .chat-remove-attachment{display:grid;place-items:center;text-align:center;flex:0 0 44px;width:44px;min-width:44px;height:44px;min-height:44px;padding:0;border:0;border-radius:8px;background:transparent;color:#555;font-size:20px;line-height:1;cursor:pointer}
.chat-remove-attachment:hover{background:#eee;color:#111}
.chat-remove-attachment:disabled{opacity:.35;cursor:default}
.chat-error{width:100%;max-width:760px;margin:0 auto 8px;padding:10px 12px;border:1px solid #efd5d5;border-radius:12px;color:var(--danger);font-size:12px;line-height:1.6;background:#fff7f7;white-space:pre-wrap;overflow-wrap:anywhere;max-height:18vh;overflow:auto}
.chat-error:empty{display:none}
.chat-disclaimer{max-width:760px;margin:8px auto 0;color:#777;font-size:10px;line-height:1.45;text-align:center}
.chat-library{margin-top:10px;margin-bottom:0;border-top:1px solid #eee;padding:0}
.chat-library>summary,#detail[data-chat] #project-archive>summary{font-size:12px;font-weight:400;cursor:pointer;min-height:44px;padding:12px 2px;color:#646464}
#detail[data-chat] #project-archive{border-top:1px solid #eee;padding:0;margin-top:0;font-size:12px}
.chat-file{min-width:0;max-width:100%;padding:14px 0;border-bottom:1px solid #eee;overflow-wrap:anywhere}
.chat-file>a{display:block;font-size:13px;font-weight:600;text-underline-offset:3px;margin-bottom:5px;min-height:28px}
.chat-file small{display:block;font-size:11px;color:#707070;line-height:1.6;overflow-wrap:anywhere;margin:4px 0}
.chat-file button{max-width:100%;font-size:11px;line-height:1.5;min-height:44px;padding:8px 12px;margin:5px 6px 0 0;border-radius:12px;overflow-wrap:anywhere}
.chat-file-details>summary{cursor:pointer;min-height:44px;padding:12px 0;font-size:11px;color:#777}
.chat-file-details small{font-family:monospace;font-size:10px;line-height:1.7}
.chat-confirm{padding:14px;border:1px solid #ccc;border-radius:16px;background:#fafafa;margin-top:12px;font-size:12px;overflow-wrap:anywhere}
.chat-confirm .confirmation{display:flex;gap:10px;align-items:flex-start;font-weight:400;font-size:12px;line-height:1.6}
.chat-confirm input[type="checkbox"]{width:22px;min-width:22px;min-height:22px;margin:2px 0 0}
.chat-confirm textarea{display:block;width:100%;padding:10px;border:1px solid #ccc;border-radius:10px;font:inherit;resize:vertical;min-height:80px;background:#fff}
.chat-legacy a{display:block;min-height:44px;padding:10px 0;overflow-wrap:anywhere}
#detail[data-chat] [hidden]{display:none!important}
@media(max-width:1000px){.chat-topbar{align-items:flex-start;gap:8px;padding:12px 22px}.chat-topbar h2{flex-basis:100%}}
@media(max-width:760px){
 .chat-topbar{padding:10px 14px;gap:7px}.chat-topbar h2{font-size:14px}
 .chat-tabs{width:100%}.chat-tabs button{flex:1;font-size:11px;padding:7px 8px;min-height:44px}
 .chat-scroll{padding:12px 16px 16px}.chat-pinned{gap:5px;font-size:11px}.chat-timer{font-size:10px}
 .chat-scroll>.muted{font-size:10px;margin-bottom:14px}
 #detail .chat-message{font-size:14px;line-height:1.75;padding-bottom:18px}
 #detail .chat-message[data-role="user"]{max-width:90%;padding:12px 16px;border-radius:22px}
 .chat-dock{padding:8px 12px max(7px,env(safe-area-inset-bottom))}
 .chat-composer{padding:9px;border-radius:25px;gap:3px 5px}
 .chat-composer textarea{height:48px;min-height:48px;max-height:110px;font-size:16px}
 .chat-disclaimer{font-size:9px;margin-top:6px}.chat-keyboard-hint{font-size:9px}
 .chat-file button{max-width:100%}
}
@media(max-width:760px) and (max-height:650px){
 .chat-topbar{padding:8px 12px;gap:5px}
 .chat-scroll{padding:8px 14px}
 .chat-composer>label:first-child{font-size:0}
 .chat-composer textarea{height:40px;min-height:40px;max-height:80px;margin-top:0}
 .chat-keyboard-hint{display:none}
 .chat-dock{padding-top:6px;padding-bottom:5px}
}
@media(max-height:520px){#detail[data-chat]{overflow:auto;grid-template-rows:auto minmax(130px,1fr) auto}.chat-dock{padding-top:6px}.chat-keyboard-hint{display:none}}
