/* Reuse the existing workspace tokens and native controls. */
.chat-image-preview{display:block;width:min(100%,420px);height:auto;min-height:120px;flex-shrink:0;padding:0;overflow:hidden;border:1px solid var(--border);border-radius:12px;background:var(--card);cursor:zoom-in}.chat-image-preview img{display:block;width:100%;height:auto;max-height:560px;object-fit:contain}.chat-image-status{padding:20px;font-size:12px;color:var(--muted)}.chat-image-preview:focus-visible{outline:2px solid var(--text);outline-offset:3px}
.media-center.chat-active>#mediaPreview{display:none}
.media-center.chat-active>.studio-chat{order:-1;min-height:280px}.media-center.chat-active>.studio-composer{display:block;max-height:38dvh}.studio-chat[hidden]{display:none!important}
.studio-chat{display:flex;flex-direction:column;flex:1;min-height:0;min-width:0;overflow:hidden;border:1px solid var(--border);border-radius:12px;background:var(--bg)}
.chat-bar{display:flex;align-items:center;gap:6px;padding:10px;border-bottom:1px solid var(--border);flex-shrink:0}.chat-bar select{min-width:0;flex:1;width:0;min-height:36px;background:var(--card);border:1px solid var(--border);border-radius:7px;font-size:12px}.chat-bar .btn{min-height:36px}
.chat-notice{font-size:11px;color:var(--muted);padding:6px 12px;flex-shrink:0}.chat-notice.error{color:var(--danger)}.chat-notice .btn{margin:5px}
.chat-feed{flex:1;min-height:0;overflow:auto;overscroll-behavior:contain;padding:16px;scrollbar-width:thin;overflow-wrap:anywhere}.chat-welcome{padding:clamp(22px,6vh,70px) 6px;color:var(--muted);line-height:1.8}.chat-welcome h2{font-size:clamp(19px,2vw,25px);color:var(--text);font-weight:600}.chat-welcome small{font-size:11px}
.chat-message{margin:0 0 22px;max-width:100%;content-visibility:auto;contain-intrinsic-size:auto 100px}.chat-role{display:block;font-size:11px;color:var(--muted);margin-bottom:6px}.chat-text{white-space:pre-wrap;line-height:1.85;font-size:14px;user-select:text}.chat-message.user{margin-left:16%;padding:10px 14px;border-radius:12px;background:var(--card2)}.chat-failed{color:var(--danger)}.chat-actions{display:flex;flex-wrap:wrap;gap:6px;margin-top:10px}.chat-actions .btn{font-size:11px;min-height:30px}.chat-image-link{display:flex;flex-direction:column;align-items:flex-start;gap:10px;line-height:1.7}
.chat-compose{border-top:1px solid var(--border);padding:12px;flex-shrink:0;background:var(--card)}.chat-compose textarea{display:block;width:100%;min-height:64px;max-height:140px;resize:vertical;border:0;background:none;padding:0;font-size:14px;line-height:1.7}.chat-compose small{display:block;color:var(--muted);font-size:10px;line-height:1.6;margin-top:7px}.chat-tools{display:flex;align-items:center;gap:8px;margin-top:8px}.chat-tools select{flex:1;min-width:0;width:0;min-height:36px;border:1px solid var(--border);border-radius:7px;background:var(--bg);font-size:12px}.chat-tools .btn{min-height:36px}
.chat-refs{display:flex;flex-wrap:wrap;gap:6px;margin:0 0 8px}.chat-ref{position:relative;width:52px;height:52px;border:1px solid var(--border);border-radius:8px;overflow:hidden;background:var(--bg)}.chat-ref img{width:100%;height:100%;object-fit:cover;display:block}.chat-ref .x{position:absolute;top:0;right:0;width:18px;height:18px;min-height:0;padding:0;line-height:1;font-size:11px;border:0;border-radius:0 0 0 6px;background:rgba(0,0,0,.55);color:#fff;cursor:pointer}#chatAttachRefs{min-height:36px}
@media(max-width:760px){.media-center.chat-active{min-height:560px;height:calc(100dvh - 190px)}.chat-bar{flex-wrap:wrap}.chat-bar select{flex-basis:50%}.chat-feed{padding:12px}.studio-switch{gap:2px}.studio-switch button{padding:7px 9px}#gallerySearch{width:100px}.chat-compose textarea{max-height:100px}}
@media(max-height:650px) and (max-width:760px){.media-center.chat-active{min-height:330px;height:calc(100dvh - 150px)}.chat-compose textarea{min-height:44px}.chat-welcome{padding:6px}}

/* Keep image tools and conversation available together, including small screens. */
.prompt-safety details{font-size:12px;line-height:1.8;margin-top:8px}.prompt-safety a{color:var(--text2);overflow-wrap:anywhere}
@media(max-width:760px){.media-center.chat-active{height:auto;min-height:0}.media-center.chat-active>.studio-chat{height:58dvh;min-height:360px;flex:auto}.media-center.chat-active>.studio-composer{max-height:none}.chat-tools{flex-wrap:wrap}.chat-tools select{flex-basis:45%}}

/* Give long prompts a readable default and a focused editor. */
.chat-notice:not(.error),.chat-compose>small{display:none}
.chat-text{font-size:15px;line-height:1.8}
.chat-compose textarea{min-height:88px;max-height:160px;overflow-y:auto;font-size:15px}
.studio-composer #prompt{min-height:104px;max-height:200px;overflow-y:auto}
.composer-heading .draft-status{margin-left:auto}
.composer-heading>#expandImagePrompt{min-height:30px;padding:4px 9px;font-size:12px;flex-shrink:0}
.chat-tools>#expandChatInput,.chat-bar>#expandChatPane{white-space:nowrap;flex-shrink:0}
.studio-text-dialog,.studio-chat-dialog{box-sizing:border-box;width:min(1120px,calc(100vw - 40px));max-width:none;height:calc(100dvh - 48px);max-height:none;margin:auto;padding:0;border:1px solid var(--border2);border-radius:14px;background:var(--card);color:var(--text);box-shadow:0 20px 70px #0006}
.studio-text-dialog[open]{display:flex;flex-direction:column}
.studio-text-dialog::backdrop,.studio-chat-dialog::backdrop{background:#0009}
.text-dialog-head{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:14px 20px;border-bottom:1px solid var(--border);flex-shrink:0}
.text-dialog-head h2{margin:0;font-size:17px;font-weight:600}
.studio-text-dialog>textarea{flex:1;min-height:0;width:100%;box-sizing:border-box;border:0;border-radius:0;resize:none;padding:22px;background:var(--bg);color:var(--text);font-family:inherit;font-size:16px;line-height:1.85;white-space:pre-wrap;overflow-wrap:anywhere}
.text-dialog-foot{display:flex;justify-content:flex-end;padding:12px 20px;border-top:1px solid var(--border)}
.studio-text-dialog .btn{min-height:40px}
.studio-chat-dialog[open]{display:flex;flex-direction:column}
.studio-chat-dialog>.studio-chat{flex:1;min-height:0;width:100%;border:0}
.studio-chat-dialog .chat-feed{padding:24px clamp(16px,5vw,72px)}
.studio-chat-dialog .chat-text{font-size:16px}
@media(max-width:760px){
 .media-center.chat-active>.studio-chat{height:68dvh;min-height:420px}
 .studio-text-dialog,.studio-chat-dialog{width:calc(100vw - 16px);height:calc(100dvh - 16px);border-radius:12px}
 .text-dialog-head{padding:12px}.studio-text-dialog>textarea{padding:16px}
 .chat-compose textarea{font-size:16px}
 .studio-composer #prompt{min-height:104px}
 .chat-tools select{flex-basis:40%}
 .chat-bar>#expandChatPane{margin-left:auto}
 .studio-chat-dialog .chat-bar{flex-wrap:wrap}
 .composer-heading .draft-status{display:none}
 .studio-text-dialog .btn{min-height:44px}
}
