:root {
  color-scheme: light;
  --canvas: #e9eff5;
  --surface: #f1f5f9;
  --ink: #22374d;
  --muted: #51687d;
  --line: #cdd8e3;
  --blue: #24588f;
  --radius: 24px;
  --raised: 8px 8px 22px #b9c6d5aa, -7px -7px 20px #fcfdff;
  --edge: inset 0 1px 1px #fff, inset 0 -1px 1px #bbc9d680;
  --pressed: inset 3px 3px 7px #bac8d6, inset -3px -3px 7px #fcfdff;
  --key: 3px 4px 8px #b4c2d1aa, -3px -3px 8px #fcfdff, var(--edge);
  font: 15px/1.65 "Segoe UI","Microsoft YaHei UI","PingFang SC",sans-serif;
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box }
body { margin: 0; background: var(--canvas); color: var(--ink) }
[hidden] { display: none !important }
button,input,textarea { font: inherit; color: inherit; min-width: 0 }
button,.attach { border: 0; background: none; cursor: pointer; touch-action: manipulation }
button,.attach,a { -webkit-tap-highlight-color: transparent }
button,.attach { transition: background .15s,box-shadow .15s,transform .15s }
button:disabled { cursor: wait; opacity: .58 }
:where(a,button,input,textarea):focus-visible,.attach:focus-within {
  outline: 3px solid #467db5; outline-offset: 3px;
}
a { color: var(--blue); text-underline-offset: .2em }
.card details { margin: 12px 0; color: var(--muted) }
.card summary { width: fit-content; color: var(--blue); cursor: pointer }
.card details ol { padding-inline-start: 25px; max-height: 18em; overflow-y: auto }
.job-progress { display: flex; align-items: center; gap: 12px; margin-top: 10px; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums }
.job-progress progress { flex: 1; height: 8px; min-width: 0; accent-color: var(--blue) }
h1,h2,h3,p { margin: 0 }
h1 { font-size: clamp(26px,3vw,42px); line-height: 1.32; letter-spacing: -.035em }
::selection { background: #c1d8ee }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; border: 0; overflow: hidden; clip-path: inset(50%) }

.primary {
  border: 1px solid #356695; border-radius: 14px; font-weight: 700;
  padding: 9px 21px; color: #fff; background: linear-gradient(155deg,#4e7fab,#2c6095 76%);
  box-shadow: 3px 4px 9px #7089a566, -2px -2px 6px #fff, inset 0 1px 1px #a5c3de, inset 0 -2px 2px #194875;
}
.primary:hover:enabled { background: linear-gradient(155deg,#5489ba,#285981 82%) }
.primary:active:enabled { transform: translateY(1px); box-shadow: inset 2px 3px 6px #194875,inset -1px -1px 4px #6393be }
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 22px }
.login-card,.card,#welcome,.bubble.assistant {
  border: 1px solid #faffff; border-radius: var(--radius); background: var(--surface);
  box-shadow: var(--raised),var(--edge);
}
.login-card { width: min(100%,410px); padding: 38px }
.product { margin: 12px 0 24px; font-weight: 750; color: var(--blue) }
.login-card h1,#panel h1 { font-size: 29px }
.login-card form { display: grid; gap: 14px; margin: 24px 0 12px }
.login-card label { display: grid; gap: 5px; font-size: 14px }
.login-card input { border: 0; border-radius: 13px; background: var(--canvas); box-shadow: var(--pressed); padding: 11px 15px }
.text-btn,.link { color: var(--blue); font-weight: 600 }
[role=alert] { color: #8c402c }

#shell { height: 100dvh; display: grid; grid-template-columns: clamp(220px,18vw,270px) minmax(0,1fr) }
#sidebar {
  min-height: 0; display: flex; flex-direction: column; gap: 0; padding: 27px 20px 19px;
  background: linear-gradient(150deg,#e8eef5,#dfe8f1);
  border-right: 1px solid #c4d0dd; box-shadow: inset -1px 0 0 #f7fbff;
}
.brand { display: flex; gap: 12px; align-items: center; padding: 0 5px; font-size: 22px; font-weight: 800; letter-spacing: -.03em }
.brand img,.mark {
  padding: 6px; width: 43px; height: 43px; border-radius: 14px;
  background: linear-gradient(145deg,#fcfdff,#d8e4ef); box-shadow: var(--key);
}
.new,.examples button,.attach,.link,#menu,#logout,.chip {
  background: var(--surface); box-shadow: var(--key); border: 1px solid #f5faff; border-radius: 12px;
}
.new { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 45px; margin: 28px 1px 24px; color: var(--blue); font-weight: 750 }
.new span,.attach span { font-size: 18px; line-height: 1 }
nav { display: grid; gap: 4px }
nav button,#history button { text-align: left; min-height: 39px; padding: 7px 13px; border-radius: 11px }
nav button:hover,#history button:hover { background: #eaf1f7 }
nav button[aria-current="page"],#history .selected { background: #dce7f1; color: #234d78; box-shadow: var(--pressed); font-weight: 650 }
.side-label { margin: 29px 13px 8px; color: var(--muted); font-size: 12px; font-weight: 650 }
#history { overflow-y: auto; padding: 3px }
#history button { width: 100%; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px }
footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: auto; padding: 16px 4px 0; font-size: 13px; border-top: 1px solid #cbd7e2 }
#account { overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
#logout { padding: 4px 10px; flex: none }
main { display: flex; flex-direction: column; min-width: 0; min-height: 0 }
header { display: flex; align-items: center; flex: none; gap: 14px; min-height: 76px; padding: 12px clamp(20px,4vw,52px); border-bottom: 1px solid var(--line); box-shadow: 0 1px 0 #f7fbff }
.header-title { display: flex; align-items: center; gap: 15px }
.context { font-size: 13px; color: var(--muted); padding-right: 15px; border-right: 1px solid #b6c6d5 }
#page-name { font-size: 20px; letter-spacing: -.025em }
#menu { display: none; width: 38px; height: 38px; padding: 10px }
#menu i,#menu i:before,#menu i:after { display: block; width: 16px; height: 2px; background: var(--blue); border-radius: 5px }
#menu i { position: relative }
#menu i:before,#menu i:after { content: ''; position: absolute; left: 0; top: -5px }
#menu i:after { top: 5px }

#chat { flex: 1; min-height: 0; display: flex; flex-direction: column }
#scroll { flex: 1; min-height: 0; overflow: auto; scrollbar-gutter: stable; padding: 28px max(5%,calc((100% - 830px)/2)) 12px }
#welcome { position: relative; margin: clamp(22px,6vh,64px) auto 32px; padding: clamp(24px,4vw,44px); max-width: 760px }
.mark { display: grid; place-items: center; width: 70px; height: 70px; margin-bottom: 25px; border-radius: 21px; box-shadow: var(--raised),var(--edge) }
#welcome p { color: var(--muted); margin: 12px 0 23px }
.examples { display: flex; flex-wrap: wrap; gap: 12px }
.examples button { padding: 10px 15px; font-size: 14px; font-weight: 650 }
.examples span { color: var(--blue); margin-left: 7px }
#messages { display: flex; flex-direction: column; gap: 22px }
.bubble { min-width: 0; overflow-wrap: anywhere }
.who { display: flex; align-items: center; gap: 9px; font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 7px }
.user {
  align-self: flex-end; max-width: min(86%,680px); padding: 13px 19px 15px;
  border-radius: 21px 21px 8px 21px; border: 1px solid #eff7ff;
  background: linear-gradient(135deg,#e2edf7,#d4e3f2);
  box-shadow: 4px 5px 11px #bbc9d8aa,-3px -3px 9px #fbfdff,var(--edge);
}
.user .who { color: #426384 }
.user .message-content,.system .message-content { white-space: pre-wrap }
.bubble.assistant { align-self: stretch; padding: clamp(16px,2.6vw,27px); }
.assistant .who { color: #2c557c; margin-bottom: 14px }
.assistant .who:before {
  content: ''; width: 26px; height: 26px; border-radius: 9px; flex: none;
  background: url('/logo.svg') center/19px no-repeat,linear-gradient(145deg,#fff,#d9e5ee);
  box-shadow: var(--key);
}
.assistant .message-content { line-height: 1.8 }
.message-content :is(h1,h2,h3,h4) { font-size: 1.12em; margin: 1.1em 0 .4em; line-height: 1.5 }
.message-content h1 { font-size: 1.28em }
.message-content p+p,.message-content :is(ul,ol,blockquote,pre,.table-scroll) { margin: .65em 0 }
.message-content :first-child { margin-top: 0 }
.message-content :last-child { margin-bottom: 0 }
.message-content ul,.message-content ol { padding-left: 1.5em }
.message-content blockquote { margin-left: 0; padding-left: 13px; border-left: 3px solid #9bb4ca; color: var(--muted) }
.message-content pre,.message-content code { font: .9em/1.6 Consolas,monospace; background: #e2eaf1; border-radius: 5px }
.message-content pre { overflow: auto; padding: 12px }
.message-content code { padding: 1px 4px }
.table-scroll { overflow: auto; max-width: 100%; border-radius: 12px; border: 1px solid var(--line) }
.message-content table { border-collapse: collapse; width: 100%; min-width: min(360px,100%); font-size: .93em }
.message-content :is(td,th) { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line) }
.message-content th { background: #e0eaf3; color: #324f68 }
.message-content hr { border: 0; border-top: 1px solid var(--line); margin: 1em 0 }
.system,.pending { align-self: flex-start; font-size: 13px; color: var(--muted) }
.system { padding: 0 14px; border-left: 3px solid #adc2d5; margin-left: 4px }
.system .who { margin-bottom: 3px }
.pending { padding: 0 5px }
#composer {
  flex: none; width: min(90%,830px); margin: 18px auto max(20px,env(safe-area-inset-bottom));
  padding: 12px; border: 1px solid #fcfdff; border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--raised),var(--edge);
}
#prompt {
  display: block; width: 100%; padding: 12px 15px; min-height: 61px; resize: vertical; max-height: 23dvh;
  border: 0; border-radius: 15px; background: #e8eef5; box-shadow: var(--pressed); line-height: 1.55;
}
#prompt::placeholder { color: #5e7387 }
#prompt:focus-visible { outline-width: 2px; outline-offset: 0 }
.compose-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 11px 2px 0 }
.attach { display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-height: 39px; padding: 6px 14px; color: #3e5972; font-size: 13px; font-weight: 650 }
#send { min-width: 85px; min-height: 40px; padding: 7px 18px }
:is(.new,.examples button,.attach,.link,#menu,#logout,.chip):active { box-shadow: var(--pressed); transform: translateY(1px) }
.chip { margin: 0 5px 8px 0; padding: 3px 8px; font-size: 12px }
.card { margin: 19px 0; padding: 20px 23px }
.card :is(p,strong) { display: block; margin-bottom: 7px }
.card .primary { margin-top: 6px }
#panel { overflow: auto; padding: clamp(18px,4vw,48px); width: min(100%,980px) }
#panel h1 { margin-bottom: 23px }
.plugin { display: flex; justify-content: space-between; align-items: center; gap: 16px }
.plugin p { margin-bottom: 0; font-size: 14px; color: var(--muted) }
.link { flex: none; padding: 7px 14px }
.link[aria-checked=true] { background: #dfebf6; box-shadow: var(--pressed) }
#error { align-self: center; max-width: 90%; font-size: 13px }
#error:not(:empty) { padding: 6px 0 }
@media(max-width:760px) {
  #shell { grid-template-columns: minmax(0,1fr) }
  #sidebar { display: none }
  #sidebar.open { display: flex; position: fixed; inset: 0 auto 0 0; width: min(78%,280px); z-index: 5; box-shadow: 12px 0 35px #253c5633 }
  #menu { display: grid; place-items: center }
  header { min-height: 60px; padding: 9px 16px }
  #page-name { font-size: 18px }
  #scroll { padding: 19px 16px 10px; scrollbar-gutter: auto }
  #messages { gap: 18px }
  .user { max-width: 90%; padding: 11px 15px 13px }
  .bubble.assistant,.card { border-radius: 19px }
  #composer { width: calc(100% - 26px); margin: 12px auto max(12px,env(safe-area-inset-bottom)); padding: 10px }
  #welcome { margin: 14px auto 28px }
  #prompt { min-height: 54px }
  .compose-actions { margin-top: 9px }
  .login-card { padding: 28px }
}
@media(prefers-reduced-motion:reduce) { *,*:before,*:after { transition: none !important; scroll-behavior: auto !important } }

