/* Image studio is isolated from chat, theme layout, and launch animation. */
.xz-image-entry{display:flex;align-items:center;gap:10px;width:100%;padding:11px 14px;margin-top:9px;border:1px solid var(--line);border-radius:11px;background:transparent;color:var(--soft);text-align:left;font:inherit;font-size:12px}.xz-image-entry:hover{color:var(--text);border-color:var(--violet)}.xz-image-entry .icon{width:18px;height:18px;color:var(--violet)}.xz-image-entry small{margin-left:auto;font-size:7px;letter-spacing:.06em;color:var(--muted)}.xz-image-mobile{display:none}
.xz-image-dialog{width:min(960px,calc(100vw - 32px));max-width:960px;max-height:calc(100dvh - 32px);padding:28px;color:var(--text);background:var(--surface);border:1px solid var(--line);border-radius:22px;box-shadow:0 25px 100px rgba(0,0,0,.28);overflow:auto;overscroll-behavior:contain}.xz-image-dialog::backdrop{background:rgba(7,8,20,.72);backdrop-filter:blur(7px)}.xz-image-heading{display:flex;justify-content:space-between;align-items:center;gap:16px}.xz-image-heading h2{font-size:23px;line-height:1.3;margin:4px 0 0}.xz-image-copy{color:var(--soft);font-size:12px;line-height:1.8;margin:12px 0}.xz-image-service{margin:16px 0;padding:10px 13px;color:var(--soft);font-size:11px;border:1px solid var(--line);border-radius:10px;overflow-wrap:anywhere}.xz-image-grid{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:22px}.xz-image-compose{min-width:0}.xz-image-compose label:not(.xz-image-consent){display:block;font-size:12px;color:var(--soft);margin-bottom:8px}.xz-image-compose textarea{display:block;resize:vertical;width:100%;min-height:150px;max-height:360px;padding:14px;border:1px solid var(--line);border-radius:13px;background:var(--bg);color:var(--text);font:inherit;font-size:13px;line-height:1.8}.xz-image-compose textarea::placeholder{color:var(--muted)}.xz-image-compose textarea:disabled{opacity:.65}.xz-image-details{display:flex;justify-content:space-between;align-items:center;gap:12px;margin:10px 0;color:var(--muted);font-size:10px}.xz-image-consent{display:flex!important;align-items:flex-start;gap:9px;margin:15px 0!important;font-size:11px!important;font-weight:400!important;line-height:1.8;color:var(--soft)!important}.xz-image-consent input{flex:0 0 auto;width:15px;height:15px;margin:3px 0 0;accent-color:var(--violet)}.xz-image-actions{display:flex;align-items:center;flex-wrap:wrap;gap:10px;margin:15px 0 0}.xz-image-primary,.xz-image-quiet,.xz-image-text{font:inherit;font-size:11px;border:1px solid var(--line);border-radius:9px;padding:9px 13px;background:transparent;color:var(--soft);text-decoration:none;text-align:center;cursor:pointer}.xz-image-primary{background:var(--violet);color:var(--bg);border-color:var(--violet);font-weight:600}.xz-image-primary:hover:not(:disabled),.xz-image-quiet:hover:not(:disabled){filter:brightness(1.1)}.xz-image-quiet:hover:not(:disabled){color:var(--text);border-color:var(--violet)}.xz-image-text{padding:2px 0;border:0;color:var(--violet)}.xz-image-primary:disabled,.xz-image-quiet:disabled,.xz-image-text:disabled{opacity:.45;cursor:not-allowed}.xz-image-feedback{min-height:18px;color:var(--soft);font-size:11px;overflow-wrap:anywhere;margin:12px 0}.xz-image-feedback.is-error{color:var(--danger)}.xz-image-fine{font-size:10px;line-height:1.8;color:var(--muted)}.xz-image-result{min-width:0}.xz-image-preview{display:grid;place-items:center;min-height:300px;aspect-ratio:1;background:radial-gradient(circle at 40% 30%,rgba(137,117,225,.12),transparent 65%),var(--bg);border:1px solid var(--line);border-radius:15px;overflow:hidden;text-align:center;color:var(--muted);font-size:14px}.xz-image-preview img{display:block;max-width:100%;max-height:480px;width:100%;height:100%;object-fit:contain}.xz-image-result-status{font-size:11px;min-height:18px;overflow-wrap:anywhere;color:var(--soft)}.xz-image-history{margin-top:25px;padding-top:18px;border-top:1px solid var(--line)}.xz-image-history-heading{display:flex;align-items:center;justify-content:space-between;gap:12px}.xz-image-history-heading h3{margin:0;font-size:13px}.xz-image-history-heading span{font-size:10px;color:var(--muted)}.xz-image-history-list{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:9px;margin-top:12px}.xz-image-history-item{display:block;width:100%;padding:11px 12px;min-width:0;border:1px solid var(--line);border-radius:11px;background:transparent;color:var(--soft);text-align:left;cursor:pointer;font:inherit;font-size:11px}.xz-image-history-item strong{display:block;font-weight:500;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--text)}.xz-image-history-item small{display:block;color:var(--muted);font-size:10px;margin-top:5px}.xz-image-history-item.is-selected{border-color:var(--violet);background:rgba(137,117,225,.07)}.xz-image-admin{margin-top:23px}.xz-image-admin select,.xz-image-admin input{max-width:100%}
@media(max-width:760px){.xz-image-mobile{display:grid;width:29px;height:29px;margin-left:auto}.xz-image-dialog{width:calc(100vw - 20px);max-height:calc(100dvh - 20px);padding:18px;border-radius:17px}.xz-image-heading h2{font-size:19px}.xz-image-grid{grid-template-columns:1fr}.xz-image-preview{min-height:240px;max-height:420px}.xz-image-history-list{grid-template-columns:repeat(2,minmax(0,1fr))}.xz-image-heading{gap:8px}.xz-image-dialog .xz-image-quiet{padding:8px 10px}}
@media(max-width:380px){.xz-image-history-list{grid-template-columns:1fr}.xz-image-dialog{padding:14px}.xz-image-dialog .xz-image-actions{gap:7px}.xz-image-admin .field-grid{grid-template-columns:1fr}}
@media(prefers-reduced-motion:reduce){.xz-image-entry,.xz-image-dialog,.xz-image-primary,.xz-image-quiet,.xz-image-history-item{transition:none;animation:none}.xz-image-dialog::backdrop{backdrop-filter:none}}

/* Inline AI creation workspace; modal styling remains for older clients. */
.xz-image-dialog.xz-image-workspace { position: static; display: block; flex: 1; min-width: 0; min-height: 0; width: auto; max-width: none; max-height: none; margin: 0; padding: 36px clamp(22px, 4vw, 64px); border: 0; border-radius: 0; box-shadow: none; background: transparent; scrollbar-width: thin; scrollbar-color: #303253 transparent; }
.xz-image-workspace .xz-image-heading h2 { font-size: 27px; letter-spacing: -.03em; }
.xz-image-workspace .xz-image-service { margin: 22px 0; background: rgba(130, 138, 196, .025); }
.xz-image-workspace .xz-image-grid { gap: 26px; }
.xz-image-workspace .xz-image-compose textarea { min-height: 205px; }
.history-workspace .xz-image-history { margin: 0; padding: 0; border: 0; }
.history-workspace .xz-image-history-heading { margin-bottom: 4px; align-items: flex-start; }
.history-workspace .xz-image-history-heading .workspace-history-hint { margin-bottom: 0; }
.history-workspace .xz-image-history-heading button { flex-shrink: 0; }
.history-workspace .xz-image-history-item { min-height: 84px; padding: 16px; }
.history-workspace .xz-image-history-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
#image-history-feedback:empty { display: none; }
html[data-theme="light"] .xz-image-workspace { scrollbar-color: #c9ccd1 transparent; }
@media (max-width: 760px) {
  .xz-image-dialog.xz-image-workspace { padding: 25px 18px; }
  .xz-image-workspace .xz-image-heading h2 { font-size: 23px; }
  .xz-image-workspace .xz-image-grid { gap: 22px; }
  .xz-image-workspace .xz-image-compose textarea { min-height: 170px; }
  .history-workspace .xz-image-history-list { grid-template-columns: 1fr; }
}

/* One creation shell, separate mode panels and drafts; no chat layout changes. */
.xz-image-dialog.xz-image-workspace.creation-workspace { display: flex; flex-direction: column; gap: 18px; padding: 22px 28px; overflow: hidden; }
.creation-page-heading { display: flex; justify-content: space-between; align-items: center; gap: 18px; flex-shrink: 0; }
.creation-page-heading h2 { margin: 3px 0 5px; font-size: 23px; line-height: 1.3; letter-spacing: -.025em; }
.creation-page-heading p:not(.overline) { margin: 0; color: var(--muted); font-size: 11px; }
.creation-studio { display: flex; flex-direction: column; flex: 1; min-height: 0; min-width: 0; width: 100%; max-width: 1100px; margin: 0 auto; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: var(--surface); }
.creation-studio-toolbar { display: flex; align-items: center; gap: 18px; min-height: 80px; padding: 14px 20px; border-bottom: 1px solid var(--line); flex-shrink: 0; background: var(--surface); }
.creation-select-field { min-width: 0; }
.creation-select-field label { display: block; margin: 0 0 4px; color: var(--muted); font-size: 9px; }
.creation-studio .creation-select-field select { display: block; max-width: 100%; min-width: 0; min-height: 34px; padding: 5px 28px 5px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-raised); color: var(--text); font: inherit; font-size: 12px; text-overflow: ellipsis; cursor: pointer; }
.creation-type-field { flex: 0 0 135px; }
.creation-type-field select { width: 100%; }
.creation-model-field { flex: 1; max-width: 340px; }
.creation-model-field select { width: 100%; }
.creation-studio .creation-model-field select:disabled { cursor: default; opacity: 1; color: var(--soft); }
.creation-studio .creation-type-field select { border-color: var(--violet); }
.creation-history-link { display: inline-flex; align-items: center; justify-content: center; gap: 7px; flex-shrink: 0; margin-left: auto; white-space: nowrap; }
.creation-history-link .icon { width: 15px; height: 15px; }
.creation-panel { display: flex; flex-direction: column; flex: 1; min-width: 0; min-height: 0; }
.creation-studio .xz-image-service { flex-shrink: 0; padding: 9px 20px; margin: 0; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; color: var(--muted); background: transparent; font-size: 10px; }
.creation-stream { flex: 1; min-height: 0; min-width: 0; padding: 22px 26px; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--muted) transparent; }
.creation-panel[data-has-job="false"] .creation-stream { display: flex; align-items: safe center; justify-content: center; }
.creation-request { max-width: 85%; width: fit-content; margin: 0 0 22px auto; }
.creation-message-caption { display: block; margin: 0 0 6px; text-align: right; color: var(--muted); font-size: 10px; }
.creation-request p { margin: 0; padding: 12px 16px; border: 1px solid var(--line); border-radius: 12px 3px 12px 12px; background: var(--surface-raised); color: var(--text); font-size: 13px; line-height: 1.8; white-space: pre-wrap; overflow-wrap: anywhere; }
.creation-response { max-width: 710px; margin: 0 auto; width: 100%; }
.creation-empty-mark { display: grid; place-items: center; width: 64px; height: 64px; margin: 0 auto 13px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface-raised); color: var(--violet); }
.creation-empty-mark .icon { width: 29px; height: 29px; }
.creation-panel[data-has-job="true"] .creation-empty-mark { display: none; }
.creation-studio .creation-stream .xz-image-preview { min-height: 90px; max-height: none; aspect-ratio: auto; padding: 16px; border-radius: 12px; background: var(--bg); color: var(--muted); font-size: 13px; }
.creation-studio .creation-panel[data-has-job="false"] .xz-image-preview { padding: 0; border: 0; background: transparent; font-size: 22px; color: var(--text); line-height: 1.6; }
.creation-studio .xz-image-preview p { margin: 5px 0; white-space: pre-line; }
.creation-studio .xz-image-preview img { display: block; width: auto; height: auto; max-width: 100%; max-height: 420px; object-fit: contain; border-radius: 8px; }
.creation-studio .xz-image-result-status { margin: 10px 0 0; line-height: 1.8; }
.creation-studio .xz-image-result-status:empty { display: none; }
.creation-result-actions { margin-top: 10px; }
.creation-result-actions:has(> [hidden]):not(:has(> :not([hidden]))) { display: none; }
.creation-composer-zone { flex-shrink: 0; padding: 14px 20px 11px; border-top: 1px solid var(--line); background: var(--surface); }
.creation-composer-box { min-width: 0; padding: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-raised); }
.creation-composer-box:focus-within { border-color: var(--violet); }
.creation-studio .creation-composer-box textarea { display: block; resize: vertical; width: 100%; min-height: 78px; max-height: 150px; margin: 0; padding: 14px 15px 8px; border: 0; border-radius: 12px 12px 0 0; background: transparent; color: var(--text); font: inherit; font-size: 13px; line-height: 1.7; }
.creation-studio .creation-composer-box textarea:focus-visible { outline: none; }
.creation-composer-box textarea::placeholder { color: var(--muted); }
.creation-composer-box textarea:disabled { opacity: .65; }
.creation-composer-box .xz-image-consent { margin: 4px 14px 10px!important; font-size: 10px!important; line-height: 1.7; }
.creation-composer-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 12px 12px; min-height: 44px; }
.creation-capability { color: var(--muted); font-size: 9px; white-space: nowrap; }
.creation-composer-actions { display: flex; justify-content: flex-end; align-items: center; flex-wrap: wrap; gap: 12px; }
.creation-composer-actions .xz-image-primary { min-height: 34px; padding: 7px 14px; }
.creation-composer-actions .xz-image-text { white-space: nowrap; font-size: 10px; }
.creation-composer-zone .xz-image-feedback { min-height: 0; margin: 7px 0 0; font-size: 10px; }
.creation-composer-zone .xz-image-feedback:empty { display: none; }
.creation-composer-zone .xz-image-fine { margin: 5px 0 0; font-size: 9px; }
.creation-placeholder-stream { display: flex; align-items: safe center; justify-content: center; }
.creation-video-stream .creation-mode-welcome { margin: clamp(30px, 10vh, 100px) auto; }
.creation-video-stream .creation-chat-messages { width: 100%; min-width: 0; }
.creation-video-result { display: block; width: min(600px, 100%); max-height: 400px; border: 1px solid var(--line); border-radius: 13px; background: #080a10; object-fit: contain; }
.creation-video-viewer .creation-viewer-stage video { display: block; width: 100%; max-height: 75vh; background: #080a10; }
.creation-video-history { margin: 28px 0 0; padding-top: 20px; border-top: 1px solid var(--line); }
.creation-video-history > h3 { margin: 0 0 22px; font-size: 15px; }
.creation-mode-welcome { max-width: 430px; padding: 18px 10px; text-align: center; }
.creation-kind-badge { color: var(--violet); font-size: 9px; letter-spacing: .17em; }
.creation-mode-welcome h3 { margin: 14px 0 13px; color: var(--text); font-size: 25px; font-weight: 600; letter-spacing: -.03em; }
.creation-mode-welcome p { color: var(--soft); font-size: 12px; line-height: 1.9; margin: 0 0 18px; }
.creation-unavailable { display: inline-flex; padding: 4px 10px; border: 1px solid var(--line); border-radius: 6px; color: var(--muted); font-size: 10px; }
@media (max-width: 1120px) { .xz-image-dialog.xz-image-workspace.creation-workspace { padding: 20px; } }
@media (max-width: 760px) {
  .xz-image-dialog.xz-image-workspace.creation-workspace { padding: 16px 12px; gap: 12px; }
  .creation-page-heading h2 { font-size: 20px; }
  .creation-page-heading p:not(.overline) { font-size: 10px; }
  .creation-page-heading .xz-image-quiet { padding: 7px 9px; font-size: 10px; }
  .creation-studio { border-radius: 12px; }
  .creation-studio-toolbar { padding: 11px 12px; gap: 10px; min-height: 72px; }
  .creation-type-field { flex-basis: 112px; }
  .creation-select-field label { font-size: 8px; }
  .creation-studio .creation-select-field select { font-size: 11px; min-height: 33px; padding-left: 8px; padding-right: 22px; }
  .creation-history-link { padding: 7px!important; align-self: flex-end; }
  .creation-history-link span { display: none; }
  .creation-studio .xz-image-service { padding: 8px 12px; font-size: 9px; }
  .creation-stream { padding: 20px 14px; }
  .creation-request { max-width: 94%; }
  .creation-request p { padding: 10px 12px; font-size: 12px; }
  .creation-studio .creation-panel[data-has-job="false"] .xz-image-preview { font-size: 18px; }
  .creation-empty-mark { width: 52px; height: 52px; border-radius: 16px; margin-bottom: 12px; }
  .creation-empty-mark .icon { width: 25px; height: 25px; }
  .creation-composer-zone { padding: 11px 10px 9px; }
  .creation-studio .creation-composer-box textarea { min-height: 75px; max-height: 130px; font-size: 12px; padding: 12px 12px 7px; }
  .creation-composer-box .xz-image-consent { margin-inline: 11px!important; font-size: 9px!important; }
  .creation-composer-toolbar { padding-inline: 10px; gap: 8px; }
  .creation-capability { font-size: 8px; }
  .creation-composer-actions { gap: 9px; }
  .creation-composer-actions .xz-image-primary { min-height: 34px; padding: 7px 10px; font-size: 10px; }
  .creation-composer-actions .xz-image-text { font-size: 9px; }
  .creation-composer-zone .xz-image-fine { font-size: 8px; }
  .creation-mode-welcome h3 { font-size: 22px; }
  .creation-mode-welcome p { font-size: 11px; }
}
@media (max-width: 380px) {
  .creation-studio-toolbar { gap: 7px; padding-inline: 10px; }
  .creation-type-field { flex-basis: 100px; }
  .creation-history-link { padding: 6px!important; }
  .creation-composer-toolbar { flex-wrap: wrap; }
  .creation-composer-actions { margin-left: auto; }
}
@media (max-height: 800px) and (min-width: 761px) {
  .creation-placeholder-stream { padding-block: 6px; }
  .creation-panel[data-has-job="false"] .creation-empty-mark { display: none; }
  .creation-panel[data-has-job="false"] .creation-stream { padding-block: 10px; }
  .creation-studio .creation-panel[data-has-job="false"] .xz-image-preview { min-height: 0; font-size: 18px; }
  .creation-mode-welcome { padding-block: 2px; }
  .creation-mode-welcome h3 { margin: 8px 0; font-size: 21px; }
  .creation-mode-welcome p { margin-bottom: 8px; font-size: 11px; line-height: 1.7; }
}

/* Creation type navigation lives under AI creation, not above the canvas. */
.creation-subnav { display: grid; gap: 2px; margin: -3px 10px 5px 23px; padding: 3px 0 3px 17px; border-left: 1px solid var(--line); }
.creation-subnav-item { position: relative; width: 100%; min-height: 29px; padding: 4px 10px; border: 1px solid transparent; border-radius: 7px; background: transparent; color: var(--muted); text-align: left; font: inherit; font-size: 11px; cursor: pointer; }
.creation-subnav-item:hover { color: var(--text); background: var(--surface-raised); }
.creation-subnav-item.is-active { color: var(--violet); background: var(--surface-raised); }
.workspace-nav-item:not(.is-active) + .creation-subnav .creation-subnav-item.is-active { color: var(--soft); background: transparent; }
.sidebar:has(.creation-subnav) { overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.sidebar:has(.creation-subnav) .workspace-nav { flex-shrink: 0; margin-bottom: 15px; gap: 5px; }
.creation-workspace .creation-chat-toolbar { gap: 10px; min-height: 66px; padding-block: 10px; }
.creation-chat-toolbar .creation-model-field { margin-right: auto; }
.creation-chat-toolbar .creation-history-link { margin-left: 0; }
.creation-chat-toolbar > button { flex-shrink: 0; white-space: nowrap; font-size: 10px; padding: 8px 10px; }
.creation-chat-toolbar .creation-model-field select { min-height: 32px; }
.creation-legacy-result, .creation-message-list { width: 100%; min-width: 0; }
.creation-message-list { max-width: 820px; margin: 0 auto; }
.creation-chat-turn { margin: 0 0 30px; min-width: 0; }
.creation-chat-user { width: fit-content; max-width: 86%; margin: 0 0 18px auto; padding: 12px 16px; border: 1px solid var(--line); border-radius: 14px 4px 14px 14px; background: var(--surface-raised); color: var(--text); font-size: 13px; line-height: 1.8; white-space: pre-wrap; overflow-wrap: anywhere; }
.creation-chat-user p { margin: 0; }
.creation-chat-assistant { min-width: 0; width: fit-content; max-width: 100%; padding: 2px 0; color: var(--soft); font-size: 12px; line-height: 1.8; overflow-wrap: anywhere; }
.creation-chat-assistant p { margin: 7px 0; white-space: pre-wrap; }
.creation-chat-meta { margin: 7px 0; color: var(--muted); font-size: 10px; line-height: 1.8; }
.creation-chat-image { display: block; width: auto; height: auto; max-width: 100%; max-height: 480px; border: 1px solid var(--line); border-radius: 12px; object-fit: contain; }
.creation-chat-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 9px; }
.creation-chat-actions a, .creation-chat-actions button { font-size: 10px; }
.creation-chat-empty { margin: auto; padding: 24px 12px; text-align: center; color: var(--muted); }
.creation-chat-empty h3 { color: var(--text); font-size: 24px; font-weight: 600; }
.creation-chat-empty p { font-size: 12px; line-height: 1.8; }
.creation-workspace[data-thread-ready="true"] .creation-panel .creation-stream { display: block; }
.creation-workspace[data-thread-ready="true"] .creation-panel[data-has-job="false"] .creation-stream { display: flex; }

/* Administrator reads the same saved conversation records, with no model POST. */
.creation-admin-history { grid-column: 1 / -1; margin-top: 24px; min-width: 0; }
.creation-admin-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 16px 0; }
.creation-admin-item { display: block; min-width: 0; width: 100%; padding: 13px 15px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text); text-align: left; cursor: pointer; font: inherit; font-size: 12px; }
.creation-admin-item:hover, .creation-admin-item.is-selected { border-color: var(--violet); }
.creation-admin-item strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.creation-admin-item small { display: block; margin-top: 5px; color: var(--muted); font-size: 10px; overflow-wrap: anywhere; }
.creation-admin-history .creation-admin-toolbar, .creation-admin-history .creation-admin-pagination { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.creation-admin-pagination { margin: 12px 0; color: var(--muted); font-size: 11px; }
.creation-admin-thread { max-height: 660px; padding: 18px; border: 1px solid var(--line); border-radius: 12px; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; background: var(--bg); }
.creation-admin-message { max-width: 88%; margin: 0 0 18px; color: var(--soft); font-size: 12px; line-height: 1.8; overflow-wrap: anywhere; }
.creation-admin-message p { white-space: pre-wrap; margin: 6px 0; }
.creation-admin-message.is-user { width: fit-content; margin-left: auto; padding: 11px 15px; border: 1px solid var(--line); border-radius: 12px 4px 12px 12px; background: var(--surface-raised); color: var(--text); }
.creation-admin-message small { display: block; color: var(--muted); font-size: 10px; }
.creation-admin-image { display: block; width: auto; height: auto; max-width: 100%; max-height: 400px; border-radius: 9px; object-fit: contain; }
@media (max-width: 760px) {
  .creation-workspace .creation-chat-toolbar { padding: 10px; gap: 8px; min-height: 60px; }
  .creation-chat-toolbar .creation-model-field { max-width: none; }
  .creation-chat-toolbar > button { font-size: 9px; padding: 7px 8px; }
  .creation-chat-toolbar .creation-return-chat { display: none; }
  .creation-chat-user { max-width: 94%; padding: 10px 12px; font-size: 12px; }
  .creation-chat-image { max-height: 380px; }
  .creation-chat-empty h3 { font-size: 21px; }
  .creation-admin-list { grid-template-columns: 1fr; }
  .creation-admin-thread { padding: 12px; max-height: 520px; }
  .creation-admin-message { max-width: 96%; }
}
@media (max-height: 800px) {
  .sidebar:has(.creation-subnav) { padding-top: 24px; padding-bottom: 14px; }
  .sidebar:has(.creation-subnav) .brand { flex-shrink: 0; }
  .sidebar:has(.creation-subnav) .brand small { white-space: nowrap; font-size: 7px; letter-spacing: .1em; }
  .sidebar:has(.creation-subnav) .workspace-label { margin-top: 22px; margin-bottom: 8px; }
  .sidebar:has(.creation-subnav) .workspace-nav { gap: 3px; margin-bottom: 10px; }
  .sidebar:has(.creation-subnav) .workspace-nav-item { min-height: 40px; padding-block: 7px; }
  .sidebar:has(.creation-subnav) .creation-subnav-item { min-height: 26px; padding-block: 2px; }
  .sidebar:has(.creation-subnav) .sidebar-bottom { padding-top: 12px; }
  .sidebar:has(.creation-subnav) .local-card { display: none; }
}

/* Result actions stay attached to each conversation turn, including archives. */
.creation-chat-model { color: var(--muted); font-size: 10px; line-height: 1.8; overflow-wrap: anywhere; }
.creation-chat-image { cursor: zoom-in; }
.creation-generation-state { display: flex; align-items: center; gap: 12px; min-height: 96px; max-width: 430px; margin: 8px 0 12px; padding: 18px 22px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-raised); color: var(--soft); font-size: 12px; line-height: 1.8; }
.creation-generation-state.is-pending { color: var(--violet); }
.creation-generation-state.is-pending::before { content: ""; flex: 0 0 auto; width: 20px; height: 20px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: creation-generation-spin 1s linear infinite; }
@keyframes creation-generation-spin { to { transform: rotate(360deg); } }
.creation-history-detail { margin: 26px 0 0; padding: 24px 0 0; border-top: 1px solid var(--line); min-width: 0; }
.creation-history-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.creation-history-heading h3 { margin: 5px 0 8px; color: var(--text); font-size: 19px; font-weight: 600; overflow-wrap: anywhere; }
.creation-history-heading .xz-image-copy { margin: 0; font-size: 10px; }
.creation-history-heading > button { flex-shrink: 0; }
.creation-history-messages { width: 100%; max-width: 900px; margin: 0 auto; min-width: 0; overflow-anchor: none; }
.creation-history-messages .creation-chat-image { max-height: 380px; }
.creation-history-messages .creation-chat-turn { padding-bottom: 22px; margin-bottom: 24px; border-bottom: 1px solid var(--line); }
.creation-image-viewer, .creation-regenerate-dialog { color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 20px 70px rgba(0,0,0,.3); }
.creation-image-viewer::backdrop, .creation-regenerate-dialog::backdrop { background: rgba(5,7,13,.78); }
.creation-image-viewer { width: min(1050px, calc(100vw - 36px)); max-width: none; max-height: calc(100dvh - 36px); padding: 20px; overflow: auto; overscroll-behavior: contain; }
.creation-viewer-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.creation-viewer-heading h2 { min-width: 0; margin: 0; color: var(--text); font-size: 18px; overflow-wrap: anywhere; }
.creation-viewer-heading > button { flex-shrink: 0; }
.creation-image-viewer.is-local-reference .creation-viewer-meta:empty { display: none; }
.creation-viewer-stage { display: grid; place-items: center; min-height: 100px; max-height: calc(100dvh - 225px); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; overflow: auto; }
.creation-viewer-stage img { display: block; max-width: 100%; max-height: calc(100dvh - 225px); width: auto; height: auto; object-fit: contain; }
.creation-viewer-meta { color: var(--muted); font-size: 11px; line-height: 1.8; white-space: pre-wrap; overflow-wrap: anywhere; margin: 12px 0; max-height: 84px; overflow: auto; }
.creation-image-viewer #creation-image-viewer-download { display: inline-block; }
.creation-regenerate-dialog { width: min(510px, calc(100vw - 32px)); max-width: none; max-height: calc(100dvh - 32px); padding: 26px; overflow: auto; }
.creation-regenerate-dialog h2 { margin: 8px 0 12px; color: var(--text); font-size: 22px; }
.creation-regenerate-dialog #creation-regenerate-description { color: var(--soft); font-size: 12px; line-height: 1.9; }
.creation-regenerate-summary { display: grid; grid-template-columns: 100px minmax(0, 1fr); gap: 8px 14px; margin: 18px 0; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-raised); font-size: 11px; }
.creation-regenerate-summary span { color: var(--muted); }
.creation-regenerate-summary strong { font-weight: 500; overflow-wrap: anywhere; }
.creation-regenerate-prompt { padding: 12px 14px; max-height: 150px; overflow: auto; border: 1px solid var(--line); border-radius: 9px; background: var(--bg); color: var(--soft); font-size: 12px; line-height: 1.8; white-space: pre-wrap; overflow-wrap: anywhere; }
.creation-regenerate-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 12px; margin-top: 22px; }
@media (max-width: 760px) {
  .creation-history-heading h3 { font-size: 16px; }
  .creation-history-heading { gap: 12px; }
  .creation-history-heading > button { font-size: 10px; padding: 7px 9px; }
  .creation-generation-state { padding: 14px 16px; min-height: 80px; font-size: 11px; }
  .creation-image-viewer { width: calc(100vw - 20px); max-height: calc(100dvh - 20px); padding: 14px; }
  .creation-regenerate-dialog { width: calc(100vw - 20px); padding: 20px; }
  .creation-regenerate-summary { grid-template-columns: 85px minmax(0, 1fr); font-size: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .creation-generation-state.is-pending::before { animation: none; }
}

/* A larger creation viewport, scoped to the visible creation page only.
   Keep the original header controls and accessible page heading; remove its
   tall visual title block without moving nodes or rebuilding a conversation. */
.workspace:has(> .creation-workspace:not([hidden])) > .topbar { min-height: 44px; padding: 5px 16px; gap: 10px; }
.workspace:has(> .creation-workspace:not([hidden])) > .topbar .topbar-title > div { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.workspace:has(> .creation-workspace:not([hidden])) > .topbar .topbar-actions { margin-left: auto; }
.workbench:has(> .workspace > .creation-workspace:not([hidden])) { min-height: 0; }
.xz-image-dialog.xz-image-workspace.creation-workspace { padding: 10px 12px 12px; gap: 0; }
.creation-workspace .creation-studio { max-width: none; }
.creation-workspace .creation-chat-toolbar { min-height: 58px; padding: 8px 16px; }
.creation-workspace .creation-studio .xz-image-service { padding: 6px 16px; }
.creation-workspace .creation-stream { padding: 20px clamp(16px, 3vw, 40px); }
.creation-workspace .creation-message-list { max-width: 1100px; }
.creation-workspace .creation-composer-zone { padding: 9px 14px 8px; }
.creation-workspace .creation-studio .creation-composer-box textarea { height: 68px; min-height: 68px; max-height: 140px; padding: 10px 14px 6px; }
.creation-workspace .creation-composer-box .xz-image-consent { margin: 2px 12px 7px!important; }
.creation-workspace .creation-composer-toolbar { padding: 0 12px 8px; min-height: 40px; }
.creation-workspace .creation-chat-image { max-width: min(100%, 480px); max-height: clamp(220px, 40dvh, 360px); object-fit: contain; }
@media (max-width: 760px) {
  .workspace:has(> .creation-workspace:not([hidden])) > .topbar { min-height: 44px; padding: 5px 12px; }
  .xz-image-dialog.xz-image-workspace.creation-workspace { padding: 6px 8px 8px; }
  .creation-workspace .creation-chat-toolbar { min-height: 58px; padding: 8px 10px; }
  .creation-workspace .creation-studio .xz-image-service { padding: 6px 10px; }
  .creation-workspace .creation-stream { padding: 16px 12px; }
  .creation-workspace .creation-composer-zone { padding: 8px; }
  .creation-workspace .creation-studio .creation-composer-box textarea { height: 64px; min-height: 64px; max-height: 130px; padding: 9px 11px 5px; font-size: 13px; }
  .creation-workspace .creation-composer-box .xz-image-consent { margin-inline: 10px!important; font-size: 10px!important; }
  .creation-workspace .creation-composer-toolbar { padding-inline: 10px; }
  .creation-workspace .creation-chat-image { max-width: min(100%, 360px); max-height: 280px; }
}

/* A compact creation disclosure keeps the sidebar quiet until it is requested. */
.creation-subnav[hidden] { display: none; }
.creation-subnav:not([hidden]) { overflow: hidden; animation: creation-subnav-reveal 180ms ease-out; }
.creation-nav-caret { width: 6px; height: 6px; margin-left: auto; margin-right: 4px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); transition: transform 160ms ease; }
#workspace-nav-creation[aria-expanded="true"] .creation-nav-caret { transform: rotate(45deg); }
@keyframes creation-subnav-reveal { from { max-height: 0; opacity: 0; transform: translateY(-5px); } to { max-height: 130px; opacity: 1; transform: translateY(0); } }

/* Individual creations, rather than conversation tiles, form the archive. */
.creation-history-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin: 22px 0 16px; }
.creation-history-count { display: grid; gap: 6px; flex: 0 0 auto; }
.creation-history-count strong { color: var(--text); font-size: 17px; font-weight: 600; }
.creation-history-count span { color: var(--muted); font-size: 11px; }
.creation-history-filters { display: flex; justify-content: flex-end; align-items: center; gap: 10px; min-width: 0; }
.creation-history-filters input, .creation-history-filters select { min-height: 37px; min-width: 0; padding: 8px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-raised); color: var(--text); font: inherit; font-size: 11px; }
.creation-history-filters input { width: clamp(150px, 18vw, 270px); }
.creation-history-filters input::placeholder { color: var(--muted); }
.creation-history-filters select { max-width: 135px; }
.creation-history-filters :focus-visible { outline: 2px solid var(--violet); outline-offset: 2px; }
.creation-history-table { min-width: 0; border: 1px solid var(--line); border-radius: 13px; overflow: hidden; background: var(--surface); }
.creation-history-selection { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 49px; padding: 9px 17px; border-bottom: 1px solid var(--line); }
.creation-history-selection label { display: inline-flex; align-items: center; gap: 10px; color: var(--soft); font-size: 11px; cursor: pointer; }
.creation-history-selection input, .creation-history-row-select { width: 15px; height: 15px; accent-color: var(--violet); flex-shrink: 0; cursor: pointer; }
.creation-history-selection .is-danger { padding: 6px 10px; color: var(--danger); font-size: 10px; }
.history-workspace .xz-image-history-list.creation-history-records { display: block; margin: 0; }
.creation-history-records > .xz-image-copy { padding: 22px; text-align: center; }
.creation-history-row { display: flex; align-items: flex-start; gap: 14px; min-width: 0; min-height: 112px; padding: 19px 17px; border-bottom: 1px solid var(--line); }
.creation-history-row:last-child { border-bottom: 0; }
.creation-history-row:hover { background: var(--surface-raised); }
.creation-history-row-select { margin: 14px 0 0; }
.creation-history-kind { display: grid; place-items: center; flex: 0 0 39px; height: 39px; border: 1px solid var(--line); border-radius: 10px; background: color-mix(in srgb, var(--violet) 12%, var(--surface)); color: var(--violet); font-size: 12px; }
.creation-history-kind .icon { width: 19px; height: 19px; }
.creation-history-row-content { flex: 1; min-width: 0; }
.creation-history-row-top { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 0 0 6px; min-height: 23px; }
.creation-history-row-model { display: inline-block; max-width: 100%; padding: 2px 7px; border: 1px solid var(--line); border-radius: 5px; color: var(--soft); background: var(--surface-raised); font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.creation-history-row-status { color: var(--muted); font-size: 10px; white-space: nowrap; }
.creation-history-row-status[data-status="succeeded"] { color: var(--success, #63b8a5); }
.creation-history-row-status[data-status="failed"] { color: var(--danger); }
.creation-history-row-status[data-status="unknown"] { color: var(--warning, #cfab6a); }
.creation-history-row-status[data-status="running"], .creation-history-row-status[data-status="queued"] { color: var(--violet); }
.creation-history-row-prompt { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; color: var(--text); font-size: 12px; line-height: 1.8; margin: 0 0 8px; white-space: pre-wrap; }
.creation-history-row-date { display: block; color: var(--muted); font-size: 10px; line-height: 1.8; margin: 0; }
.creation-history-row-error { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--danger); font-size: 10px; line-height: 1.8; margin: 5px 0; overflow-wrap: anywhere; }
.creation-history-thumb { display: block; flex: 0 0 62px; width: 62px; height: 62px; object-fit: cover; border: 1px solid var(--line); border-radius: 9px; background: var(--bg); cursor: zoom-in; }
.creation-history-row-actions { display: flex; align-items: center; flex-wrap: wrap; flex: 0 0 auto; gap: 7px; margin-top: 9px; }
.creation-history-row-actions .xz-image-quiet { padding: 5px 7px; min-height: 30px; font-size: 10px; }
.creation-history-row-actions .is-danger { color: var(--danger); }
.creation-history-pagination { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-top: 16px; font-size: 10px; color: var(--muted); }
.creation-history-pagination > div { display: flex; gap: 8px; }
.creation-history-pagination button { padding: 7px 10px; font-size: 10px; }
.creation-history-note { margin: 14px 0 0; color: var(--muted); font-size: 10px; line-height: 1.8; }
.creation-history-hide-dialog #image-history-hide-summary { color: var(--soft); font-size: 13px; line-height: 1.9; }
.creation-history-hide-dialog #image-history-hide-confirm { background: var(--danger); border-color: var(--danger); color: var(--bg); }
@media (max-width: 1100px) {
  .creation-history-toolbar { align-items: flex-start; flex-direction: column; gap: 14px; }
  .creation-history-filters { width: 100%; justify-content: flex-start; }
  .creation-history-filters input { flex: 1; width: auto; }
  .creation-history-row { flex-wrap: wrap; }
  .creation-history-row-content { flex-basis: calc(100% - 95px); }
  .creation-history-thumb { margin-left: 70px; }
  .creation-history-row-actions { margin-top: 0; margin-left: auto; align-self: center; }
}
@media (max-width: 760px) {
  .creation-history-count strong { font-size: 15px; }
  .creation-history-filters { flex-wrap: wrap; gap: 8px; }
  .creation-history-filters input { flex-basis: 100%; width: 100%; }
  .creation-history-filters select { flex: 1; max-width: none; }
  .creation-history-selection { padding-inline: 12px; }
  .creation-history-row { padding: 16px 12px; gap: 10px; }
  .creation-history-kind { flex-basis: 32px; height: 32px; border-radius: 8px; }
  .creation-history-row-content { flex-basis: calc(100% - 72px); }
  .creation-history-row-select { margin-top: 9px; }
  .creation-history-thumb { margin-left: 57px; width: 58px; height: 58px; flex-basis: 58px; }
  .creation-history-row-actions { gap: 6px; }
  .creation-history-row-prompt { font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) {
  .creation-subnav:not([hidden]) { animation: none; }
  .creation-nav-caret { transition: none; }
}

/* Compact composer chips; the native top-layer popover never clips the chat. */
.creation-workspace .creation-composer-toolbar { flex-wrap: wrap; row-gap: 7px; }
.creation-parameter-bar { display: flex; align-items: center; gap: 3px; min-width: 0; flex-wrap: wrap; }
.creation-parameter-chip { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 32px; max-width: 100%; padding: 5px 8px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--soft); font: inherit; font-size: 11px; white-space: nowrap; cursor: pointer; }
.creation-parameter-chip svg { width: 16px; height: 16px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.creation-parameter-chip:hover:not(:disabled) { border-color: var(--line); background: var(--surface); color: var(--text); }
.creation-parameter-chip:disabled { opacity: .5; cursor: not-allowed; }
.creation-parameter-chevron { color: var(--muted); font-size: 12px; }
.creation-parameters-popover { position: fixed; inset: auto; width: min(360px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); margin: 0; padding: 18px; overflow: auto; overscroll-behavior: contain; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--text); box-shadow: 0 12px 48px rgba(0,0,0,.28); }
.creation-parameters-popover:not(:popover-open) { display: none; }
.creation-parameters-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; }
.creation-parameters-heading h2 { margin: 3px 0 0; color: var(--text); font-size: 16px; font-weight: 600; }
.creation-parameters-heading .overline { font-size: 7px; }
.creation-parameters-close { display: grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--muted); font: inherit; font-size: 22px; cursor: pointer; }
.creation-parameters-close:hover { border-color: var(--line); color: var(--text); }
.creation-parameters-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 12px; }
.creation-parameters-grid label { display: flex; flex-direction: column; min-width: 0; gap: 6px; color: var(--muted); font-size: 11px; }
.creation-parameters-grid select { display: block; width: 100%; min-width: 0; min-height: 38px; padding: 7px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-raised); color: var(--text); font: inherit; font-size: 12px; cursor: pointer; }
.creation-parameters-grid select:disabled { cursor: not-allowed; opacity: .55; }
.creation-parameters-grid select:focus-visible { outline: 2px solid var(--violet); outline-offset: 2px; }
.creation-parameters-note { margin: 15px 0 0; color: var(--muted); font-size: 10px; line-height: 1.9; overflow-wrap: anywhere; }
.creation-parameters-note.is-error { color: var(--danger); }
.creation-workspace #image-batch-stop { color: var(--danger); }
@media (max-width: 760px) {
  .creation-parameter-chip { padding: 5px 6px; min-height: 34px; font-size: 10px; gap: 5px; }
  .creation-parameter-bar { gap: 1px; }
  .creation-parameters-popover { padding: 16px; border-radius: 13px; }
  .creation-workspace .creation-composer-actions { margin-left: auto; }
}

/* Focused creative workspace: utilities belong to AI chat, not every page.
   The small-screen header retains only the essential sidebar navigation. */
.workspace:has(> #chat-workspace[hidden]) > .topbar { display: none; }
.workspace:has(> #chat-workspace[hidden]) > .topbar .topbar-actions { display: none; }
.workbench:has(> .workspace > #chat-workspace[hidden]) { min-height: 0; }
.xz-image-dialog.xz-image-workspace.creation-workspace { padding: 0; }
.creation-workspace .creation-studio { border: 0; border-radius: 0; }
.creation-workspace .creation-chat-toolbar { min-height: 54px; padding: 8px 30px; }
.creation-workspace .creation-composer-zone { width: 100%; max-width: 850px; margin: 0 auto; padding: 0 30px 20px; border-top: 0; background: transparent; }
.creation-workspace .creation-composer-box { border-radius: 16px; }
.creation-workspace .creation-studio .creation-composer-box textarea { height: auto; min-height: 70px; max-height: 170px; resize: none; padding: 20px 19px 10px; font-size: 13px; line-height: 1.7; }
.creation-workspace .creation-composer-toolbar { padding: 0 12px 12px; min-height: 48px; }
.creation-workspace .creation-composer-actions .xz-image-primary { min-height: 36px; }
.creation-workspace .creation-composer-consent { margin: 7px 0 0!important; font-size: 10px!important; line-height: 1.7; }
.creation-workspace .creation-composer-zone .xz-image-fine { margin-top: 5px; }
@media (max-width: 1320px) {
  .creation-workspace .creation-composer-zone, .creation-workspace .creation-chat-toolbar { padding-inline: 24px; }
}
@media (max-width: 1120px) {
  .creation-workspace .creation-composer-zone, .creation-workspace .creation-chat-toolbar { padding-inline: 28px; }
}
@media (max-width: 760px) {
  .workspace:has(> #chat-workspace[hidden]) > .topbar { display: flex; min-height: 40px; padding: 3px 12px; border-bottom: 0; }
  .workspace:has(> #chat-workspace[hidden]) > .topbar .topbar-title > div { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .creation-workspace .creation-chat-toolbar { min-height: 50px; padding: 6px 16px; }
  .creation-workspace .creation-composer-zone { padding: 0 16px 14px; }
  .creation-workspace .creation-studio .creation-composer-box textarea { min-height: 66px; padding: 16px 14px 9px; font-size: 12px; }
  .creation-workspace .creation-composer-toolbar { min-height: 44px; padding: 0 11px 10px; gap: 6px; }
  .creation-workspace .creation-composer-actions { gap: 6px; }
  .creation-workspace .creation-composer-actions .xz-image-primary { min-height: 34px; padding-inline: 8px; }
}
@media (max-width: 380px) {
  .creation-workspace .creation-composer-zone, .creation-workspace .creation-chat-toolbar { padding-inline: 12px; }
  .creation-workspace .creation-studio .creation-composer-box textarea { font-size: 11px; }
  .creation-workspace #image-format-toggle, .creation-workspace #video-format-toggle,
  .creation-workspace #image-count-toggle svg, .creation-workspace #video-count-toggle svg { display: none; }
  .creation-workspace #image-parameters-summary, .creation-workspace #video-parameters-summary { max-width: 84px; overflow: hidden; text-overflow: ellipsis; }
}

/* Materials stay compact inside the composer; previews never widen the chat. */
.creation-workspace .creation-composer-box { display: grid; grid-template-columns: auto minmax(0, 1fr); }
.creation-composer-box > textarea, .creation-composer-box > .creation-material-list,
.creation-composer-box > .creation-material-feedback { grid-column: 1 / -1; }
.creation-workspace .creation-composer-box > .creation-composer-toolbar { grid-column: 2; min-width: 0; padding-left: 5px; }
.creation-material-add { display: inline-flex; align-items: center; justify-content: center; gap: 6px; align-self: start; min-height: 32px; margin: 2px 0 12px 12px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 8px; background: transparent; color: var(--soft); font: inherit; font-size: 11px; white-space: nowrap; cursor: pointer; }
.creation-material-add .icon { width: 16px; height: 16px; }
.creation-material-add:hover:not(:disabled) { border-color: var(--violet); background: var(--surface); color: var(--violet); }
.creation-material-add:disabled { opacity: .5; cursor: not-allowed; }
.creation-material-add:focus-visible, .creation-material-remove:focus-visible { outline: 2px solid var(--violet); outline-offset: 2px; }
.creation-material-list:not([hidden]) { display: flex; gap: 10px; max-width: 100%; min-width: 0; margin: 13px 14px 0; padding: 3px 3px 7px; overflow-x: auto; overscroll-behavior-x: contain; }
.creation-material-card { position: relative; display: flex; flex-direction: column; flex: 0 0 94px; min-width: 0; max-width: 100%; gap: 3px; padding: 5px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.creation-material-preview { display: block; width: 82px; height: 62px; object-fit: cover; border-radius: 6px; background: var(--bg); }
.creation-material-name { display: block; min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--soft); font-size: 10px; line-height: 1.7; }
.creation-material-meta { margin: 0; color: var(--muted); font-size: 9px; line-height: 1.6; }
.creation-material-remove { position: absolute; top: 1px; right: 1px; display: grid; place-items: center; width: 34px; height: 24px; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-raised); color: var(--text); font: inherit; font-size: 10px; white-space: nowrap; cursor: pointer; }
.creation-material-remove:hover { color: var(--danger); }
.creation-material-card:has(audio) { flex-basis: 310px; padding: 10px 12px; gap: 7px; }
.creation-material-card:has(audio) .creation-material-name { padding-right: 20px; }
.creation-material-audio { display: block; width: 100%; height: 34px; }
.creation-material-feedback { margin: 8px 17px 0; color: var(--muted); font-size: 10px; line-height: 1.6; overflow-wrap: anywhere; }
.creation-material-feedback.is-error { color: var(--danger); }
@media (max-width: 760px) {
  .creation-material-add { margin-left: 11px; margin-bottom: 10px; padding: 5px 6px; font-size: 10px; min-height: 34px; }
  .creation-material-list:not([hidden]) { margin: 10px 11px 0; gap: 8px; }
  .creation-material-card:has(audio) { flex-basis: min(310px, calc(100vw - 78px)); }
}
@media (max-width: 380px) {
  .creation-material-add { padding-inline: 6px; }
  .creation-material-add > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
}

/* Reference images: a clickable card beside the draft, with a file-only drop target. */
.creation-workspace .creation-reference-composer {
  position: relative;
  grid-template-columns: 92px minmax(0, 1fr);
  grid-template-areas: "add prompt" "feedback feedback" "toolbar toolbar";
  transition: border-color 140ms ease, box-shadow 140ms ease;
}
.creation-workspace .creation-reference-composer > textarea { grid-area: prompt; min-height: 112px; padding-left: 12px; border-radius: 0 16px 0 0; }
.creation-workspace .creation-reference-composer > .reference-deck { grid-area: add; }
.creation-workspace .creation-reference-composer > .creation-material-feedback { grid-area: feedback; margin: 0 17px 7px; }
.creation-workspace .creation-reference-composer > .creation-composer-toolbar { grid-area: toolbar; padding-left: 12px; }
.creation-reference-composer .creation-reference-add {
  position: relative; grid-area: add; display: flex; flex-direction: column; gap: 2px;
  width: 64px; height: 78px; min-height: 78px; margin: 17px 0 12px 18px; padding: 8px;
  border: 0; border-radius: 9px; background: transparent; color: var(--soft); isolation: isolate;
}
.creation-reference-add::before { content: ""; position: absolute; z-index: -1; inset: 2px; border: 1px dashed var(--line); border-radius: 8px; background: color-mix(in srgb, var(--soft) 8%, var(--surface-raised)); transform: rotate(-7deg); transition: transform 140ms ease, border-color 140ms ease, background 140ms ease; }
.creation-reference-add > span { position: relative; width: auto; height: auto; overflow: visible; clip-path: none; }
.creation-reference-add .creation-reference-plus { font-size: 28px; line-height: 1.2; font-weight: 300; }
.creation-reference-add .creation-reference-label { font-size: 10px; line-height: 1.5; }
.creation-reference-add:hover:not(:disabled) { border: 0; background: transparent; color: var(--violet); }
.creation-reference-add:hover:not(:disabled)::before { border-color: var(--violet); transform: rotate(-3deg); }
.creation-reference-composer.is-material-dragging { border-color: var(--violet); box-shadow: 0 0 0 3px color-mix(in srgb, var(--violet) 15%, transparent); }
.creation-reference-composer.is-material-dragging .creation-reference-add { color: var(--violet); }
.creation-reference-composer.is-material-dragging .creation-reference-add::before { border-color: var(--violet); background: color-mix(in srgb, var(--violet) 12%, var(--surface)); transform: rotate(0deg); }
@media (max-width: 760px) {
  .creation-workspace .creation-reference-composer { grid-template-columns: 76px minmax(0, 1fr); }
  .creation-workspace .creation-reference-composer > textarea { min-height: 100px; padding-left: 9px; }
  .creation-reference-composer .creation-reference-add { width: 54px; height: 68px; min-height: 68px; margin: 16px 0 10px 13px; }
  .creation-reference-add .creation-reference-plus { font-size: 25px; }
  .creation-reference-add .creation-reference-label { font-size: 9px; }
  .creation-workspace .creation-reference-composer > .creation-composer-toolbar { padding-left: 11px; }
}
@media (prefers-reduced-motion: reduce) {
  .creation-workspace .creation-reference-composer, .creation-reference-add::before { transition: none; }
}

/* Sent materials belong to their user message and remain visible in archives. */
.creation-chat-user:has(.creation-chat-references:not([hidden])) { max-width: min(86%, 720px); }
.creation-chat-references:not([hidden]) { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: flex-end; gap: 8px; max-width: 100%; margin: 0 0 10px; white-space: normal; }
.creation-chat-reference { position: relative; display: grid; place-items: center; flex: 0 0 112px; width: 112px; height: 112px; max-width: 100%; padding: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 11px; background: var(--bg); color: var(--muted); font: inherit; font-size: 10px; line-height: 1.6; text-decoration: none; cursor: zoom-in; }
.creation-chat-reference:hover { border-color: var(--violet); }
.creation-chat-reference:focus-visible { outline: 2px solid var(--violet); outline-offset: 3px; }
.creation-chat-reference-image { display: block; width: 100%; height: 100%; object-fit: contain; }
.creation-chat-reference-index { position: absolute; right: 4px; bottom: 4px; min-width: 18px; height: 18px; padding: 0 4px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface-raised); color: var(--soft); font-size: 9px; line-height: 16px; text-align: center; }
.creation-chat-reference-error { padding: 8px; color: var(--muted); font-size: 10px; line-height: 1.7; text-align: center; }
.creation-chat-reference-count { display: block; margin-top: 5px; color: var(--muted); font-size: 10px; line-height: 1.7; }
.creation-admin-references { margin-top: 8px; }
.creation-admin-message.is-user:has(.creation-admin-references:not([hidden])) { max-width: min(96%, 720px); }
@media (max-width: 760px) {
  .creation-chat-user:has(.creation-chat-references:not([hidden])) { max-width: 100%; }
  .creation-chat-reference { flex-basis: 88px; width: 88px; height: 88px; border-radius: 9px; }
  .creation-chat-references:not([hidden]) { gap: 7px; }
}

/* Workspace floating dock — shared by chat and creative drafts. */
:root {
  --dock-bg: rgba(22, 24, 42, .82);
  --dock-border: rgba(148, 163, 184, .2);
  --dock-hover: rgba(148, 163, 184, .1);
  --dock-accent: #a78bfa;
  --dock-ring: rgba(168, 85, 247, .12);
  --dock-send: #9333ea;
  --dock-send-hover: #7e22ce;
  --dock-shadow: 0 12px 30px -6px rgba(0, 0, 0, .18), 0 4px 12px -2px rgba(0, 0, 0, .1);
}
html[data-theme="light"] {
  --dock-bg: rgba(255, 255, 255, .8);
  --dock-border: rgba(226, 232, 240, .8);
  --dock-hover: #f1f5f9;
  --dock-accent: #c084fc;
  --dock-ring: rgba(243, 232, 255, .5);
  --dock-shadow: 0 12px 30px -6px rgba(0, 0, 0, .06), 0 4px 12px -2px rgba(0, 0, 0, .03);
}
html[data-theme="cyan"] {
  --dock-bg: rgba(20, 25, 31, .82);
  --dock-accent: #22d3ee;
  --dock-ring: rgba(34, 211, 238, .12);
  --dock-send: #0e7490;
  --dock-send-hover: #155e75;
}
.workbench .floating-dock:is(.composer, .creation-composer-box) {
  display: flex;
  flex-direction: column;
  position: relative;
  min-width: 0;
  min-height: 80px;
  border: 1px solid var(--dock-border);
  border-radius: 16px;
  background: var(--dock-bg);
  box-shadow: var(--dock-shadow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: border-color .2s, box-shadow .2s;
}
.workbench .floating-dock:is(.composer, .creation-composer-box):focus-within {
  border-color: var(--dock-accent);
  box-shadow: 0 0 0 4px var(--dock-ring), var(--dock-shadow);
}
.workbench .floating-dock:is(.composer, .creation-composer-box) > textarea {
  width: 100%;
  min-height: 36px;
  max-height: 170px;
  padding: 8px 18px 4px;
  border: 0;
  border-radius: 16px 16px 0 0;
  outline: 0;
  resize: none;
  color: var(--text);
  background: transparent;
  font: inherit;
  font-size: 14px;
  line-height: 24px;
  scrollbar-width: thin;
}
.workbench .floating-dock textarea::placeholder { color: var(--muted); }
.workbench .floating-dock > :is(.composer-toolbar, .creation-composer-toolbar) {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 42px;
  min-width: 0;
  padding: 0 12px 4px;
}
.workbench .floating-dock :is(.composer-controls, .creation-composer-actions, .creation-parameter-bar) {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.workbench .floating-dock .composer-controls { margin-left: auto; flex-wrap: nowrap; }
.workbench .floating-dock .dock-attach {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 32px;
  align-self: center;
  width: 32px;
  height: 32px;
  min-height: 32px;
  margin: 0;
  padding: 6px;
  border: 0;
  border-radius: 50%;
  transform: none;
  background: transparent;
  color: var(--soft);
  box-shadow: none;
  cursor: pointer;
  transition: color .15s, background .15s;
}
.workbench .floating-dock .dock-attach::before { content: none; }
.workbench .floating-dock .dock-attach .icon { width: 19px; height: 19px; }
.workbench .floating-dock .dock-attach:hover:not(:disabled) { color: var(--violet); background: var(--dock-hover); }
.workbench .floating-dock .dock-attach:disabled { opacity: .4; cursor: not-allowed; }
.workbench .floating-dock .dock-attach:focus-visible { outline: 2px solid var(--dock-accent); outline-offset: 2px; }
.floating-dock .chat-model-choice { flex: 0 1 180px; min-width: 90px; }
.floating-dock .chat-model-choice select {
  width: 180px;
  min-height: 32px;
  padding: 6px 24px 6px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--soft);
  background: transparent;
  font-size: 12px;
}
.floating-dock .chat-model-choice select:hover:not(:disabled) { border-color: var(--dock-border); background: var(--dock-hover); }
.floating-dock .voice-tooltip { position: relative; display: flex; flex: 0 0 32px; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 8px; cursor: default; }
.floating-dock .voice-button { display: grid; place-items: center; width: 32px; height: 32px; padding: 6px; opacity: .45; color: var(--soft); pointer-events: none; }
.voice-tooltip::after { content: attr(data-tooltip); position: absolute; bottom: calc(100% + 8px); right: -12px; z-index: 20; padding: 7px 10px; border-radius: 8px; background: var(--surface-raised); color: var(--text); box-shadow: var(--dock-shadow); font-size: 11px; white-space: nowrap; opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .15s; }
.voice-tooltip:hover::after, .voice-tooltip:focus-visible::after { visibility: visible; opacity: 1; }
.voice-tooltip:focus-visible { outline: 2px solid var(--dock-accent); outline-offset: 2px; }
.workbench .floating-dock :is(.send-button, .xz-image-primary) { border: 0; border-radius: 12px; background: var(--dock-send); color: #fff; box-shadow: none; transition: background .15s, opacity .15s; }
.workbench .floating-dock .send-button { display: grid; place-items: center; width: 38px; height: 38px; padding: 8px; }
.workbench .floating-dock :is(.send-button, .xz-image-primary):hover:not(:disabled) { background: var(--dock-send-hover); filter: none; transform: none; }
.workbench .floating-dock :is(.send-button, .xz-image-primary):disabled { opacity: .4; cursor: not-allowed; }
.workbench .floating-dock:is(.is-drag-over, .is-material-dragging) { border-color: var(--dock-accent); box-shadow: 0 0 0 4px var(--dock-ring), var(--dock-shadow); outline: none; }
html[data-theme="light"] .floating-dock .chat-model-choice select { color: #475569; border-color: transparent; background: transparent; }
html[data-theme="light"] .floating-dock .chat-model-choice select:hover:not(:disabled) { background: var(--dock-hover); border-color: var(--dock-border); }
html[data-theme="cyan"] .floating-dock .chat-model-choice select { color: var(--soft); border-color: transparent; background: transparent; }
@media (max-width: 760px) {
  .workbench .floating-dock:is(.composer, .creation-composer-box) > textarea { min-height: 36px; padding: 8px 14px 4px; font-size: 14px; }
  .workbench .floating-dock > :is(.composer-toolbar, .creation-composer-toolbar) { padding: 0 10px 4px; gap: 8px; }
  .floating-dock .chat-model-choice { flex-basis: 148px; }
  .floating-dock .chat-model-choice select { width: 148px; font-size: 11px; }
  .workbench .floating-dock .creation-composer-toolbar { flex-wrap: wrap; }
  .workbench .floating-dock .creation-composer-actions { margin-left: auto; }
}
@media (max-width: 380px) {
  .floating-dock .chat-model-choice { flex-basis: 112px; }
  .floating-dock .chat-model-choice select { width: 112px; }
  .workbench .floating-dock .composer-controls:has(.stop-button:not([hidden])) { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
  .workbench .floating-dock, .workbench .floating-dock .dock-attach, .voice-tooltip::after { transition: none; }
}

/* Restored reference cards retain their native stacked previews and drop targets. */
.workbench .floating-dock.reference-card-composer {
  display: grid;
  grid-template-columns: 94px minmax(0, 1fr);
  grid-template-areas: "add prompt" "feedback feedback" "toolbar toolbar";
}
.workbench .floating-dock.reference-card-composer > textarea {
  grid-area: prompt;
  min-width: 0;
  min-height: 108px;
  padding: 20px 18px 10px 8px;
  border-radius: 0 16px 0 0;
}
.workbench .floating-dock.reference-card-composer > .reference-deck { grid-area: add; }
.workbench .floating-dock.reference-card-composer > :is(.composer-toolbar, .creation-composer-toolbar) {
  grid-area: toolbar;
  min-width: 0;
}
@media (max-width: 760px) {
  .workbench .floating-dock.reference-card-composer { grid-template-columns: 82px minmax(0, 1fr); }
  .workbench .floating-dock.reference-card-composer > textarea { min-height: 100px; padding: 17px 13px 9px 6px; }
  .workbench .floating-dock.reference-card-composer > .reference-deck { width: 82px; height: 100px; }
  .workbench .floating-dock .composer-controls { flex-wrap: wrap; }
}
@media (max-width: 1120px), (hover: none) {
  .workbench .floating-dock.reference-card-composer:has(> .reference-deck.has-materials) {
    grid-template-areas: "add add" "prompt prompt" "feedback feedback" "toolbar toolbar";
  }
  .workbench .floating-dock.reference-card-composer > .reference-deck.has-materials { width: 100%; height: auto; }
}

/* One chronological archive for images, video and speech. Chat keeps its own layout. */
.unifiedhistory { --history-panel: color-mix(in srgb, var(--surface-raised) 72%, var(--surface)); min-width: 0; color: var(--text); }
.unifiedhistory [hidden], .unifiedhistory-legacy[hidden] { display: none !important; }
.unifiedhistory button, .unifiedhistory input, .unifiedhistory select { font: inherit; }
.unifiedhistory button, .unifiedhistory a { -webkit-tap-highlight-color: transparent; }
.unifiedhistory button { cursor: pointer; }
.unifiedhistory button:disabled, .unifiedhistory input:disabled { cursor: not-allowed; opacity: .42; }
.unifiedhistory :focus-visible { outline: 2px solid var(--violet); outline-offset: 3px; }
.unifiedhistory-icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }
.unifiedhistory-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin: 23px 0 25px; }
.unifiedhistory-heading { display: grid; gap: 7px; min-width: 100px; }
.unifiedhistory-heading strong { font-size: 18px; font-weight: 650; letter-spacing: -.02em; }
.unifiedhistory-heading > span { color: var(--muted); font-size: 11px; }
.unifiedhistory-tools { display: flex; align-items: center; justify-content: flex-end; gap: 10px; min-width: 0; }
.unifiedhistory-search { display: flex; align-items: center; gap: 10px; width: clamp(190px, 23vw, 310px); min-width: 0; height: 38px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--history-panel); color: var(--muted); }
.unifiedhistory-search .unifiedhistory-icon { width: 16px; height: 16px; }
.unifiedhistory-search input { width: 100%; min-width: 0; height: 100%; padding: 0; border: 0; outline: none; color: var(--text); background: transparent; font-size: 12px; }
.unifiedhistory-search:focus-within { border-color: var(--violet); box-shadow: 0 0 0 2px color-mix(in srgb, var(--violet) 10%, transparent); }
.unifiedhistory-search input:focus-visible { outline: 0; }
.unifiedhistory-search input::placeholder { color: var(--muted); }
.unifiedhistory-filter { position: relative; flex: 0 0 auto; }
.unifiedhistory-filter-toggle { display: flex; align-items: center; justify-content: center; gap: 7px; min-width: 94px; height: 38px; padding: 7px 11px; border: 1px solid var(--line); border-radius: 8px; color: var(--soft); background: var(--history-panel); font-size: 12px !important; }
.unifiedhistory-filter-toggle .unifiedhistory-icon { width: 16px; height: 16px; }
.unifiedhistory-filter-toggle .unifiedhistory-chevron { width: 13px; height: 13px; margin-left: 2px; transition: transform .15s ease; }
.unifiedhistory-filter-toggle[aria-expanded="true"] .unifiedhistory-chevron { transform: rotate(180deg); }
.unifiedhistory-filter-toggle:hover, .unifiedhistory-filter-toggle[aria-expanded="true"] { border-color: color-mix(in srgb, var(--violet) 45%, var(--line)); color: var(--text); }
.unifiedhistory-filter-toggle.is-filtered { border-color: color-mix(in srgb, var(--violet) 60%, var(--line)); color: var(--violet); }
.unifiedhistory-filters { position: absolute; top: calc(100% + 9px); right: 0; z-index: 18; width: 260px; padding: 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-raised); box-shadow: 0 12px 30px #0003; }
.unifiedhistory-filter-group { min-width: 0; margin: 0 0 14px; padding: 0; border: 0; }
.unifiedhistory-filter-group legend, .unifiedhistory-filter-model > span { display: block; margin: 0 0 8px; padding: 0; color: var(--muted); font-size: 11px; }
.unifiedhistory-filter-options { display: flex; flex-wrap: wrap; gap: 5px; }
.unifiedhistory-filter-options button { min-height: 26px; padding: 4px 8px; border: 1px solid transparent; border-radius: 5px; color: var(--soft); background: color-mix(in srgb, var(--line) 64%, var(--surface)); font-size: 11px; line-height: 1.3; }
.unifiedhistory-filter-options button:hover { border-color: var(--violet); }
.unifiedhistory-filter-options button[aria-pressed="true"] { color: var(--bg); background: var(--violet); }
.unifiedhistory-filter-model { display: block; }
.unifiedhistory-filter-model select { width: 100%; height: 34px; min-width: 0; padding: 6px 9px; border: 1px solid var(--line); border-radius: 6px; color: var(--text); background: var(--surface); font-size: 12px; }
.unifiedhistory-feedback { margin: 0 0 15px; padding: 10px 0; color: var(--danger); font-size: 12px; line-height: 1.6; }
.unifiedhistory-table { overflow: hidden; border: 1px solid var(--line); border-radius: 11px; background: var(--history-panel); }
.unifiedhistory-selection { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 46px; padding: 9px 17px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 72%, transparent); }
.unifiedhistory-selection > label { display: inline-flex; align-items: center; gap: 10px; color: var(--soft); font-size: 12px; cursor: pointer; }
.unifiedhistory input[type="checkbox"] { width: 15px; height: 15px; margin: 0; accent-color: var(--violet); flex: 0 0 auto; cursor: pointer; }
.unifiedhistory-delete-selected { padding: 4px 7px; border: 0; border-radius: 5px; color: var(--danger); background: transparent; font-size: 11px !important; }
.unifiedhistory-delete-selected:hover:not(:disabled) { background: color-mix(in srgb, var(--danger) 9%, transparent); }
.unifiedhistory-records { min-width: 0; }
.unifiedhistory-records > p { margin: 0; padding: 40px 20px; color: var(--muted); font-size: 12px; line-height: 1.7; text-align: center; }
.unifiedhistory-empty { display: grid; justify-items: center; gap: 12px; padding: 40px 20px; color: var(--muted); font-size: 12px; line-height: 1.7; text-align: center; }
.unifiedhistory-row { display: grid; grid-template-columns: 18px 40px minmax(0, 1fr) 68px 104px; align-items: start; column-gap: 14px; min-width: 0; min-height: 113px; padding: 18px 17px; border-bottom: 1px solid var(--line); transition: background .12s ease; }
.unifiedhistory-row:last-child { border-bottom: 0; }
.unifiedhistory-row:hover { background: color-mix(in srgb, var(--surface) 52%, transparent); }
.unifiedhistory-row.is-selected { background: color-mix(in srgb, var(--violet) 5%, var(--history-panel)); }
.unifiedhistory-select { display: flex; align-items: center; justify-content: flex-start; grid-column: 1; padding-top: 11px; }
.unifiedhistory-kind { --history-kind: var(--violet); display: grid; place-items: center; grid-column: 2; width: 40px; height: 40px; border-radius: 9px; color: var(--history-kind); background: color-mix(in srgb, var(--history-kind) 20%, transparent); }
.unifiedhistory-kind[data-kind="video"] { --history-kind: #cc64aa; }
.unifiedhistory-kind[data-kind="audio"] { --history-kind: var(--blue, #6faad9); }
.unifiedhistory-kind svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.unifiedhistory-content { grid-column: 3; min-width: 0; }
.unifiedhistory-row-top { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; min-height: 23px; margin: 0 0 3px; }
.unifiedhistory-model { display: inline-block; max-width: 100%; overflow: hidden; padding: 2px 7px; border-radius: 5px; background: color-mix(in srgb, var(--line) 65%, var(--surface)); color: var(--soft); font-size: 11px; line-height: 1.45; text-overflow: ellipsis; white-space: nowrap; }
.unifiedhistory-status { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 11px; white-space: nowrap; }
.unifiedhistory-status svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.unifiedhistory-status[data-status="succeeded"] { color: color-mix(in srgb, var(--mint, #45c69b) 77%, var(--text)); }
.unifiedhistory-status[data-status="failed"] { color: var(--danger); }
.unifiedhistory-status[data-status="queued"], .unifiedhistory-status[data-status="running"] { color: var(--violet); }
.unifiedhistory-status[data-status="unknown"] { color: color-mix(in srgb, #c79f4e 80%, var(--text)); }
.unifiedhistory-prompt { overflow: hidden; margin: 0 0 8px; color: var(--text); font-size: 12px; line-height: 1.7; text-overflow: ellipsis; white-space: nowrap; }
.unifiedhistory-meta { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.8; }
.unifiedhistory-error { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin: 6px 0; color: var(--danger); font-size: 11px; line-height: 1.65; overflow-wrap: anywhere; }
.unifiedhistory-thumb { display: grid; place-items: center; grid-column: 4; width: 64px; height: 64px; overflow: hidden; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 8px; color: var(--soft); background: var(--surface); cursor: zoom-in; }
.unifiedhistory-thumb img, .unifiedhistory-thumb video { display: block; width: 100%; height: 100%; object-fit: cover; }
.unifiedhistory-thumb:has(img) > svg { display: none; }
.unifiedhistory-thumb svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.unifiedhistory-thumb:hover { border-color: color-mix(in srgb, var(--violet) 65%, var(--line)); }
.unifiedhistory-actions { display: flex; align-items: center; justify-content: flex-end; grid-column: 5; gap: 5px; padding-top: 3px; }
.unifiedhistory-action { display: grid; place-items: center; flex: 0 0 auto; width: 30px; height: 31px; margin: 0; padding: 6px; border: 1px solid transparent; border-radius: 6px; color: var(--muted); background: transparent; text-decoration: none; cursor: pointer; }
.unifiedhistory-action svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.unifiedhistory-action:hover:not(:disabled) { color: var(--text); background: color-mix(in srgb, var(--soft) 8%, transparent); }
.unifiedhistory-action.is-danger:hover:not(:disabled) { color: var(--danger); background: color-mix(in srgb, var(--danger) 8%, transparent); }
.unifiedhistory-refresh { width: 36px; height: 38px; border-color: var(--line); border-radius: 8px; background: var(--history-panel); }
.unifiedhistory-pagination { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 59px; padding: 13px 17px; border-top: 1px solid var(--line); }
.unifiedhistory-pagination > span { color: var(--muted); font-size: 11px; }
.unifiedhistory-pagination-controls, .unifiedhistory-pages { display: flex; align-items: center; gap: 7px; }
.unifiedhistory-page-button { display: inline-flex; align-items: center; justify-content: center; min-width: 32px; min-height: 32px; padding: 6px 10px; border: 1px solid transparent; border-radius: 7px; background: color-mix(in srgb, var(--line) 65%, var(--surface)); color: var(--soft); font: inherit; font-size: 11px !important; line-height: 1.3; text-decoration: none; cursor: pointer; }
.unifiedhistory-page-button:hover:not(:disabled) { border-color: color-mix(in srgb, var(--violet) 55%, var(--line)); color: var(--text); }
.unifiedhistory-page-button[aria-current="page"], .unifiedhistory-page-button.is-active { color: var(--bg); background: var(--violet); }
.unifiedhistory-page-button.is-danger { color: var(--danger); }
.unifiedhistory-pages > span { padding: 0 3px; color: var(--muted); font-size: 11px; }
.unifiedhistory-preview, .unifiedhistory-hide-dialog { box-sizing: border-box; padding: 20px; border: 1px solid var(--line); border-radius: 15px; color: var(--text); background: var(--surface-raised); box-shadow: 0 24px 90px #0006; }
.unifiedhistory-preview:not([open]), .unifiedhistory-hide-dialog:not([open]) { display: none; }
.unifiedhistory-preview[open] { display: grid; gap: 17px; width: min(1000px, calc(100vw - 40px)); max-height: calc(100dvh - 40px); overflow: auto; }
.unifiedhistory-preview::backdrop, .unifiedhistory-hide-dialog::backdrop { background: #0009; backdrop-filter: blur(3px); }
.unifiedhistory-preview > header { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.unifiedhistory-preview h3, .unifiedhistory-hide-dialog h3 { margin: 0; font-size: 17px; }
.unifiedhistory-preview-media { display: grid; place-items: center; min-width: 0; overflow: hidden; border-radius: 9px; background: color-mix(in srgb, var(--bg) 80%, transparent); }
.unifiedhistory-preview-media > img, .unifiedhistory-preview-media > video { display: block; max-width: 100%; max-height: 61dvh; width: auto; height: auto; object-fit: contain; }
.unifiedhistory-preview-media > audio { width: min(100%, 600px); margin: 35px 0; }
.unifiedhistory-preview-media > p { margin: 0; padding: 42px 20px; color: var(--muted); font-size: 12px; }
#unifiedhistory-preview-meta { margin: 0; max-height: 25dvh; overflow: auto; color: var(--soft); font-size: 12px; line-height: 1.85; white-space: pre-wrap; overflow-wrap: anywhere; }
.unifiedhistory-preview-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.unifiedhistory-hide-dialog { width: min(420px, calc(100vw - 32px)); }
.unifiedhistory-hide-dialog > p { margin: 15px 0 22px; color: var(--soft); font-size: 12px; line-height: 1.8; }
.unifiedhistory-hide-dialog > div { display: flex; justify-content: flex-end; gap: 10px; }
html[data-theme="light"] .unifiedhistory-filters { box-shadow: 0 9px 26px #1821291c; }
html[data-theme="light"] .unifiedhistory-kind[data-kind="video"] { --history-kind: #a94b86; }
@media (max-width: 950px) {
  .unifiedhistory-row { grid-template-columns: 18px 36px minmax(0, 1fr) 62px 92px; column-gap: 10px; padding-inline: 14px; }
  .unifiedhistory-kind { width: 36px; height: 36px; }
  .unifiedhistory-thumb { width: 60px; height: 60px; }
  .unifiedhistory-actions { gap: 1px; }
}
@media (max-width: 680px) {
  .unifiedhistory-toolbar { align-items: flex-start; flex-wrap: wrap; gap: 17px; margin-top: 19px; margin-bottom: 19px; }
  .unifiedhistory-tools { width: 100%; gap: 8px; }
  .unifiedhistory-search { flex: 1; width: auto; }
  .unifiedhistory-filter-toggle { min-width: 82px; }
  .unifiedhistory-filters { right: -44px; width: min(260px, calc(100vw - 50px)); }
  .unifiedhistory-row { grid-template-columns: 16px 32px minmax(0, 1fr) 56px; row-gap: 6px; column-gap: 9px; min-height: 116px; padding: 14px 12px 10px; }
  .unifiedhistory-kind { width: 32px; height: 34px; border-radius: 8px; }
  .unifiedhistory-kind svg { width: 17px; height: 17px; }
  .unifiedhistory-select { padding-top: 9px; }
  .unifiedhistory-row-top { gap: 5px; margin-bottom: 5px; }
  .unifiedhistory-model { max-width: 100%; font-size: 10px; }
  .unifiedhistory-status { font-size: 10px; }
  .unifiedhistory-prompt { font-size: 11px; margin-bottom: 5px; }
  .unifiedhistory-thumb { width: 54px; height: 54px; }
  .unifiedhistory-actions { grid-column: 3 / 5; grid-row: 2; justify-self: end; gap: 5px; padding-top: 0; }
  .unifiedhistory-actions .unifiedhistory-action { height: 27px; }
  .unifiedhistory-pagination { flex-wrap: wrap; padding: 12px; gap: 12px; }
  .unifiedhistory-pagination-controls { margin-left: auto; flex-wrap: wrap; gap: 5px; }
  .unifiedhistory-pages { gap: 5px; }
  .unifiedhistory-page-button { min-width: 28px; min-height: 30px; padding: 6px 8px; }
  .unifiedhistory-preview[open] { width: calc(100vw - 24px); max-height: calc(100dvh - 24px); padding: 15px; }
}
@media (prefers-reduced-motion: reduce) { .unifiedhistory-row, .unifiedhistory-chevron { transition: none; } }
