:root {
  --purple: #4f46a5;
  --purple-deep: #39317f;
  --purple-pale: #f7f5ff;
  --ink: #26242d;
  --muted: #6c6875;
  --line: #e6e2ef;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: #fff;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overflow: hidden; }
body { font-size: 14px; line-height: 1.6; }
button, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }
button, select { -webkit-tap-highlight-color: transparent; }
button:focus-visible, select:focus-visible, textarea:focus-visible, .message-scroller:focus-visible { outline: 3px solid #b7afe8; outline-offset: 3px; }
[hidden] { display: none !important; }
p, h1, h2 { margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.beta-shell { height: var(--beta-height, 100dvh); display: flex; flex-direction: column; overflow: hidden; }
.beta-header { position: sticky; top: 0; z-index: 2; display: flex; flex: 0 0 auto; align-items: center; justify-content: space-between; gap: 16px; padding: 16px max(20px, env(safe-area-inset-left)); border-bottom: 1px solid var(--line); background: #fff; }
.brand, .header-actions { display: flex; align-items: center; gap: 16px; min-width: 0; }
.brand img { display: block; width: 160px; height: auto; }
.brand-copy { padding-left: 16px; border-left: 1px solid var(--line); }
h1 { font-size: 17px; font-weight: 650; line-height: 1.4; }
.brand-copy p { color: var(--muted); font-size: 11px; }
.beta-label { color: var(--purple-deep); padding: 3px 8px; border-radius: 6px; background: var(--purple-pale); font-size: 12px; white-space: nowrap; }
.quiet-button { min-height: 36px; padding: 6px 11px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--muted); }
.quiet-button:hover { border-color: #c5bde8; color: var(--purple); background: var(--purple-pale); }

.chat-layout { display: flex; flex: 1 1 0; flex-direction: column; min-height: 0; width: min(100%, 860px); margin: 0 auto; }
.connection-strip { display: flex; flex: 0 0 auto; flex-wrap: wrap; justify-content: space-between; gap: 3px 16px; padding: 10px 24px; font-size: 11px; color: var(--muted); border-bottom: 1px solid #f0edf6; }
.connection-strip .is-error { color: #9d3e4a; }
.message-scroller { flex: 1 1 0; min-height: 0; padding: 24px; overflow-y: auto; overscroll-behavior: contain; overflow-wrap: anywhere; }
.empty-state { max-width: 520px; margin: 8vh auto 0; text-align: center; }
.empty-mark { display: inline-grid; width: 44px; height: 44px; margin-bottom: 18px; place-items: center; color: var(--purple); background: #eeecff; border-radius: 14px; font-size: 24px; font-weight: 650; }
h2 { margin-bottom: 12px; font-size: clamp(20px, 3vw, 25px); font-weight: 600; }
.empty-state p { color: var(--muted); font-size: 13px; }
.empty-state .executor-note { margin-top: 18px; font-size: 11px; }
.messages { display: flex; flex-direction: column; gap: 22px; }
.message { max-width: 92%; }
.message.user { align-self: flex-end; }
.message.assistant { align-self: flex-start; }
.message-meta { padding: 0 2px 4px; color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.message.user .message-meta { text-align: right; }
.message-text { padding: 12px 15px; border: 1px solid var(--line); border-radius: 12px; background: #fff; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.75; }
.message.user .message-text { color: var(--purple-deep); border-color: #ded9f6; background: var(--purple-pale); }
.message.failed .message-meta { color: #9d3e4a; }

.composer { flex: 0 0 auto; padding: 0 24px max(16px, env(safe-area-inset-bottom)); background: #fff; }
.request-status { max-height: 16vh; margin: 0 0 8px; overflow-y: auto; overflow-wrap: anywhere; color: var(--muted); font-size: 12px; }
.request-status:empty { margin: 0; }
.request-status.is-error { color: #9d3e4a; }
.composer-box { padding: 10px 12px; border: 1px solid #d9d5eb; border-radius: 14px; background: #fff; box-shadow: 0 4px 18px rgba(48, 43, 78, .04); }
.composer-box:focus-within { border-color: #a79fd7; }
textarea { display: block; width: 100%; min-height: 50px; max-height: min(120px, 20dvh); padding: 3px 2px; border: 0; background: transparent; color: var(--ink); resize: none; overflow-y: auto; line-height: 1.5; }
textarea:focus-visible { outline-offset: 0; }
textarea::placeholder { color: #8c8799; }
.composer-controls { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 8px; }
.provider-label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; }
select { width: auto; max-width: 150px; min-height: 36px; padding: 4px 8px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--purple-deep); font-size: 12px; }
.send-actions { display: flex; align-items: center; gap: 6px; }
.send-button { min-height: 36px; padding: 6px 17px; border: 1px solid var(--purple); border-radius: 8px; color: #fff; background: var(--purple); font-weight: 600; }
.send-button:hover:not(:disabled) { background: var(--purple-deep); }
.composer-hint { margin-top: 7px; font-size: 10px; color: var(--muted); }
.privacy-notice { margin-top: 5px; font-size: 11px; line-height: 1.5; color: var(--muted); }
noscript { position: fixed; bottom: 0; padding: 12px; background: #fff4dc; }

@media (max-width: 600px) {
  .beta-header { padding: 10px max(12px, env(safe-area-inset-left)); gap: 8px; }
  .brand { gap: 8px; }
  .brand img { width: 120px; }
  .brand-copy { display: none; }
  .header-actions { flex-direction: column; align-items: flex-end; gap: 4px; }
  .beta-label { padding: 0 4px; font-size: 10px; }
  .header-actions .quiet-button { min-height: 30px; padding: 3px 8px; font-size: 12px; }
  .connection-strip { padding: 7px 14px; font-size: 10px; }
  .message-scroller { padding: 18px 14px; }
  .empty-state { margin-top: 4vh; }
  .message { max-width: 96%; }
  .composer { padding: 0 12px max(10px, env(safe-area-inset-bottom)); }
  textarea { font-size: 16px; }
  .composer-hint { display: none; }
  .privacy-notice { font-size: 10px; }
  .provider-label { gap: 4px; }
  .composer-box { padding: 8px 10px; }
}

@media (max-height: 500px) {
  .beta-header { padding-top: 6px; padding-bottom: 6px; }
  .connection-strip { padding-top: 4px; padding-bottom: 4px; }
  .empty-state { margin-top: 0; }
  .composer { padding-bottom: max(6px, env(safe-area-inset-bottom)); }
  textarea { min-height: 32px; height: 32px; }
  .composer-hint { display: none; }
}

/* Account authentication and message-only retention stay inside the beta page. */
.settings-link { text-decoration: none; white-space: nowrap; }
.header-actions { gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.conversation-toolbar { display: flex; flex: 0 0 auto; gap: 7px; align-items: center; padding: 8px 24px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.conversation-toolbar select { flex: 1 1 150px; max-width: none; min-width: 100px; }
.conversation-toolbar button { font-size: 12px; }
.login-panel { flex: 0 0 auto; padding: 14px 24px; max-height: 42dvh; overflow-y: auto; border-bottom: 1px solid var(--line); background: var(--purple-pale); }
.login-panel form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.login-panel label { font-size: 12px; color: var(--muted); }
.login-panel input { flex: 1 1 140px; min-width: 100px; max-width: 260px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font: inherit; }
.login-hint, .login-panel .request-status { flex-basis: 100%; font-size: 11px; }
.login-panel .request-status { margin: 0; }
@media (max-width: 600px) {
  .header-actions { flex-direction: row; gap: 5px; max-width: 250px; }
  .header-actions .settings-link { font-size: 11px; padding: 3px 7px; min-height: 30px; }
  .conversation-toolbar { padding: 7px 12px; gap: 5px; }
  .conversation-toolbar button { min-height: 32px; padding: 3px 7px; font-size: 11px; }
  .login-panel { padding: 10px 12px; }
  .login-panel input { font-size: 16px; }
  .privacy-notice { max-height: 64px; overflow-y: auto; }
}
