/* Atelier IA v0.6.3: appearance tokens and reusable workspaces. No build step. */
:root{
  --accent:#5790ec;--accent-hover:#83aefa;--accent-ink:#08111f;
  --surface-canvas:#0a101b;--surface-sidebar:#101827;--surface-panel:#141f30;
  --surface-card:#172237;--surface-input:#102137;--edge:#354860;
  --text-strong:#dbe7f6;--text-muted:#9aabc0;
  --code-comment:#999;--code-punctuation:#ccc;--code-tag:#e2777a;
  --code-function:#6196cc;--code-number:#f08d49;--code-property:#f8c555;
  --code-keyword:#cc99cd;--code-string:#7ec699;--code-operator:#67cdcc;
  --theme-accent:#5790ec;--theme-accent-hover:#83aefa;--theme-accent-ink:#08111f;
  --surface-hover:#20354e;--bubble-user:#21416b;--bubble-ink:#e7f2ff;
  --field-placeholder:#8195ae;--ambient-glow:transparent;--composer-shadow:#020b1880;
}
:root[data-accent="violet"]{--accent:#a58ae2;--accent-hover:#c1a8ff;--accent-ink:#101322}
:root[data-accent="green"]{--accent:#49b59f;--accent-hover:#80d2bc;--accent-ink:#071c18}
:root[data-accent="orange"]{--accent:#dd9664;--accent-hover:#fac098;--accent-ink:#221208}
button#send,.primary-side,.workload-tabs button.selected{background:var(--accent);border-color:var(--accent);color:var(--accent-ink)}
button#send:hover,.primary-side:hover,.workload-tabs button.selected:hover{background:var(--accent-hover)}
.brand-icon,.welcome-icon{color:var(--accent)}
.context-track>div,.bar div{background:var(--accent)}
button:focus-visible,input:focus-visible,textarea:focus-visible,select:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
/* Compact composer: everything except the prompt, attachments and primary actions is opt-in. */
.composer[hidden],.timeline[hidden],.library-workspace[hidden],.composer-popover[hidden],
#composer-attachment-panel[hidden],#composer-settings-panel[hidden],
#attachment-toggle[hidden],.return-to-chat[hidden],#context-compact[hidden]{display:none!important}
.composer-header{gap:7px;min-width:0}
.composer-header #workload{max-width:min(44vw,320px);flex:0 1 auto}
.composer-header #toggle-composer{margin-left:auto}
.workload-capabilities{display:inline-flex;gap:4px;flex-shrink:0}
.workload-capability{display:inline-flex;align-items:center;justify-content:center;min-width:23px;height:22px;border-radius:6px;border:1px solid var(--edge);background:var(--surface-input);font-size:11px;color:var(--text-muted)}
.context-compact{cursor:pointer;white-space:nowrap;font-size:10px;color:var(--text-muted);border-radius:8px;padding:4px 6px;border:1px solid var(--edge)}
.composer textarea#prompt{margin:8px 0 3px;min-height:42px;padding:4px 1px;max-height:29vh}
.composer-popover{border:1px solid var(--edge);background:var(--surface-input);border-radius:12px;padding:12px;margin:6px 0;max-height:34vh;overflow-y:auto;overscroll-behavior:contain}
.composer-panel-heading{font-size:11px;font-weight:700;color:var(--text-muted);margin-bottom:6px}
.composer-actions{display:flex;align-items:center;gap:6px;min-width:0}
.composer-icon,.theme-quick{border:1px solid var(--edge);background:var(--surface-input);color:var(--text-strong);border-radius:9px;min-width:34px;height:32px;cursor:pointer;font-size:18px;line-height:1}
.composer-icon svg{display:block;width:17px;height:17px}
.composer-icon[aria-pressed=true]{border-color:var(--accent);color:var(--accent);background:var(--surface-panel)}
.composer-icon:hover,.theme-quick:hover,.composer-icon[aria-expanded=true]{border-color:var(--accent);color:var(--accent)}
.voice-record.recording{background:var(--accent);border-color:var(--accent);color:var(--surface)}
.composer-shortcut{font-size:10px;color:var(--text-muted);padding-left:6px}
#composer-attachment-panel .chat-attach-control{margin:0}
#composer-attachment-panel .file-picker{gap:5px}
#composer-settings-panel .seed-control{margin-top:7px}
.composer.collapsed #extra-fields,.composer.collapsed #prompt,.composer.collapsed .composer-footer,
.composer.collapsed #context-compact,.composer.collapsed #chat-attachments,.composer.collapsed #chat-attach-control,
.composer.collapsed #composer-attachment-panel,.composer.collapsed #composer-settings-panel,
.composer.collapsed #workload-docs{display:none!important}
.chat-attachment-chip{background:var(--surface-input);border-color:var(--edge);font-size:11px;padding:6px 9px}
.chat-attachment-chip button{border:0;background:transparent;color:inherit}
/* Full-window library, still served by the same API and file permissions. */
.main[data-view=library]{padding-bottom:0}
.library-workspace{display:flex;flex-direction:column;flex:1;min-height:0;gap:14px;overflow:hidden;padding:15px 3px 4px}
.library-hero{display:flex;align-items:flex-start;justify-content:space-between;gap:15px}
.library-hero h1{margin:0 0 5px;font-size:clamp(23px,2.4vw,32px);letter-spacing:-.03em;color:var(--text-strong)}
.library-hero p{margin:4px 0;font-size:12px;color:var(--text-muted)}
.library-hero .library-eyebrow{font-size:9px;font-weight:800;letter-spacing:1.6px;color:var(--accent);margin-bottom:6px}
.library-close{border:1px solid var(--edge);border-radius:9px;background:var(--surface-input);color:var(--text-strong);padding:10px 12px;cursor:pointer;font-size:12px;white-space:nowrap}
.library-close:hover{border-color:var(--accent)}
.library-toolbar{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
.library-toolbar select,.library-toolbar input{border:1px solid var(--edge);background:var(--surface-input);color:var(--text-strong);border-radius:9px;padding:10px 12px;font:inherit;font-size:12px}
.library-search-label{min-width:180px;flex:1}
.library-search-label input{width:100%}
.library-filter-row{display:flex;align-items:center;gap:5px;flex-wrap:wrap;padding:6px 0;border-bottom:1px solid var(--edge)}
.library-filter-row button{border:1px solid transparent;border-radius:8px;padding:7px 10px;background:transparent;color:var(--text-muted);cursor:pointer;font-size:11px}
.library-filter-row button[aria-pressed=true]{background:var(--surface-input);border-color:var(--accent);color:var(--text-strong);font-weight:700}
.library-filter-row button:hover{border-color:var(--edge);color:var(--text-strong)}
.library-spacer{flex:1}
.library-count{font-size:11px;color:var(--text-muted);white-space:nowrap}
.library-management-list{max-height:none;min-height:0;flex:1;overflow:auto;align-content:start;margin:0;padding:4px 3px 22px;overscroll-behavior:contain}
.library-management-list.library-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(min(100%,198px),1fr));gap:13px}
.library-grid .library-management-row{display:flex;flex-direction:column;align-items:stretch;justify-content:flex-start;gap:9px;background:var(--surface-card);border:1px solid var(--edge);border-radius:13px;padding:10px;overflow:hidden}
.library-grid .library-management-row .library-thumbnail{order:-1;display:block;width:100%;height:130px;max-height:130px;max-width:100%;object-fit:contain;background:var(--surface-input);border-radius:8px}
.library-grid .library-management-row .library-thumbnail:is(audio,video){max-width:100%;width:100%}
.library-grid .library-management-name{min-width:0;flex:1;overflow-wrap:anywhere;gap:5px}
.library-grid .library-management-name strong{font-size:12px;line-height:1.4}
.library-grid .library-management-name small{font-size:10px;line-height:1.4}
.library-grid .library-management-actions{gap:5px;display:grid;grid-template-columns:1fr 1fr;align-items:stretch}
.library-grid .library-management-actions .library-action{justify-content:center;text-align:center;padding:7px 5px;font-size:10px}
.library-grid .library-management-actions .library-action:first-child{grid-column:span 2}
.library-list .library-management-row{display:flex;flex-direction:row;align-items:center;background:var(--surface-card);border:1px solid var(--edge)}
.library-list .library-management-row .library-thumbnail{order:0;flex-shrink:0;width:85px;max-height:75px}
.library-list .library-management-row .library-management-name{flex:1}
.library-list .library-management-row .library-management-actions{display:flex}
.retention-tag{display:inline-flex;align-self:start;border-radius:7px;border:1px solid var(--edge);font-size:9px;padding:3px 6px;color:var(--text-muted);background:var(--surface-input)}
.retention-tag.is-pinned{color:#49ba88;border-color:#377b63}
.retention-tag.expires{color:#d19a57;border-color:#98703e}
.library-open .return-to-chat{display:flex}
.library-open #open-library-side{border-color:var(--accent);color:var(--accent)}
.theme-quick{height:30px;min-width:30px;font-size:16px;flex:none}
.theme-settings{padding:12px;border:1px solid var(--edge);border-radius:10px;margin-top:12px}
.theme-settings>strong{font-size:12px}
.theme-settings>p{font-size:11px;color:var(--text-muted);margin-bottom:0}
.theme-controls{display:flex;flex-wrap:wrap;gap:12px;margin-top:9px}
.theme-controls label{font-size:11px;color:var(--text-muted);display:flex;flex-direction:column;gap:5px;flex:1;min-width:130px}
.theme-controls select{width:100%;padding:8px;border:1px solid var(--edge);background:var(--surface-input);color:var(--text-strong);border-radius:7px}
.sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap}
/* The refreshed palettes override historical hard-coded colors without replacing Markdown/Prism styling. */
@media(max-width:850px){.workload-info{display:none}.library-hero{flex-wrap:wrap}.composer-shortcut{display:none}}
@media(max-width:760px){.library-workspace{padding:8px 0 0}.library-grid .library-management-row .library-thumbnail{height:100px}.library-management-list.library-grid{grid-template-columns:repeat(auto-fill,minmax(min(100%,155px),1fr));gap:8px}.library-toolbar select{max-width:48%}.library-hero h1{font-size:23px}.composer-header #workload{max-width:53vw}.context-compact{display:none}}
@media(max-width:480px){.library-hero .library-close{padding:7px}.library-filter-row button{padding:6px}.library-management-list.library-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.library-grid .library-management-actions{grid-template-columns:1fr}.library-grid .library-management-actions .library-action:first-child{grid-column:span 1}}
/* html is the root, not a descendant of :root */

.workload-capability.multi{color:var(--accent);border-color:var(--accent);font-weight:800;font-size:9px}


/* v0.6.3 — Additional palettes. Each token applies to ALL fields, including
   dynamically generated CLI/ComfyUI textareas, dialogs, file pickers and chat. */
:root[data-accent="auto"]{
 --accent:var(--theme-accent);--accent-hover:var(--theme-accent-hover);
 --accent-ink:var(--theme-accent-ink);
}

/* Consistent surfaces: historical style.css contains literal night colors.
   These overrides intentionally supersede those colors through specificity. */
html[data-theme] body,html[data-theme] .shell,html[data-theme] .main{
 background:var(--surface-canvas);color:var(--text-strong);
}
html[data-theme] .sidebar{background:var(--surface-sidebar);border-color:var(--edge)}
html[data-theme] :is(.brand,.workspace-topbar){border-color:var(--edge)}
html[data-theme] :is(.composer,.message.result,.settings-dialog,#mcp-dialog,.gpu,.worker,
 .mcp-result,.sidebar-details,.active-conversation-title,.connection,.conversation-row.selected,
 .mcp-side,.resource-grid>.ram-visual,.notification-setting,.theme-settings){
 background:var(--surface-panel);color:var(--text-strong);border-color:var(--edge);
}
html[data-theme] :is(.ram-heading,.ram-legend-item,.ram-note){color:var(--text-muted)}
html[data-theme] .voice-status{color:var(--text-muted)}
html[data-theme] .ram-stacked{background:var(--surface-hover);border-color:var(--edge)}
html[data-theme] .ram-other{background:var(--text-muted)}
html[data-theme] .ram-free{background:var(--surface-hover)}
html[data-theme] .ram-dot.ram-other{background-color:var(--text-muted)!important}
html[data-theme] .ram-dot.ram-free{background-color:var(--surface-hover)!important}
html[data-theme] :is(.message.user){background:var(--bubble-user);color:var(--bubble-ink);border-color:var(--edge)}
html[data-theme] :is(.field,.field label,.composer-header label,.workload-info,
 .sidebar-details summary,.brand small,.gpu-name,.worker-sub,.section-title,
 .notification-setting small,.sidebar-note,.composer-shortcut,.dialog-note,
 .theme-controls label,.library-management-name small){color:var(--text-muted)}
html[data-theme] :is(.brand strong,.active-conversation-title strong,
 .gpu-head strong,.worker-head strong,.conversation-name,.notification-setting strong,
 .dialog-head h2,.dialog-head button,.message-content,.library-management-name strong){color:var(--text-strong)}
html[data-theme] .message.user .message-content{color:var(--bubble-ink)}
html[data-theme] .composer{box-shadow:0 6px 26px var(--composer-shadow)}
html[data-theme] :is(.welcome,.welcome p,.sidebar-note,.gpu-name,.gpu-head span,.worker-head span){color:var(--text-muted)}
html[data-theme] .welcome h2{color:var(--text-strong)}
html[data-theme] .welcome-icon{color:var(--accent)}
html[data-theme] :is(.workload-tabs button:not(.selected),.theme-quick,
 .composer-tool,.file-clear,.replay-button,.library-action,.settings-actions button,
 .notification-setting button,
 .conversation-action,.conversation-rename,.conversation-delete,.mcp-form button,
 .mobile-menu,.close-sidebar,.settings-trigger,.account-trigger){
 background:var(--surface-input);color:var(--text-strong);border-color:var(--edge);
}
html[data-theme] :is(.workload-tabs button:not(.selected),.mcp-side):hover{background:var(--surface-hover)}
/* Workload forms: explicit element/class specificity beats .field .workload-text
   and the legacy textarea rule, including multiline and numeric inputs. */
html[data-theme] :is(input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
 select,.field .workload-text,.composer .field textarea.workload-text,
 .args-label textarea,.mcp-form select,.chat-file-kind select){
 background:var(--surface-input);color:var(--text-strong);border-color:var(--edge);
}
html[data-theme] .field textarea.workload-text,
html[data-theme] .composer .field textarea.workload-text,
html[data-theme] #prompt{color:var(--text-strong)}
html[data-theme] #prompt{background:transparent}
html[data-theme] :is(input,textarea)::placeholder{color:var(--field-placeholder);opacity:1}
html[data-theme] :is(input,select,textarea){caret-color:var(--text-strong)}
html[data-theme] :is(.bar,.context-track){background:var(--surface-hover)}
html[data-theme] .job-diagnostics,html[data-theme] .tool-result,
html[data-theme] .diagnostics-log{background:var(--surface-input);border-color:var(--edge)}
html[data-theme] :is(.job-diagnostics summary,.tool-result summary,.diagnostics-log summary,
 .diagnostics-log pre,.tool-result pre){color:var(--text-strong);border-color:var(--edge)}
html[data-theme] .job-diagnostics .diagnostics-body{color:var(--text-muted)}
html[data-theme] .md-rendered :not(pre)>code{background:var(--surface-input);color:var(--text-strong);border-color:var(--edge)}
html[data-theme] #auth-dialog{background:var(--surface-panel);color:var(--text-strong);border-color:var(--edge)}
html[data-theme] #auth-dialog .auth-form label{color:var(--text-muted)}
html[data-theme] #auth-dialog .auth-form input{background:var(--surface-input);color:var(--text-strong);border-color:var(--edge)}
html[data-theme] #auth-dialog .auth-mode-toggle{color:var(--accent)}
html[data-theme] .auth-account-state{border-color:var(--edge)}
html[data-theme] .auth-account-state button{background:var(--surface-input);color:var(--text-strong);border-color:var(--edge)}
html[data-theme] .md-rendered .math-source{color:var(--text-strong)}
html[data-theme] .md-rendered .katex{font-size:1.08em;color:inherit}
html[data-theme] .md-rendered .katex-display{max-width:100%;overflow-x:auto;overflow-y:hidden;padding:.4em 0;scrollbar-color:var(--text-muted) transparent}
html[data-theme] .md-rendered blockquote{background:var(--surface-input);color:var(--text-strong);border-color:var(--accent)}
html[data-theme] .md-rendered a{color:var(--accent)}
html[data-theme] .md-rendered :is(h1,h2,h3,h4,h5,h6){color:var(--text-strong)}
html[data-theme] .md-rendered table{color:var(--text-strong)}
html[data-theme] .md-rendered th{color:var(--text-strong);background:var(--surface-hover)}
html[data-theme] .md-rendered :is(th,td){border-color:var(--edge)}
html[data-theme] .md-rendered tr:nth-child(2n) td{background:var(--surface-input)}
html[data-theme] :is(.thinking,.tool-event,.tool-doc){background:var(--surface-input);color:var(--text-strong);border-color:var(--edge)}
html[data-theme] .thinking summary{color:var(--accent)}
html[data-theme] .thinking pre{color:var(--text-strong);scrollbar-color:var(--text-muted) var(--surface-input)}
html[data-theme] .md-rendered pre{background:var(--surface-input)!important;border-color:var(--edge);scrollbar-color:var(--text-muted) transparent}
html[data-theme] .md-rendered pre code,html[data-theme] .md-rendered pre code[class*="language-"]{color:var(--text-strong)}
html[data-theme] .md-rendered pre .token.comment,html[data-theme] .md-rendered pre .token.block-comment,
html[data-theme] .md-rendered pre .token.prolog,html[data-theme] .md-rendered pre .token.doctype,
html[data-theme] .md-rendered pre .token.cdata{color:var(--code-comment)}
html[data-theme] .md-rendered pre .token.punctuation{color:var(--code-punctuation)}
html[data-theme] .md-rendered pre .token.tag,html[data-theme] .md-rendered pre .token.attr-name,
html[data-theme] .md-rendered pre .token.namespace,html[data-theme] .md-rendered pre .token.deleted{color:var(--code-tag)}
html[data-theme] .md-rendered pre .token.function-name{color:var(--code-function)}
html[data-theme] .md-rendered pre :is(.token.boolean,.token.number,.token.function){color:var(--code-number)}
html[data-theme] .md-rendered pre :is(.token.property,.token.class-name,.token.constant,.token.symbol){color:var(--code-property)}
html[data-theme] .md-rendered pre :is(.token.selector,.token.important,.token.atrule,.token.keyword,.token.builtin){color:var(--code-keyword)}
html[data-theme] .md-rendered pre :is(.token.string,.token.char,.token.attr-value,.token.regex,.token.variable){color:var(--code-string)}
html[data-theme] .md-rendered pre :is(.token.operator,.token.entity,.token.url){color:var(--code-operator)}
html[data-theme] .md-rendered pre .token.inserted{color:var(--code-string)}
html[data-theme] .md-rendered .copy-code{background:var(--surface-hover);color:var(--text-strong);border-color:var(--edge)}
html[data-theme="light"],html[data-theme="sand"]{
 --code-comment:#667085;--code-punctuation:#3b4554;--code-tag:#9c2c36;
 --code-function:#1762a0;--code-number:#9b4d10;--code-property:#785c00;
 --code-keyword:#76328a;--code-string:#23734b;--code-operator:#4b5563;
}
html[data-theme] :is(.theme-settings,.notification-setting){background:var(--surface-card)}
html[data-theme] .conversation-row.selected{border-color:var(--edge)}

/* Neon emphasis is limited to focused/selected surfaces, not all controls. */
html[data-theme^="neon-"] :is(.composer,.sidebar-details[open],.workload-capability.multi){
 box-shadow:0 0 18px var(--ambient-glow);
}
html[data-theme^="neon-"] :is(.primary-side,.workload-tabs button.selected,button#send){
 box-shadow:0 0 14px var(--ambient-glow);
}
html[data-theme^="neon-"] :is(button,input,textarea,select):focus-visible{
 outline-color:var(--accent);box-shadow:0 0 0 3px var(--ambient-glow);
}
/* Slate/light legacy selectors take precedence for very few components; use
   variable tokens to bring warm/light themes into parity without code duplication. */
@media (prefers-reduced-motion:reduce){html[data-theme^="neon-"] *{transition:none!important;animation:none!important}}

