/* A conversation-first ID studio. Other workspaces retain their own layout. */
.conversation-bar-actions { display:flex; align-items:center; gap:10px; }
.sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }
body:has(.design-workspace) > header { min-height:64px; padding-inline:28px; background:#ffffffc9; }
main.chat-mode:has(.design-workspace) { width:100%; max-width:1920px; height:calc(100dvh - 64px); min-height:560px; display:flex; flex-direction:column; padding:14px 24px 20px; }
main:has(.design-workspace) .work-project-name { flex-shrink:0; margin-bottom:7px; font-size:11px; }
.design-project-bar { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:4px 12px; flex-shrink:0; margin-bottom:6px; }
main:has(.design-workspace) .design-project-bar .work-project-name { margin:0; min-width:0; flex-shrink:1; overflow-wrap:anywhere; }
.design-project-actions { display:flex; gap:8px; flex-wrap:wrap; }
.design-project-actions .quiet-button { font-size:10px; padding:3px 6px; border-color:transparent; }
.design-project-actions .design-proposal-link { color:#5479c4; background:#edf3ff; border-color:#dae6fe; }
main:has(.design-workspace) .project-tabs { flex-shrink:0; margin-bottom:14px; padding-bottom:9px; gap:6px; }
main:has(.design-workspace) .project-tabs a { padding:7px 12px; }
.design-workspace { flex:1; min-height:0; height:auto; grid-template-columns:minmax(0,1fr) clamp(310px,29vw,440px); gap:18px; position:relative; }
.design-workspace.library-hidden { grid-template-columns:minmax(0,1fr); }
.design-workspace.library-hidden .design-library { display:none; }
.design-workspace .conversation { border-color:#dce5ee; border-radius:18px; background:#fff; }
.design-workspace .conversation-bar { padding:16px 25px; flex-shrink:0; background:linear-gradient(100deg,#fff,#f9fbff); }
.design-workspace .chat-avatar { background:#eaf0ff; border:1px solid #dce6ff; color:#315deb; }
.design-workspace .conversation-identity strong { font-size:15px; font-weight:650; }
.design-workspace .conversation-identity small { margin-top:2px; font-size:11px; color:#7c8c9d; }
.design-workspace #designLibraryToggle { padding:7px 9px; background:white; }
.design-workspace .workspace-messages { padding:30px clamp(22px,3.3vw,64px) 20px; overscroll-behavior:contain; scrollbar-gutter:stable; }
.design-workspace .workspace-message { max-width:880px; margin:0 auto 30px; }
.design-workspace .workspace-message.user { margin:0 0 28px auto; max-width:80%; }
.design-workspace .message-author { margin-bottom:10px; font-size:11px; color:#8693a4; }
.design-workspace .message-body { line-height:1.9; color:#354454; }
.design-workspace .message-body strong { color:#273d58; font-weight:600; }
.design-workspace .message-body code { font-size:.9em; background:#f0f4fa; border-radius:4px; padding:2px 4px; }
.design-message-heading { font-size:1.08em; }
.design-workspace .workspace-message.user .message-body { background:#f1f5fc; border-color:#e6edf8; color:#293f5e; padding:11px 16px; border-radius:16px 16px 4px 16px; }
.design-workspace .message-actions { margin-top:9px; }
.design-workspace .message-actions .quiet-button { border-color:transparent; color:#8a98a8; padding-left:0; }
.design-workspace .design-figure { width:100%; max-width:760px; margin-top:18px; border:1px solid #e1e8f0; border-radius:16px; overflow:hidden; background:#fff; box-shadow:0 5px 20px #26394f05; }
.design-workspace .design-image-stage { position:relative; border:0; border-radius:0; background:radial-gradient(ellipse at center,#fff,#f0f3f7); cursor:zoom-in; }
.design-workspace .design-image-stage img { width:100%; height:clamp(260px,43dvh,520px); max-height:none; object-fit:contain; }
.image-expand-label { position:absolute; right:12px; bottom:12px; display:flex; align-items:center; gap:6px; color:#546780; background:#ffffffed; border:1px solid #dfe6ef; border-radius:8px; padding:6px 9px; font-size:10px; box-shadow:0 2px 8px #243a5510; }
.image-expand-label .icon { width:14px; height:14px; }
.design-image-stage:hover .image-expand-label { color:var(--brand); border-color:#a9bff2; }
.design-figure figcaption { margin:0; padding:13px 16px 9px; display:flex; align-items:center; justify-content:space-between; gap:12px; }
.design-figure figcaption strong { display:block; font-size:12px; color:#40546c; font-weight:550; overflow-wrap:anywhere; }
.design-figure figcaption div>span { display:block; font-size:10px; color:#95a2b0; margin-top:2px; }
.image-saved { display:flex; align-items:center; gap:4px; color:#5e9384; font-size:10px; flex-shrink:0; }
.image-saved .icon { width:12px; height:12px; }
.design-image-actions { display:flex; flex-wrap:wrap; gap:7px; padding:0 16px 14px; }
.design-image-actions .quiet-button { padding:7px 10px; color:#526a89; background:#f9fbfe; border-color:#dfe7f2; }
.design-image-actions .quiet-button:first-child { color:#325ece; border-color:#d9e4ff; background:#f3f6ff; }
.design-image-actions .image-download { margin-left:auto; background:transparent; border-color:transparent; }
.design-workspace .workspace-composer { flex-shrink:0; margin:0 24px 10px; padding:12px 15px; border-radius:16px; border-color:#d4dfef; box-shadow:0 4px 20px #30487805; }
.design-workspace .workspace-composer textarea { min-height:64px; max-height:140px; font-size:13px; }
.design-workspace .workspace-composer textarea::placeholder { color:#8a98aa; }
.design-workspace .composer-tools { margin-top:6px; }
.design-workspace .composer-hint { display:flex; align-items:center; gap:12px; flex-wrap:wrap; }
.design-workspace .composer-attach { border:0; background:#f1f5fa; color:#5e7594; border-radius:8px; padding:6px 9px; }
.design-workspace .keyboard-hint { font-size:10px; color:#98a4b2; }
.design-workspace .composer-note { flex-shrink:0; margin:0 26px 12px; font-size:9px; color:#8897a6; line-height:1.6; }
.design-workspace .workspace-composer.is-dragover { background:#f2f6ff; border-color:#537ff0; box-shadow:0 0 0 3px #537ff022; }
.design-reference { display:flex; align-items:center; gap:10px; margin-bottom:9px; width:fit-content; max-width:100%; padding:7px 10px 7px 7px; background:#f1f6ff; border:1px solid #dce7ff; border-radius:10px; }
.reference-thumb { width:46px; height:42px; padding:0; border:0; background:#fff; border-radius:6px; overflow:hidden; flex-shrink:0; cursor:zoom-in; }
.reference-thumb img { width:100%; height:100%; object-fit:contain; }
.design-reference>div { min-width:0; }
.design-reference strong { display:block; font-size:11px; color:#416bc3; font-weight:550; }
.design-reference span { display:block; font-size:10px; color:#7c8eaa; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; max-width:300px; }
.reference-remove { border:0; background:transparent; border-radius:7px; padding:6px; color:#8b9bac; display:grid; place-items:center; flex-shrink:0; }
.reference-remove:hover { color:#315caf; background:#edf2fa; }
.reference-remove .icon { width:17px; height:17px; }
.sent-image-reference { display:flex; align-items:center; gap:10px; margin:8px 0 0 auto; background:#fff; border:1px solid #dce5f0; border-radius:10px; padding:7px; font-size:11px; color:#7186a2; }
.sent-image-reference img { width:64px; height:52px; object-fit:contain; border-radius:5px; background:#f4f7fb; }
.sent-image-reference>.icon { width:14px; height:14px; margin:0 6px; }
.chat-mode:has(.work-project-name) .design-library { overflow:hidden; border-color:#dce5ee; background:#f9fbfd; border-radius:18px; }
.design-library-heading { padding:20px 20px 0; display:flex; align-items:flex-start; justify-content:space-between; gap:10px; flex-shrink:0; }
.design-eyebrow { font-size:9px; letter-spacing:.12em; color:#8a9bb1; }
.design-library-heading h2 { margin:3px 0 0; font-size:17px; font-weight:600; display:flex; align-items:center; gap:9px; letter-spacing:-.4px; }
.design-library-heading h2>span { font-size:10px; font-weight:500; letter-spacing:0; background:#eaf0f7; color:#7f92a8; border-radius:5px; padding:1px 6px; }
.design-library-hint { flex-shrink:0; margin:8px 20px 16px; font-size:11px; line-height:1.7; color:#8999ac; }
.design-asset-search { display:flex; align-items:center; gap:8px; margin:0 18px; padding:8px 10px; border:1px solid #e0e7ef; background:#fff; border-radius:9px; color:#9baaba; flex-shrink:0; }
.design-asset-search .icon { width:15px; height:15px; }
.design-asset-search:focus-within { border-color:#9db8f2; }
.design-asset-search input { width:100%; min-width:0; padding:0; background:transparent; border:0; font-size:11px; color:var(--ink); }
.design-asset-search input::placeholder { color:#98a6b7; }
.design-asset-search input:focus-visible { outline:none; }
.design-library .asset-filters { padding:12px 16px 10px; }
.design-library .asset-filters button { font-size:11px; padding:7px 4px; }
.chat-mode:has(.work-project-name) .design-asset-grid { flex:1; min-height:0; display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); grid-auto-rows:max-content; align-items:start; align-content:start; gap:12px; padding:4px 16px 20px; overflow-y:auto; overscroll-behavior:contain; }
.design-asset { background:#fff; min-width:0; height:max-content; border:1px solid #e0e7ef; border-radius:12px; overflow:hidden; transition:border-color .15s,box-shadow .15s; }
.design-asset:hover { border-color:#b7c9e8; box-shadow:0 4px 12px #2b507009; }
.design-asset.is-selected { border-color:#8baaf2; box-shadow:0 0 0 2px #dfe9ff; }
.design-asset-preview { position:relative; display:grid; place-items:center; width:100%; aspect-ratio:1.15; padding:6px; background:#f1f4f8; border:0; border-radius:0; cursor:zoom-in; }
.design-asset-preview img { display:block; width:100%; height:100%; position:absolute; inset:0; object-fit:contain; }
.design-asset-preview>.icon { width:32px; height:32px; color:#95acc7; }
.asset-expand { position:absolute; bottom:7px; right:7px; background:#fffffff0; border:1px solid #e3e9f1; border-radius:5px; padding:4px; color:#7e94ad; }
.asset-expand .icon { width:12px; height:12px; }
.design-asset-copy { padding:9px 9px 8px; }
.design-asset-copy>strong { display:block; font-size:10px; color:#526780; font-weight:550; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.design-asset-copy>small { display:block; margin-top:2px; font-size:9px; color:#9aa8b9; }
.design-asset-actions { display:flex; align-items:stretch; flex-wrap:wrap; gap:4px; margin-top:9px; }
.asset-reference-button,.asset-edit-button { border:1px solid #dfe8f6; border-radius:6px; background:#f5f8ff; color:#5475b2; font-size:10px; display:flex; align-items:center; justify-content:center; gap:4px; padding:6px; line-height:1.4; }
.asset-reference-button { flex:1; }
.asset-reference-button .icon,.asset-edit-button .icon { width:12px; height:12px; flex-shrink:0; }
.asset-edit-button { background:#fff; color:#8195b0; }
.asset-reference-button:hover,.asset-edit-button:hover { border-color:#91b0ee; color:var(--brand); }
.design-asset .asset-source { display:block; margin-top:7px; font-size:9px; color:#9caabc; text-decoration:none; }
.design-asset .asset-source:hover { color:var(--brand); text-decoration:underline; }
.design-library .library-empty { grid-column:1/-1; padding:52px 12px; }
.design-library .library-empty>.icon { width:34px; height:34px; color:#a6b8d0; margin-bottom:16px; }
.design-library .library-empty p { max-width:245px; margin:10px auto 0; color:#94a3b6; }
.design-library-footer { flex-shrink:0; display:flex; align-items:center; justify-content:center; gap:6px; padding:12px 15px; font-size:10px; color:#8a9cac; border-top:1px solid #e3eaf2; }
.design-library-footer .icon { width:13px; height:13px; color:#7aa397; }
.design-image-viewer { width:min(1440px,calc(100vw - 48px)); max-height:94dvh; padding:0; border:1px solid #dbe4f0; border-radius:20px; background:#fff; color:var(--ink); box-shadow:0 30px 100px #10213b35; }
.design-image-viewer::backdrop { background:#12213c99; backdrop-filter:blur(7px); }
.design-viewer-header { display:flex; align-items:center; justify-content:space-between; gap:16px; padding:16px 24px; }
.design-viewer-header h2 { margin:0; font-size:14px; font-weight:600; overflow-wrap:anywhere; }
.design-viewer-header span { display:block; color:#92a0b1; font-size:10px; margin-top:3px; }
.design-viewer-canvas { height:68dvh; background:#eef2f6; overflow:auto; display:flex; align-items:center; justify-content:center; position:relative; }
.design-viewer-canvas img { display:block; max-height:100%; max-width:100%; object-fit:contain; }
.design-viewer-canvas.is-zoomed { display:block; }
.design-viewer-canvas.is-zoomed img { max-width:none; max-height:none; margin:auto; }
.design-viewer-canvas .error { position:absolute; top:30%; left:10%; right:10%; text-align:center; }
.design-viewer-tools { padding:15px 22px; display:flex; align-items:center; justify-content:space-between; gap:15px; flex-wrap:wrap; }
.viewer-navigation,.viewer-actions { display:flex; flex-wrap:wrap; align-items:center; gap:8px; }
.viewer-navigation .quiet-button { min-height:32px; padding:6px 10px; }
.viewer-actions .button { font-size:12px; padding:10px 14px; }
.viewer-actions .icon { width:16px; height:16px; }
@media(min-width:1650px) { .design-workspace { grid-template-columns:minmax(0,1fr) 440px; } }
@media(max-width:1100px) { .design-workspace .conversation-bar { padding:14px 18px; }.design-workspace .api-status { display:none; }.design-workspace .keyboard-hint { display:none; }.design-workspace .workspace-messages { padding:24px; }.design-workspace .workspace-composer { margin-inline:16px; }.design-workspace .composer-note { margin-inline:18px; } }
@media(max-width:900px) {
  body:has(.design-workspace)>header { min-height:60px; padding-inline:16px; }
  main.chat-mode:has(.design-workspace) { height:calc(100dvh - 60px); min-height:560px; padding:10px 12px 12px; }
  .design-workspace { display:grid; grid-template-columns:minmax(0,1fr); min-height:0; }
  .design-workspace .conversation { height:auto; min-height:0; }
  .design-workspace .design-library { position:absolute; inset:0 0 0 auto; width:min(390px,100%); z-index:5; max-height:none; min-height:0; box-shadow:-14px 0 50px #17365625; background:#f9fbfd; }
  .design-workspace .workspace-messages { padding:20px 18px; }
  .design-workspace .design-image-stage img { height:clamp(220px,35dvh,440px); }
  .design-workspace .conversation-identity small { max-width:200px; }
}
@media(max-width:500px) {
  .design-workspace .conversation-bar { padding:12px; gap:6px; }
  .design-workspace .conversation-identity { gap:8px; }
  .design-workspace .conversation-identity strong { font-size:13px; }
  .design-workspace .conversation-identity small { font-size:10px; max-width:155px; }
  .design-workspace .conversation-identity .chat-avatar { width:28px; height:28px; }
  .design-workspace .conversation-bar-actions { gap:4px; }
  .design-workspace #designLibraryToggle { font-size:10px; padding:6px; }
  .design-workspace #designLibraryToggle .icon { display:none; }
  .design-workspace .workspace-composer { margin-inline:10px; padding:10px; }
  .design-workspace .composer-note { margin-inline:12px; font-size:8px; }
  .design-workspace .workspace-messages { padding:18px 12px; }
  .design-figure figcaption { padding:11px 12px 8px; flex-wrap:wrap; gap:4px; }
  .design-image-actions { padding:0 10px 10px; gap:5px; }
  .design-image-actions .quiet-button { font-size:10px; padding:6px; }
  .design-image-actions .image-download { margin-left:0; }
  .design-reference span { max-width:170px; }
  .design-image-viewer { width:calc(100vw - 16px); border-radius:14px; }
  .design-viewer-header { padding:12px 15px; }
  .design-viewer-canvas { height:56dvh; }
  .design-viewer-tools { padding:12px; gap:12px; }
  .viewer-actions { width:100%; }.viewer-actions .button { flex:1; justify-content:center; font-size:11px; padding:9px; }
}
@media(prefers-reduced-motion:reduce) { .design-asset { transition:none; } }
/* Keep the latest image and its actions together within the chat viewport. */
@supports (height:1cqh) {
  .design-workspace .workspace-messages { container-type:size; }
  .design-workspace .design-image-stage img { height:clamp(220px,calc(100cqh - 75px),520px); }
  .design-workspace .design-figure figcaption { padding:8px 14px 6px; }
  .design-figure figcaption>div { display:flex; align-items:center; flex-wrap:wrap; gap:2px 10px; }
  .design-figure figcaption div>span { margin:0; }
  .design-workspace .design-image-actions { padding:0 14px 10px; }
  .design-image-actions .quiet-button { padding:5px 8px; }
}
