/* Chat workspace: keep the authenticated app's existing data and voice controls. */
:root{--shell-sidebar:#f7f8fb;--shell-hover:#eceff7;--shell-ink:#202331;--shell-soft:#f1f3f9;--shell-line:#e5e8f0}
.app.chat-shell{max-width:none;width:100%;height:100dvh;min-height:0;display:flex;flex-direction:row;background:var(--surface,#fff);color:var(--shell-ink);overflow:hidden}
.chat-main{display:flex;flex-direction:column;flex:1;min-width:0;min-height:0;height:100%;position:relative}
.chat-sidebar{flex:0 0 272px;width:272px;display:flex;flex-direction:column;min-height:0;padding:20px 14px 16px;background:var(--shell-sidebar);border-right:1px solid var(--shell-line);gap:20px}
.sidebar-brand{display:flex;align-items:center;justify-content:space-between;padding:0 6px}.sidebar-brand .brand-x{width:31px;height:35px;font-size:25px}.sidebar-brand .wordmark{font-size:19px}
.icon-button{display:grid;place-items:center;flex-shrink:0;width:42px;height:42px;min-height:42px;padding:0;font-size:21px;border:0;background:transparent;color:var(--muted);border-radius:12px}
.icon-button:hover,.chat-sidebar button:hover:not(:disabled){background:var(--shell-hover)}
.chat-sidebar button{color:var(--shell-ink);font:inherit;cursor:pointer}
.sidebar-new{display:flex;align-items:center;gap:10px;text-align:left;border:1px solid var(--shell-line);border-radius:12px;background:var(--surface,#fff);padding:11px 12px;font-weight:600!important;min-height:48px}.sidebar-new span{font-size:22px;color:#15349B}
.sidebar-conversations{flex:1;min-height:0;overflow:auto;scrollbar-width:thin}.sidebar-label{font-size:11px;letter-spacing:.06em;color:var(--muted);margin:0 10px 8px}.sidebar-label:not(:first-child){margin-top:27px}
.sidebar-current,.sidebar-history-item{display:block;width:100%;min-height:44px;border:0;border-radius:10px;background:transparent;padding:11px 12px;text-align:left;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:14px!important}
.sidebar-current,.sidebar-history-item[aria-current]{background:var(--shell-hover);color:#15349B!important}.sidebar-current{font-weight:600!important}.sidebar-history-item:disabled{opacity:.65}.sidebar-history-item[aria-current]:disabled{opacity:1}
.sidebar-status{font-size:12px;line-height:1.7;color:var(--muted);padding:0 10px;margin:12px 0}.sidebar-link{font-size:12px!important;min-height:40px;background:transparent;border:0;padding:8px 10px;color:#15349B!important}
.sidebar-bottom{border-top:1px solid var(--shell-line);padding:14px 7px 0}.sidebar-bottom button{border:0;background:transparent;text-align:left;min-height:44px;padding:8px 4px;font-size:14px}.sidebar-bottom p{font-size:11px;color:var(--muted);line-height:1.8;margin:6px 4px 14px}.sidebar-bottom small{font-size:11px;color:var(--muted);margin-left:4px}
.chat-main .app-header{height:76px;min-height:76px;justify-content:flex-start;gap:12px;border-bottom:0;padding:16px 24px;background:transparent}.chat-main .app-header .wordmark{font-size:19px;gap:9px}.chat-main .app-header .brand-x{display:none}.header-model{font-size:11px;font-weight:400;color:var(--muted);background:var(--shell-soft);padding:4px 8px;border-radius:7px}.chat-main #new-chat{margin-left:auto;border:0;background:transparent;min-width:42px;font-size:24px}.chat-main #settings{border:1px solid var(--shell-line);background:transparent;font-size:12px;padding:8px 13px;min-height:40px;border-radius:12px}
.chat-main .conversation-stage{min-height:0;flex:1;width:100%;overflow:hidden}.chat-main .messages{height:100%;padding:28px max(24px,calc((100% - 780px)/2));scrollbar-width:thin;scroll-padding:28px;overflow-x:hidden}
.chat-main .welcome{min-height:100%;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;padding:16px 0 36px;box-sizing:border-box}.chat-main .welcome img{width:104px;height:104px;object-fit:contain;margin-bottom:14px}.chat-main .welcome h1{font-size:30px;line-height:1.4;letter-spacing:.01em;margin:0 0 12px;font-weight:600}.chat-main .welcome p{font-size:14px;line-height:1.8;color:var(--muted);margin:0}
.chat-main .message{max-width:100%;margin:0 0 34px;line-height:1.85}.chat-main .message.user{width:fit-content;max-width:85%;margin-left:auto;margin-right:0}.chat-main .message.user>.role{display:none}.chat-main .message.user>.content{background:var(--shell-soft);border:0;border-radius:22px;padding:13px 20px;white-space:pre-wrap}.chat-main .message.assistant{width:100%;max-width:100%;margin-left:0;margin-right:0}.chat-main .message.assistant>.role{text-align:left;font-size:12px;color:#15349B;display:block;margin-bottom:12px}.chat-main .message.assistant>.content{background:transparent;border:0;padding:0;border-radius:0;font-size:16px}.chat-main .message .actions{display:flex;justify-content:flex-start;gap:8px;margin-top:10px}.chat-main .message .actions button{border:0;background:transparent;padding:7px 10px;font-size:12px;color:var(--muted);min-height:40px}.chat-main .message details{border:1px solid var(--shell-line);border-radius:12px;padding:12px 16px;background:transparent;font-size:13px;margin-top:18px}.chat-main .message details summary{cursor:pointer;color:var(--muted)}
.chat-main .composer{width:calc(100% - 48px);max-width:780px;margin:0 auto;flex-shrink:0;min-height:0;max-height:min(70%,calc(100% - 120px));background:transparent;border:0;padding:0 0 max(14px,env(safe-area-inset-bottom));display:flex;flex-direction:column;overflow-y:auto;scrollbar-width:thin}
.chat-main .composer form{order:1;background:var(--surface,#fff);border:1px solid #dbe0ed;border-radius:24px;box-shadow:0 3px 16px #182c5d08;padding:13px 12px 9px}.chat-main #prompt{padding:5px 7px 10px;min-height:38px;font-size:16px;line-height:1.6;background:transparent}.chat-main .composer-actions{gap:7px;align-items:center;padding:0}.chat-main .composer-actions button{min-height:40px;border:0;border-radius:12px;background:transparent;padding:7px 11px;font-size:13px;white-space:nowrap}.chat-main .composer-actions #send{margin-left:auto;background:#15349B;color:#fff;width:40px;min-width:40px;height:40px;border-radius:50%;font-size:23px;padding:0}.chat-main .composer-actions #stop-chat{margin-left:auto;color:#a02f32;background:#fff0f0}.chat-main .inline-voice-feedback{order:2}.chat-main .inline-voice-tools{order:3;padding:8px 1px 2px;gap:4px;flex-wrap:wrap}.chat-main .inline-voice-tools label,.chat-main .inline-voice-tools button{min-height:36px;font-size:11px}.chat-main .inline-voice-tools button{border:0;padding:6px 10px;background:transparent}.chat-main .inline-voice-tools #voice-open{margin-left:auto}.chat-main .inline-voice-context{order:4;font-size:11px;margin:3px 4px 0;padding:0;color:var(--muted)}
.chat-main .composer>#send-notice{order:5;font-size:10px;line-height:1.6;color:var(--muted);margin:4px 4px 0;padding:0}.chat-main .inline-voice-privacy{order:6;font-size:10px;padding:0 4px}.chat-main .inline-voice-privacy summary{padding:4px 0}.chat-main .composer>.error,.chat-main .composer>#app-info,.chat-main #document-status{order:0;margin:4px 2px 8px;padding:8px 12px;border-radius:10px;line-height:1.6;font-size:12px}.chat-main .latest-message{bottom:14px;font-size:12px;padding:8px 13px;background:var(--surface,#fff);box-shadow:0 3px 12px #182c5d14;border:1px solid var(--shell-line)}
.chat-shell button:focus-visible,.chat-shell summary:focus-visible,.chat-shell input:focus-visible,.chat-shell textarea:focus-visible{outline:3px solid #859de3;outline-offset:3px}.chat-shell button:disabled{cursor:default}
.sidebar-backdrop{display:none}
@media(prefers-color-scheme:dark){:root{--shell-sidebar:#171b27;--shell-hover:#252d40;--shell-ink:#eef0f7;--shell-soft:#242c3d;--shell-line:#343c50}.app.chat-shell{background:#1d2230}.chat-main .composer form{background:#222938;border-color:#414b65}.chat-main .sidebar-new{background:#222938}.chat-main .message.assistant>.role,.sidebar-current,.sidebar-history-item[aria-current],.sidebar-link{color:#b6c7ff!important}.sidebar-new span{color:#b6c7ff}.chat-main #inline-voice-listen{color:#b6c7ff}.chat-main .message.assistant>.content{color:#eef0f7}.chat-main .composer-actions #stop-chat{background:#48272d;color:#ffb8be}}
@media(max-width:999px){.chat-sidebar{position:absolute;z-index:32;left:0;top:0;bottom:0;width:min(300px,calc(100% - 48px));box-shadow:12px 0 32px #0002;padding-top:max(20px,env(safe-area-inset-top));padding-bottom:max(16px,env(safe-area-inset-bottom))}.sidebar-backdrop{position:absolute;inset:0;display:block;border:0;border-radius:0;padding:0;background:#121a3080;z-index:31}.chat-main .app-header{height:64px;min-height:64px;padding:10px 14px;gap:8px}.chat-main .messages{padding:20px max(18px,calc((100% - 780px)/2))}.chat-main .composer{width:calc(100% - 32px)}.chat-main .welcome h1{font-size:26px}}
@media(max-width:480px){.chat-main .app-header .wordmark{font-size:17px}.header-model{font-size:10px;padding:3px 6px}.chat-main #settings{font-size:11px;padding:7px 9px}.chat-main .app-header{gap:5px;padding-inline:10px}.chat-main .messages{padding-inline:18px;padding-top:14px}.chat-main .welcome img{width:88px;height:88px;margin-bottom:12px}.chat-main .welcome h1{font-size:23px}.chat-main .welcome p{font-size:12px;max-width:240px}.chat-main .composer{width:calc(100% - 24px);max-height:min(70%,calc(100% - 100px));padding-bottom:max(9px,env(safe-area-inset-bottom))}.chat-main .composer form{padding:9px 8px 7px;border-radius:20px}.chat-main .composer-actions{gap:2px}.chat-main .composer-actions button{font-size:12px;padding:6px 9px;min-height:44px}.chat-main .composer-actions #send{width:42px;min-width:42px;height:42px}.chat-main .inline-voice-tools{padding-top:4px}.chat-main .inline-voice-tools button{padding-inline:7px}.chat-main .message.user{max-width:90%}.chat-main .message.assistant>.content{font-size:15px}.chat-main .message.user>.content{padding:11px 16px}.chat-main .message{margin-bottom:26px}.chat-main .message details{padding:10px 12px;font-size:12px}}
@media(max-height:680px){.chat-main .welcome{padding:0 0 12px}.chat-main .welcome img{width:62px;height:62px;margin-bottom:5px}.chat-main .welcome h1{font-size:20px;margin-bottom:5px}.chat-main .welcome p{font-size:11px}.chat-main .messages{padding-top:5px;padding-bottom:8px}.chat-main .composer{max-height:calc(100% - 90px)}}
@media(prefers-reduced-motion:no-preference){.chat-sidebar{animation:sidebar-arrive .16s ease-out}@keyframes sidebar-arrive{from{opacity:.5;transform:translateX(-8px)}to{opacity:1;transform:translateX(0)}}}

/* Voice and text share one composer; no separate voice screen entry. */
.chat-main .composer form .inline-voice-tools{order:initial;padding:7px 2px 0;margin-top:5px;border-top:1px solid var(--shell-line)}.chat-main .composer form .inline-voice-tools label,.chat-main .composer form .inline-voice-tools button{font-size:12px;min-height:40px}.chat-main .composer form .inline-voice-feedback{order:initial}.chat-main .composer-actions #voice-open{display:inline-flex;align-items:center;background:#15349B;color:white;border-radius:14px;padding-inline:12px}

/* Direct WebRTC voice stays in this conversation; typing returns to its text. */
.chat-main .conversation-stage{position:relative}.chat-main #messages[hidden],.voice-conversation[hidden]{display:none!important}
.voice-conversation.voice-inline{position:relative;inset:auto;width:100%;height:100%;max-height:none;overflow:auto;background:transparent;border:0;color:inherit}
.voice-inline .voice-screen{padding:10px max(16px,calc((100% - 680px)/2));min-height:100%;height:100%;gap:10px;overflow:auto}
.voice-inline .voice-brand{display:none}.voice-inline .voice-top{justify-content:flex-end}.voice-inline .voice-hero{min-height:90px}.voice-inline .voice-robot{width:min(27dvh,220px)}
.voice-inline .voice-controls{gap:6px}.voice-inline .voice-controls button{padding:9px 11px;min-height:42px}.voice-inline .voice-captions{max-height:17dvh}.voice-inline .voice-status{font-size:22px}.voice-inline .voice-notice{font-size:10px}.voice-inline .voice-error{padding:9px 12px}.voice-inline .voice-readiness{inset:0}
.chat-main .voice-fallback-tools{margin:8px 3px 0;border-top:1px solid var(--shell-line);padding:5px 0 0}.voice-fallback-tools>summary{font-size:11px;color:var(--muted);cursor:pointer;min-height:28px;display:flex;align-items:center}.chat-main .voice-fallback-tools .inline-voice-tools{border:0;margin:0}
.chat-main.direct-voice-open .inline-voice-context,.chat-main.direct-voice-open .inline-voice-privacy,.chat-main.direct-voice-open .voice-fallback-tools{display:none}
@media(max-height:680px){.voice-inline .voice-screen{gap:7px;padding-block:4px}.voice-inline .voice-hero{min-height:56px}.voice-inline .voice-robot{width:min(19dvh,125px)}.voice-inline .voice-status{font-size:19px}.voice-inline .voice-top-actions button{min-height:36px;padding:6px 9px}.voice-inline .voice-notice{font-size:9px}}
@media(max-height:450px){.voice-inline .voice-hero{display:none}.voice-inline .voice-screen{height:auto}.voice-inline .voice-notice{display:none}}

/* Fill the remaining conversation area without stretching the original artwork.
   The image and 540px motion canvas both keep object-fit:contain. Controls and
   the composer reserve their own space before the hero receives the remainder. */
.chat-main .welcome{height:100%;min-height:0}
.chat-main .welcome img{flex:1 1 0;width:100%;height:0;min-height:0;max-height:none;object-fit:contain}
.chat-main .welcome h1,.chat-main .welcome p{flex-shrink:0}
.voice-inline .voice-hero{flex:1 1 0;min-height:0;overflow:hidden}
.voice-inline .voice-robot{position:absolute;inset:0;width:100%;height:100%;max-height:none;aspect-ratio:auto;flex:none}
.voice-inline .voice-robot .mxv-mascot,.voice-inline .voice-robot .mxv-motion-canvas{object-fit:contain}
@media(max-height:450px){.voice-inline .voice-hero{display:flex}.voice-inline .voice-screen{height:100%;min-height:100%}}

/* The screen already has a centered max-width; avoid applying a second
   viewport-based inset that unnecessarily limits the desktop hero. */
.voice-inline .voice-screen{padding-inline:16px}
@media(max-width:360px){.voice-inline .voice-controls button{padding-inline:8px}}

/* On a short landscape display, let the robot use the full height beside
   status/controls instead of competing with them in a vertical stack. */
@media(max-height:450px) and (min-width:600px){
 .chat-main .welcome{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.8fr);grid-template-rows:1fr 1fr;column-gap:16px;padding:0}
 .chat-main .welcome img{grid-column:1;grid-row:1/3;width:100%;height:100%;margin:0}
 .chat-main .welcome h1{grid-column:2;grid-row:1;align-self:end;margin:0 0 4px}
 .chat-main .welcome p{grid-column:2;grid-row:2;align-self:start}
 .voice-inline .voice-screen{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.8fr);grid-template-rows:auto auto auto minmax(0,1fr) auto;gap:4px 12px}
 .voice-inline .voice-hero{grid-column:1;grid-row:1/6;align-self:stretch}
 .voice-inline .voice-top{grid-column:2;grid-row:1}
 .voice-inline .voice-status{grid-column:2;grid-row:2}
 .voice-inline .voice-hint{grid-column:2;grid-row:3;font-size:12px;margin:0}
 .voice-inline .voice-captions,.voice-inline .voice-error,.voice-inline .voice-proposal{grid-column:2;grid-row:4;min-height:0;max-height:none;overflow:auto;padding:4px 8px;margin:0}
 .voice-inline .voice-error,.voice-inline .voice-proposal{min-height:26px}
 .voice-inline .voice-bottom{grid-column:2;grid-row:5;flex-direction:row;flex-wrap:wrap;justify-content:center;gap:4px}
 .voice-inline .voice-start{padding:9px 12px;font-size:14px;min-height:40px}
}

.chat-main .conversation-welcome {
  display: flex;
  height: auto;
  min-height: 100%;
  align-items: stretch;
  justify-content: flex-start;
  gap: 24px;
  width: min(100%, 520px);
  margin-inline: auto;
  padding: clamp(30px, 9dvh, 80px) 0 22px;
  text-align: left;
}

.chat-main .conversation-welcome .welcome-eyebrow {
  margin-bottom: 9px;
  font-size: 13px;
  letter-spacing: .04em;
}

.chat-main .conversation-welcome h1 {
  margin: 0 0 8px;
  font-size: clamp(24px, 6.5vw, 38px);
  line-height: 1.28;
}

.chat-main .conversation-welcome p { max-width: none; }
.welcome-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.welcome-actions button {
  min-height: 44px;
  padding: 9px 12px;
  border: 1px solid var(--shell-line);
  border-radius: 14px;
  background: var(--shell-soft);
  color: var(--shell-ink);
  text-align: left;
  white-space: normal;
}
.welcome-actions button:hover:not(:disabled) { background: var(--shell-hover); }
.welcome-actions #welcome-history { grid-column: 1 / -1; display: grid; gap: 4px; padding: 12px; }
.welcome-actions small { color: var(--muted); font-size: 12px; }

.chat-main.chained-voice-open > .app-header,
.chat-main.chained-voice-open > .composer { display: none; }

@media (max-height: 680px) {
  .chat-main .conversation-welcome { gap: 13px; padding-block: 9px; }
}
