/* AI Luminous — original visual layer, 2026-09-24.
   Loaded after existing themes in the shell, extracted views and writing iframe.
   No request, billing, message, export or storage behaviour is changed.
   Existing !important declarations require scoped overrides in this layer. */
body.unified-workspace,body.writing-studio {
  --xj-electric:#4155e8; --xj-cyan:#6de7f0; --xj-violet:#8555ec;
  --xj-ink:#19344f; --xj-muted:#5d718a; --xj-surface:#fff;
  --xj-line:#d5dff1; --xj-canvas:#f3f6ff;
  --xj-action:linear-gradient(115deg,#215cd6 0%,#5750df 65%,#7647c3 100%);
  --xj-glow:0 6px 18px #5259d52b,inset 0 1px 0 #ffffff40;
}
/* The chrome owns the stronger colour; output remains a solid reading surface. */
body.unified-workspace .uw-header {
  background:linear-gradient(110deg,#102448,#23224f 72%,#153d58)!important;
  border-bottom:1px solid #89b9ff45!important;box-shadow:0 4px 24px #14264f24;
}
body.unified-workspace .uw-header :is(.uw-brand-name,nav a,.uw-top-tools>a){color:#eaf2ff!important}
body.unified-workspace .uw-header .uw-brand-tagline{color:#9bdce9!important}
body.unified-workspace .uw-header :is(.review,.uw-brand-name small){color:#b9d0f3!important}
body.unified-workspace .uw-header nav a:hover{background:#ffffff14!important;color:#fff!important}
body.unified-workspace .uw-header nav a.active,
body.unified-workspace .uw-header nav a[aria-current=page]{background:#6977ff32!important;box-shadow:inset 0 -2px 0 #89e7ed!important}
body.unified-workspace .agent-rail{background:linear-gradient(165deg,#f0f4ff,#f5f0ff 66%,#ebf8fc)!important}
body.unified-workspace .rail-item{border-radius:10px!important;transition:background .2s,transform .2s,box-shadow .2s}
body.unified-workspace .rail-item.active{background:linear-gradient(105deg,#e0eaff,#eee3ff)!important;border-color:#bdc9f3!important;color:#344baf!important;box-shadow:none!important}
/* Unified controls: luminous primary, tactile secondary, explicit keyboard focus. */
body.unified-workspace :is(.btn,.ai-gen-btn,.wb-gen-go,.rp-action-btn),
body.writing-studio :is(.btn,.new-btn,.settings-trigger,#settings-done,.studio-icon-button){
  border-radius:11px!important;min-height:40px;font-weight:600;
  transition:transform .18s ease,box-shadow .2s ease,background-color .2s ease,border-color .2s ease;
}
body.unified-workspace :is(.btn-primary,#send,.ai-gen-btn,.wb-gen-go),
body.writing-studio :is(#send-btn,.btn-primary,#settings-done){
  background:var(--xj-action)!important;color:#fff!important;border:1px solid #645be6!important;
  box-shadow:var(--xj-glow)!important;min-height:44px;border-radius:12px!important;
}
@media(hover:hover){
  body.unified-workspace :is(.btn-primary,#send,.ai-gen-btn,.wb-gen-go):not(:disabled):hover,
  body.writing-studio :is(#send-btn,.btn-primary,#settings-done):not(:disabled):hover{
    transform:translateY(-2px);box-shadow:0 9px 26px #5960dc4d,0 0 0 3px #827cff16,inset 0 1px 0 #ffffff60!important;
  }
  body.unified-workspace :is(.btn-ghost,.btn-outline,.rp-action-btn):not(:disabled):hover,
  body.writing-studio :is(.new-btn,.settings-trigger,.studio-icon-button):not(:disabled):hover{
    background:#eef0ff!important;border-color:#aab6f3!important;box-shadow:0 4px 12px #585bd51a!important;transform:translateY(-1px);
  }
}
body.unified-workspace :is(.btn,#send,.ai-gen-btn,.wb-gen-go):not(:disabled):active,
body.writing-studio :is(.btn,#send-btn,#settings-done,.new-btn):not(:disabled):active{transform:translateY(1px) scale(.98);box-shadow:inset 0 2px 6px #10265724!important}
body.unified-workspace button:disabled,body.writing-studio button:disabled{opacity:.5!important;transform:none!important;box-shadow:none!important;cursor:not-allowed}
body.unified-workspace :is(button,a,summary,input,select,textarea):focus-visible,
body.writing-studio :is(button,a,summary,input,select,textarea):focus-visible{outline:3px solid #5264d9!important;outline-offset:3px!important}
/* Agent identity and translucent coloured header. */
body.unified-workspace .agent-head,body.writing-studio .chat-head{
  background:linear-gradient(110deg,#f5faff,#f2edff 75%,#ebf9fb)!important;
  border-bottom:1px solid #cfdaf0!important;box-shadow:0 5px 18px #424c9d06;
}
body.unified-workspace :is(.agent-head .a-ic,.dialogue-avatar),body.writing-studio .studio-assistant-avatar{
  filter:drop-shadow(0 3px 8px #6865dc30);
}
body.unified-workspace .agent-scroll,body.writing-studio .chat-wrap{
  background:radial-gradient(ellipse at 95% 0%,#e9e4ff66,transparent 50%),var(--xj-canvas)!important;
}
body.unified-workspace .greeting{border-radius:18px!important;border-color:#cad5ef!important;background:linear-gradient(130deg,#fff 55%,#f1edff)!important;box-shadow:0 12px 32px #424b9b0c!important}
/* One input panel, preserving original controls and event bindings. */
body.unified-workspace .composer{padding:16px 24px max(16px,env(safe-area-inset-bottom))!important;background:linear-gradient(180deg,#f3f6ffdd,#ecf1ff)!important;border-top:1px solid #d8e1f4!important;box-shadow:none!important}
body.unified-workspace .composer-row,body.writing-studio .chat-input{
  position:relative;isolation:isolate;display:flex!important;flex-wrap:wrap;gap:12px!important;
  padding:16px!important;border:1px solid #c0cdef!important;border-radius:20px!important;
  background:var(--xj-surface)!important;box-shadow:0 6px 26px #434d9510!important;
  transition:box-shadow .25s,border-color .25s;
}
body.unified-workspace .composer-row::before,body.writing-studio .chat-input::before{
  content:'';position:absolute;pointer-events:none;z-index:-1;inset:-2px;border-radius:21px;
  border:2px solid transparent;background:linear-gradient(100deg,#3d8ef6,#8c64f5,#47dce7,#3d8ef6) border-box;
  background-size:250% 100%;mask:linear-gradient(#fff 0 0) padding-box,linear-gradient(#fff 0 0);mask-composite:exclude;
  -webkit-mask:linear-gradient(#fff 0 0) padding-box,linear-gradient(#fff 0 0);-webkit-mask-composite:xor;opacity:0;
}
body.unified-workspace .composer-row:focus-within,body.writing-studio .chat-input:focus-within{border-color:#9297e9!important;box-shadow:0 0 0 4px #8078e910,0 8px 30px #6165cc20!important}
body.unified-workspace .composer-row:focus-within::before,body.writing-studio .chat-input:focus-within::before{opacity:1;animation:xj-energy-flow 4s linear infinite}
body.unified-workspace .composer-row textarea,body.writing-studio .chat-input textarea{
  order:0;flex:1 0 100%!important;width:100%!important;min-width:0;min-height:64px!important;max-height:200px!important;
  padding:4px!important;border:0!important;border-radius:0!important;background:transparent!important;
  color:var(--xj-ink)!important;font-size:16px!important;line-height:1.75!important;box-shadow:none!important;
}
body.unified-workspace .composer-row textarea:focus-visible,body.writing-studio .chat-input textarea:focus-visible{outline:2px solid #8c9cdd!important;outline-offset:3px!important;border-radius:5px!important}
body.unified-workspace .composer-btns{order:1;flex:1!important;width:100%;gap:10px!important;justify-content:flex-end}
body.unified-workspace .composer-btns #imgBtn{order:-1;margin-right:auto;background:#edf3ff!important;border:1px solid #d0dcf5;color:#3e5d9a;width:46px!important}
body.unified-workspace .composer-btns #send{width:52px!important;height:44px!important}
body.unified-workspace .composer-btns #stopBtn{width:auto!important;min-width:64px;min-height:44px!important;padding:8px 12px;background:#fff3f1!important;border:1px solid #e6c4bc!important;color:#a03628!important}
body.unified-workspace .composer-btns button{border-radius:12px!important;min-width:44px!important;min-height:44px!important}
body.writing-studio .chat-input #btn-image{order:1;margin-right:auto;width:44px;height:44px;background:#edf3ff;color:#3e5d9a;border-radius:12px!important}
body.writing-studio .chat-input #send-btn{order:2;width:94px!important;height:44px!important;margin-left:auto}
body.writing-studio .chat-input-wrap{background:var(--xj-canvas)!important;padding-bottom:max(14px,env(safe-area-inset-bottom))!important}
/* Long-form answers use a solid, luminous-edged paper surface. */
body.unified-workspace .msg.assistant,body.writing-studio .msg.ai .bubble{
  background:var(--xj-surface)!important;color:var(--xj-ink)!important;
  border:1px solid #d4dff1!important;border-radius:17px!important;box-shadow:0 7px 22px #3e52900a!important;
  font-size:16px;line-height:1.85;
}
body.unified-workspace .msg.user,body.writing-studio .msg.user .bubble{background:linear-gradient(120deg,#e6efff,#eeebff)!important;border:1px solid #cdd7f6!important;color:#263d69!important;border-radius:16px 16px 5px 16px!important}
body.unified-workspace :is(.msg-actions,.ui-result-actions),body.writing-studio .card-actions{border-top-color:#e0e5f4!important;gap:8px!important}
body.unified-workspace :is(.msg-actions,.ui-result-actions) .btn,body.writing-studio .card-actions .btn{min-height:38px!important;border-radius:9px!important}
body.unified-workspace .msg.assistant :is(p,li),body.writing-studio .bubble :is(p,li){overflow-wrap:anywhere}
/* Real request activity already controls the presence of the thinking element. */
body.unified-workspace .thinking-core{width:42px;height:42px;border-radius:14px;background:linear-gradient(135deg,#e2edff,#eee0ff)!important;color:#6650dc;border:1px solid #ada5f2;animation:xj-core-pulse 2.4s ease-in-out infinite!important}
body.unified-workspace .thinking-orbit b{color:#485bc0!important;background:none!important;animation:none!important}
body.unified-workspace .thinking-wave i{background:linear-gradient(#6c59e6,#45b8d3)!important}
body.unified-workspace .ui-run-state[data-state=running]:before{box-shadow:0 0 10px #6577dc88}
/* Cards and image-generation controls gain the same product language. */
body.unified-workspace :is(.uw-card,.ai-center,.ai-scenes,.ai-history,.pcard){border-radius:17px!important;border-color:#d2ddf1!important;box-shadow:0 7px 24px #3f55900b!important}
body.unified-workspace .uw-card{transition:transform .22s,box-shadow .22s,border-color .22s}
@media(hover:hover){body.unified-workspace :is(.uw-card,.pcard):hover{transform:translateY(-3px);border-color:#a4a7ed!important;box-shadow:0 12px 30px #665dd521!important}}
body.unified-workspace #aiStudio .ai-scene.active{background:linear-gradient(110deg,#e5ecff,#eee2ff)!important;border-color:#afa9ee!important;box-shadow:inset 3px 0 #7e5bdc,0 4px 12px #7061d510!important}
body.unified-workspace #aiStudio .ai-gen-btn{min-height:48px!important;letter-spacing:.03em}
body.writing-studio .compose-mode select{border-radius:9px!important;min-height:40px}
body.writing-studio .session-item.active{background:linear-gradient(100deg,#e5edff,#eee6ff)!important;color:#3b50a9!important;border-radius:10px!important}
/* Existing dialog behaviour remains owned by the application. */
body.writing-studio #studio-settings,body.unified-workspace :is(dialog,.modal-card){border:1px solid #c9d0ef!important;border-radius:22px!important;box-shadow:0 24px 85px #19224c40,0 0 0 5px #8580e90b!important}
body.writing-studio #studio-settings header{background:linear-gradient(115deg,#edf4ff,#f1e9ff)!important;border-bottom:1px solid #d7def3}
body.writing-studio #studio-settings::backdrop,body.unified-workspace dialog::backdrop{background:#121e4b88;backdrop-filter:blur(6px)}
@keyframes xj-energy-flow{to{background-position:250% 0}}
@keyframes xj-core-pulse{0%,100%{box-shadow:0 0 0 0 #8063df10,0 0 18px #7870df22}50%{box-shadow:0 0 0 6px #8063df0c,0 0 25px #7870df44;transform:scale(1.05)}}
/* Preserve theme choice: dark controls receive solid contrast surfaces. */
html[data-theme=dark] body.unified-workspace,html[data-theme=dark] body.writing-studio{--xj-surface:#17233b;--xj-canvas:#101b31;--xj-ink:#e6efff;--xj-muted:#b3c1d9;--xj-line:#364968}
html[data-theme=dark] body.unified-workspace .composer{background:#101b31!important;border-color:#354564!important}
html[data-theme=dark] body.unified-workspace .composer-row,html[data-theme=dark] body.writing-studio .chat-input{border-color:#516088!important}
html[data-theme=dark] body.unified-workspace .msg.assistant,html[data-theme=dark] body.writing-studio .msg.ai .bubble{border-color:#364968!important}
html[data-theme=dark] body.unified-workspace .msg.assistant :is(h1,h2,h3,h4,p,li){color:#e6efff!important}
@media(max-width:700px){
  body.unified-workspace .composer{padding:12px 12px max(12px,env(safe-area-inset-bottom))!important}
  body.unified-workspace .composer-row,body.writing-studio .chat-input{padding:12px!important;border-radius:17px!important;gap:8px!important}
  body.unified-workspace .composer-row textarea,body.writing-studio .chat-input textarea{min-height:54px!important;max-height:150px!important}
  body.unified-workspace :is(.msg-actions,.ui-result-actions) .btn,body.writing-studio .card-actions .btn{min-height:44px!important}
  body.unified-workspace .msg.assistant,body.writing-studio .msg.ai .bubble{font-size:15px;line-height:1.8}
  body.writing-studio :is(.settings-trigger,.compose-mode select){min-height:44px!important}
}
@media(prefers-reduced-motion:reduce){
  body.unified-workspace :is(.composer-row,.thinking-core,.thinking-wave i,.ui-run-state:before,.uw-card,.btn,button),
  body.writing-studio :is(.chat-input,.btn,button),
  body.unified-workspace .composer-row::before,body.writing-studio .chat-input::before{animation:none!important;transition:none!important;transform:none!important}
}
/* Screenshot follow-up: input owns the row; upload and send form one right-aligned group.
   The container is the visible focus boundary, not a nested textarea outline. */
body.unified-workspace .composer-row,body.writing-studio .chat-input{
  display:grid!important;grid-template-columns:minmax(0,1fr) 44px auto auto;
  align-items:end!important;gap:10px!important;padding:12px!important;
}
body.unified-workspace .composer-row textarea,body.writing-studio .chat-input textarea{
  grid-column:1;grid-row:1;min-height:64px!important;width:100%!important;
  padding:8px 4px!important;align-self:stretch;
}
body.unified-workspace .composer-row textarea:focus-visible,
body.unified-workspace .composer-row textarea:focus,
body.writing-studio .chat-input textarea:focus-visible,
body.writing-studio .chat-input textarea:focus{
  outline:none!important;border:0!important;box-shadow:none!important;
}
body.unified-workspace .composer-btns{display:contents!important}
body.unified-workspace .composer-btns #imgBtn,body.writing-studio .chat-input #btn-image{
  grid-column:2;grid-row:1;align-self:end;margin:0!important;width:44px!important;
  background:transparent!important;border-color:transparent!important;box-shadow:none!important;
}
body.unified-workspace .composer-btns #send,body.writing-studio .chat-input #send-btn{
  grid-column:3;grid-row:1;align-self:end;margin:0!important;
}
body.unified-workspace .composer-btns #stopBtn{grid-column:4;grid-row:1;align-self:end;margin:0!important}
body.unified-workspace .agent-rail :is(.rail-item,.rail-mini-item).active,
body.unified-workspace .agent-rail :is(.rail-item,.rail-mini-item).active:hover{
  box-shadow:none!important;
}
body.unified-workspace .agent-rail.rail-hidden .rail-collapsed-bar{padding-top:10px;gap:5px}
body.unified-workspace .agent-rail.rail-hidden .rail-mini-item{
  min-height:62px;flex-shrink:0;padding:9px 3px;gap:6px;border:1px solid transparent;border-radius:11px;
}
body.unified-workspace .agent-rail.rail-hidden .rail-mini-item.active{
  background:#e9e8ff!important;border-color:#d4cff5!important;color:#4452af;
}
body.unified-workspace .agent-rail.rail-hidden .rail-mini-label{
  max-width:100%;width:100%;font-size:12px;line-height:1.35;
  white-space:normal;overflow:visible;text-overflow:clip;overflow-wrap:anywhere;
}
@media(max-width:700px){
  body.unified-workspace .composer-row,body.writing-studio .chat-input{gap:6px!important;padding:10px!important}
  body.unified-workspace .composer-row textarea,body.writing-studio .chat-input textarea{min-height:58px!important}
  body.writing-studio .chat-input #send-btn{width:64px!important}
}
