/* Software workspace: one dark palette and one shared gradient for creation and chat. */
body[data-page="workspace"] {
  --shell-surface:#1b1b1b; --shell-sidebar:#161615; --shell-hover:#252524;
  --shell-selected:#2c2c2a; --shell-border:#363634;
  --ink:#f2f2f0; --muted:#aaa9a5; --line:var(--shell-border);
  --theme-surface:#242423; --theme-sidebar:var(--shell-sidebar);
  --theme-hover:var(--shell-hover); --theme-selected:var(--shell-selected);
  --bg:#161615; --g-alt:#2c2c2a;
}
.chat-shell { grid-template-columns:264px minmax(0,1fr); background:var(--shell-sidebar); }
.project-sidebar { background:var(--shell-sidebar); border:0; gap:24px; padding:28px 16px 20px; }
.sidebar-brand { padding:0 12px 8px; }
.sidebar-brand .brand { font-size:20px; }
.new-project { border:0; border-radius:10px; height:44px; padding-inline:14px; font-size:14px; font-weight:500; }
.chat-shell .new-project,.projects-dialog .new-project { background:transparent!important; }
.chat-shell .new-project[aria-current="page"],.projects-dialog .new-project[aria-current="page"],.new-project:hover { background:var(--shell-selected)!important; }
.sidebar-heading { font-size:12px; letter-spacing:.02em; }
.chat-project { padding:11px 12px; }
.chat-project:hover { background:var(--shell-hover); }
.chat-project[aria-current="page"] { background:var(--shell-selected); }
.chat-project strong { font-weight:500; }
.chat-project small { font-size:11px; }
.sidebar-account { border-color:var(--shell-border); }
.sidebar-account p { font-size:11px; }
.chat-main { position:relative; isolation:isolate; margin:10px 10px 10px 0; border:1px solid var(--shell-border); border-radius:22px; overflow:hidden; background:var(--shell-surface); }
.workspace-stage { flex:1; min-height:0; display:flex; flex-direction:column; }
.chat-header { padding:18px 28px; min-height:84px; border-color:var(--shell-border); }
.chat-heading h1 { font-size:16px; }
.chat-heading p { font-size:12px; }
.chat-header .tool-button,.chat-header .icon-button { border-radius:10px; min-height:44px; }
.workspace-mobile-brand,.mobile-account,.menu-only,.starter-suggestions { display:none; }
.chat-compose-area { width:min(840px,100%); padding-inline:28px; }
.chat-composer { border-radius:24px; padding:16px 20px 12px; }
.chat-thread { max-width:840px; padding-inline:28px; }
.chat-compose-actions { min-height:44px; }
.send-button { display:inline-flex; align-items:center; justify-content:center; width:44px; height:44px; border-radius:50%; }
.composer-status { min-height:18px; margin:10px 0 0; font-size:11px; }
.chat-compose-actions>span { font-size:12px; }
#project-name-field { margin-bottom:14px; }
#project-name-field label { display:flex; flex-wrap:wrap; gap:8px; margin:0 0 6px; font-size:12px; font-weight:500; color:#f2f2f0; }
#project-name-field label span { color:#b9b9b5; font-weight:400; }
.chat-composer #project-name { height:44px; margin:0; padding:6px 0 10px; font-size:16px; color:#f7f7f5; border-bottom-color:#ffffff30; }
.chat-composer #project-name::placeholder { color:#b4b4b1; }

/* Client messages use a quiet bubble; assistant responses sit directly on the gradient. */
.chat-main { --ink:#fff; --muted:#f7f8fc; color:var(--ink); }
.chat-shell[data-view] .message-user { width:fit-content; max-width:92%; margin:0 0 24px auto; padding:12px 16px; background:#151a2c99; border:1px solid #ffffff26; border-radius:18px 18px 4px 18px; box-shadow:none; line-height:1.75; }
.chat-shell .message-label-user { text-align:right; }
.chat-shell[data-view] .chat-proposal { border:0; padding:0; }
.chat-shell[data-view] .job-result { padding:0; border:0; border-radius:0; background:transparent; box-shadow:none; }
.chat-shell[data-view] .job-result[data-status="failed"] { background:transparent; border:0; }
.chat-shell .message-label { margin:0 0 8px; color:#f7f8fc; }
.chat-shell .message-meta,.chat-shell .job-log { color:#f7f8fc; }
.chat-shell[data-view="chat"] .chat-header { border-color:#ffffff20; }
.chat-shell[data-view="chat"] .composer-status { color:#fff; }
.chat-shell[data-view] .chat-thread .button:is(.primary,.secondary) { background:#f0f0ed!important; border-color:transparent; color:#202020; box-shadow:none!important; }
.chat-shell[data-view] .chat-thread .button:is(.primary,.secondary):hover:not(:disabled) { background:#fff!important; }
.chat-shell[data-view] .chat-thread .button { appearance:none; -webkit-appearance:none; color:var(--ink); max-width:100%; height:auto; min-height:44px; padding-block:10px; white-space:normal; text-align:center; }
.chat-shell[data-view] .chat-thread .action-note { margin:10px 0 0; font-size:13px; line-height:1.6; color:#f7f8fc; }
.chat-shell[data-view] :focus-visible { outline-color:#fff; }

/* The gradient stays behind the complete workspace, including the conversation. */
.chat-shell .chat-main::before {
  content:""; position:absolute; inset:0; z-index:-1; pointer-events:none;
  background:var(--start-background);
}
.chat-shell[data-view="home"] .chat-header { border:0; min-height:76px; }
.chat-shell[data-view="home"] .chat-heading,.chat-shell[data-view="home"] .chat-tools { display:none; }
.chat-shell[data-view="home"] .workspace-stage { overflow:auto; padding:32px 0 clamp(48px,12vh,140px); }
.chat-shell[data-view="home"] .chat-content { flex:0 0 auto; margin-top:auto; }
.chat-shell[data-view="home"] .chat-scroll { height:auto; overflow:visible; scrollbar-gutter:auto; }
.chat-shell[data-view="home"] .chat-welcome { height:auto; min-height:0; padding:0 24px 32px; color:#fff; }
.welcome-eyebrow { display:flex; align-items:center; gap:10px; font-size:12px; font-weight:500; color:#ededee; }
.chat-shell[data-view="home"] .chat-welcome h1 { margin:28px 0 12px; font-size:clamp(28px,3.2vw,42px); line-height:1.2; letter-spacing:-1.5px; font-weight:550; }
.chat-shell[data-view="home"] .chat-welcome p { font-size:15px; line-height:1.6; color:#e4e7ef; }
.chat-shell[data-view="home"] .chat-compose-area { width:min(860px,100%); margin-top:0; margin-bottom:auto; padding-bottom:0; }
.chat-shell[data-view="home"] .chat-composer { background:#242424; color:#f7f7f5; border:1px solid #ffffff26; border-radius:28px; padding:22px 22px 14px; box-shadow:0 12px 40px #1115231a; }
.chat-shell[data-view="home"] .chat-composer:focus-within { border-color:#c4cfff; box-shadow:0 0 0 3px #c4cfff30; }
.chat-shell[data-view="home"] .chat-composer textarea { color:#f7f7f5; min-height:68px; background:transparent; font-size:17px; }
.chat-shell[data-view="home"] .chat-composer textarea::placeholder { color:#b4b4b1; opacity:1; }
.chat-shell[data-view="home"] .chat-compose-actions>span { color:#b9b9b5; }
.chat-shell[data-view="home"] .send-button { background:#f0f0ed!important; color:#202020; }
.chat-shell[data-view="home"] .send-button:hover:not(:disabled) { background:#fff!important; }
.chat-shell[data-view="home"] .send-button:disabled { background:#555553!important; color:#c6c6c2; }
.chat-shell[data-view="home"] .starter-suggestions { display:flex; justify-content:center; flex-wrap:wrap; gap:8px; margin-top:20px; }
.starter-suggestions button { display:flex; align-items:center; gap:12px; min-height:40px; padding:8px 14px; border:1px solid #ffffff38; border-radius:24px; color:#fff; background:#1b2345c9; font-size:12px; transition:background .15s,transform .15s; }
.starter-suggestions button:hover { background:#1b2345; transform:translateY(-1px); }
.starter-suggestions button:active { transform:translateY(1px); }
.chat-shell[data-view="home"] .composer-status { color:#fff; margin-top:16px; text-shadow:0 1px 5px #172b5e; }
.chat-shell[data-view="home"] :focus-visible { outline-color:#fff; }

@media (min-width:768px) and (max-width:1100px) {
  .chat-shell { grid-template-columns:224px minmax(0,1fr); }
  .project-sidebar { padding-inline:12px; }
  .chat-header { flex-wrap:wrap; gap:8px; padding:14px 20px; }
  .chat-heading { flex-basis:auto; }
  .chat-tools { width:100%; }
  .chat-tools #open-settings { margin-left:auto; }
  .chat-compose-area,.chat-thread { padding-inline:20px; }
}
@media (max-width:767px) {
  body[data-page="workspace"] { position:fixed; inset:0; top:var(--workspace-top,0px); height:var(--workspace-height,100dvh); }
  .chat-shell { grid-template-columns:minmax(0,1fr); height:100%; }
  .chat-main { margin:0; border:0; border-radius:0; }
  .chat-header { min-height:68px; padding:12px 16px; gap:8px; flex-wrap:nowrap; }
  .chat-header .chat-heading { position:absolute; width:1px; height:1px; margin:-1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }
  .chat-heading h1 { font-size:15px; }
  .chat-header .chat-tools { flex:1; width:auto; min-width:0; flex-wrap:nowrap; gap:8px; }
  .chat-header>.icon-button { align-self:center; flex-shrink:0; width:44px; }
  .chat-tools .tool-button { font-size:12px; }
  .chat-header .chat-tools .icon-button { width:44px; flex-shrink:0; }
  .chat-header #open-preview { margin-right:auto; }
  .chat-shell[data-view="home"] .mobile-account,.chat-shell[data-mobile-tools="menu"] .mobile-account { display:block; margin-left:auto; }
  .mobile-account { position:relative; min-width:0; color:#fff; }
  .mobile-account summary { display:flex; align-items:center; min-height:44px; max-width:140px; padding:8px; cursor:pointer; list-style:none; font-size:13px; border-radius:8px; }
  .mobile-account summary::-webkit-details-marker { display:none; }
  #mobile-account-name { overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }
  .account-menu { position:absolute; right:0; top:calc(100% + 6px); min-width:140px; padding:6px; border:1px solid var(--shell-border); border-radius:12px; background:var(--shell-surface); box-shadow:0 8px 24px #0005; z-index:20; }
  .account-menu button { width:100%; min-height:44px; padding:10px 14px; border:0; border-radius:8px; text-align:left; color:var(--ink); background:transparent; font-size:14px; }
  .account-menu button:hover { background:var(--shell-hover); }
  .chat-header { position:relative; z-index:2; }
  html[data-theme="dark"] .projects-dialog :focus-visible { outline-color:#fff; }
  .sidebar-tools .chat-tools { display:flex; flex-direction:column; align-items:stretch; width:100%; gap:8px; }
  .sidebar-tools .tool-button,.sidebar-tools .icon-button { width:100%; min-height:44px; justify-content:flex-start; padding-inline:14px; gap:10px; font-size:14px; }
  .sidebar-tools .menu-only { display:inline; }
  .chat-shell[data-view="home"] .chat-header { min-height:68px; padding:12px 16px; }
  .chat-shell[data-view="home"] #open-projects { display:inline-flex; }
  .chat-shell[data-view="home"] .workspace-mobile-brand { display:inline-flex; color:#fff; font-size:19px; gap:8px; }
  .workspace-mobile-brand span { color:#d3d3d1; }
  .chat-shell[data-view="home"] .workspace-stage { padding:24px 0 40px; }
  .chat-shell[data-view="home"] .chat-welcome { padding:0 20px 28px; }
  .welcome-eyebrow { font-size:11px; gap:8px; }
  .chat-shell[data-view="home"] .chat-welcome h1 { font-size:30px; letter-spacing:-1.1px; margin-top:26px; }
  .chat-shell[data-view="home"] .chat-welcome p { max-width:270px; font-size:14px; }
  .chat-compose-area,.chat-shell[data-view="home"] .chat-compose-area { padding-inline:18px; }
  .chat-shell[data-view="home"] .chat-composer { padding:18px 18px 12px; border-radius:26px; }
  .chat-shell[data-view="home"] .chat-composer textarea { min-height:76px; font-size:16px; }
  .chat-shell[data-view="home"] .starter-suggestions { gap:8px; margin-top:16px; }
  .starter-suggestions button { min-height:36px; font-size:11px; padding:7px 12px; gap:8px; }
  .chat-compose-actions>span { font-size:11px; max-width:230px; }
  .chat-composer { padding:12px 16px 10px; border-radius:24px; }
  .chat-thread { padding:24px 18px 32px; }
  .chat-compose-area { padding-bottom:max(12px,env(safe-area-inset-bottom)); }
  .composer-status { min-height:0; margin-top:6px; font-size:10px; }
  .projects-dialog { width:min(340px,90vw); max-width:90vw; height:var(--workspace-height,100dvh); border-radius:0 22px 22px 0; }
  .projects-dialog .project-sidebar { padding-top:max(24px,env(safe-area-inset-top)); padding-bottom:max(20px,env(safe-area-inset-bottom)); }
  .keyboard-open .chat-shell[data-view="home"] .workspace-stage { padding:12px 0; }
  .keyboard-open .chat-shell[data-view="home"] .chat-welcome { padding-bottom:16px; }
  .keyboard-open .welcome-eyebrow,.keyboard-open .chat-welcome p,.keyboard-open .starter-suggestions { display:none!important; }
  .keyboard-open .chat-shell[data-view="home"] .chat-welcome h1 { margin:0; font-size:24px; }
}
@media(max-width:359px) {
  .chat-shell[data-view="home"] .workspace-mobile-brand { display:none; }
}
@media (max-height:600px) {
  .chat-shell[data-view="home"] .workspace-stage { padding-block:12px; }
  .chat-shell[data-view="home"] .chat-welcome { padding-bottom:16px; }
  .chat-shell[data-view="home"] .chat-welcome h1 { margin-top:12px; font-size:26px; }
  .welcome-eyebrow,.chat-shell[data-view="home"] .chat-welcome p { display:none; }
}
@media (prefers-reduced-motion:reduce) {
  .starter-suggestions button { transition:none; }
}

/* Leave more room for the conversation; longer messages still grow naturally. */
.chat-shell[data-view="chat"] .chat-composer{padding:8px 14px;border-radius:20px}
.chat-shell[data-view="chat"] .chat-composer textarea{min-height:36px;max-height:120px;line-height:1.5}
.chat-shell[data-view="chat"] .material-actions{margin:0;gap:16px}
.chat-shell[data-view="chat"] .chat-compose-actions{margin-top:0}
.chat-shell[data-view="chat"] .composer-status{margin-top:4px;min-height:0}

.chat-compose-area>#project-name-field{padding-inline:16px;margin-bottom:16px}
.chat-compose-area>#project-name-field input{height:40px;padding:4px 0;margin:0;background:transparent;border:0;border-bottom:1px solid #ffffff40;border-radius:0;color:#fff;font-size:16px;width:100%;box-shadow:none}
.chat-compose-area>#project-name-field input::placeholder{color:#e0e3eb}
.chat-compose-area>#project-name-field input:focus{outline:0;border-bottom-color:#fff}

/* The account plan and available credits share the chat header at every width. */
.billing-header{flex:1;min-width:0;color:#fff}
.billing-summary{display:inline-flex;align-items:center;gap:8px;min-height:44px;max-width:100%;margin-left:-4px;padding:4px;border:0;border-radius:8px;background:transparent;color:inherit;text-align:left;font-size:15px;font-weight:550;line-height:1.35;transition:background .15s,transform .15s}
.billing-summary:hover{background:#ffffff0d;transform:translateY(-1px)}
.billing-summary:active{transform:translateY(1px)}
#billing-summary-plan{overflow-wrap:anywhere}
#billing-summary-value{margin:0;font-size:12px;line-height:1.5;color:#e4e7ef;font-variant-numeric:tabular-nums;overflow-wrap:anywhere}
.billing-summary[data-state="error"],.billing-summary[data-state="expired"]{color:#ffd6a2}
.chat-shell[data-billing="true"] .chat-header{min-height:80px;padding-block:8px;flex-wrap:nowrap}
.chat-shell[data-billing="true"] .chat-header>.chat-tools{width:auto;flex:0 0 auto}
.chat-shell[data-billing="true"] .workspace-mobile-brand{display:none}
.project-menu>.panel-header{justify-content:flex-end;margin-bottom:8px}
@media(max-width:767px){
  .billing-summary{font-size:14px;gap:6px}
  .chat-shell[data-billing="true"] .chat-header{gap:8px}
  .chat-shell[data-billing="true"][data-view="home"] .workspace-mobile-brand{display:none}
  .chat-shell[data-billing="true"] .chat-header #open-preview{padding-inline:8px}
}
@media(prefers-reduced-motion:reduce){.billing-summary{transition:none}.billing-summary:hover,.billing-summary:active{transform:none}}

@media(max-width:767px){
  .chat-shell :is(.job-result,.message-materials)>a.text-button{display:inline-flex;align-items:center;justify-content:center;min-height:44px;padding:8px 14px;margin-top:8px;border:1px solid #ffffff70;border-radius:8px;background:#ffffff0d;color:inherit;line-height:1.4;text-decoration:none}
  .chat-shell :is(.job-result,.message-materials)>a.text-button:active{background:#ffffff26}
  .chat-shell :is(.job-log,.chat-proposal)>summary{display:flex;align-items:center;gap:8px;min-height:44px;text-decoration:none}
  .chat-shell :is(.job-log,.chat-proposal)>summary::before{content:'+';width:16px;flex:none;font-size:18px;text-align:center}
  .chat-shell :is(.job-log,.chat-proposal)[open]>summary::before{content:'−'}
}

/* Documents stay available in the account menus without occupying the site list. */
.sidebar-account{display:block}
.desktop-account{position:relative;width:100%;min-width:0}
.desktop-account summary{display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:44px;padding:8px;cursor:pointer;list-style:none;border-radius:8px}
.desktop-account summary::-webkit-details-marker{display:none}
.desktop-account #account-name{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}
/* Let the summary receive taps even if a mobile browser auto-links the email. */
:is(#account-name,#mobile-account-name),:is(#account-name,#mobile-account-name) *{pointer-events:none}
:is(#account-name,#mobile-account-name) a{color:inherit;text-decoration:inherit}
.desktop-account summary:hover{background:var(--shell-hover)}
.account-menu{position:absolute;right:0;top:calc(100% + 6px);min-width:224px;max-width:calc(100vw - 32px);padding:6px;border:1px solid var(--shell-border);border-radius:12px;background:var(--shell-surface);box-shadow:0 8px 24px #0005;z-index:20}
.desktop-account .account-menu{top:auto;bottom:calc(100% + 6px);left:0;width:100%;min-width:0}
.account-menu :is(a,button){display:flex;align-items:center;width:100%;min-height:44px;padding:10px 14px;border:0;border-radius:8px;text-align:left;text-decoration:none;color:var(--ink);background:transparent;font-size:14px;line-height:1.5;white-space:normal;overflow-wrap:anywhere}
.account-menu :is(a,button):hover{background:var(--shell-hover)}
