:root {
  color-scheme: light;
  --bg: #fff;
  --rail: #f1f3f8;
  --plate: #f7f8fb;
  --ink: #20263a;
  --dim: #586276;
  --edge: #dce1eb;
  --key: #404f7d;
  --keyfg: white;
  --wash: #e8ecf7;
  --bubble: #edf0f8;
  --fs: 16px;
  --line: 1px solid var(--edge);
  font:
    14px/1.5 Inter,
    "Segoe UI Variable",
    "Microsoft YaHei UI",
    sans-serif;
  color: var(--ink);
  background: var(--bg);
}
:root.dark {
  color-scheme: dark;
  --bg: #191d26;
  --rail: #151922;
  --plate: #232936;
  --ink: #edf0f6;
  --dim: #a3adbf;
  --edge: #373e50;
  --key: #a9bdf7;
  --keyfg: #172443;
  --wash: #30394f;
  --bubble: #323b51;
}
* {
  box-sizing: border-box;
}
body,
h1,
h2,
h3,
p {
  margin: 0;
}
body {
  height: 100vh;
  overflow: hidden;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
  background: transparent;
  border: 0;
  border-radius: 9px;
  padding: 8px 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  line-height: 1.4;
}
button:hover {
  background: var(--wash);
}
button:disabled {
  opacity: 0.45;
  cursor: default;
}
button:focus-visible,
a:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--key);
  outline-offset: 2px;
}
input,
textarea,
select {
  background: var(--bg);
  border: var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  min-width: 0;
}
input:focus,
textarea:focus,
select:focus {
  outline: 2px solid var(--key);
  outline-offset: -1px;
}
input::placeholder,
textarea::placeholder {
  color: var(--dim);
}
label {
  display: grid;
  gap: 6px;
  margin: 14px 0;
  color: var(--dim);
  font-size: 13px;
}
label input,
label select,
label textarea {
  color: var(--ink);
  width: 100%;
}
textarea {
  resize: vertical;
}
i[data-icon],
svg.icon {
  display: inline-flex;
  width: 19px;
  height: 19px;
  flex: none;
  vertical-align: middle;
}
svg.icon {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.primary,
.send {
  background: var(--key);
  color: var(--keyfg);
  font-weight: 600;
}
.primary:hover,
.send:hover {
  background: color-mix(in srgb, var(--key) 88%, var(--ink));
}
.wide {
  width: 100%;
  padding: 11px;
}
.subtle,
.keys,
.muted,
small {
  color: var(--dim);
}
.square {
  width: 35px;
  height: 35px;
  padding: 6px;
}
.controls,
.inline,
.authlinks,
.actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.inline > * {
  flex: 1;
}
.inline > button {
  flex: none;
}
.seg {
  display: flex;
  border-bottom: var(--line);
  margin: 12px 0 20px;
  gap: 15px;
}
.seg button {
  border-radius: 0;
  padding: 7px 0;
  color: var(--dim);
}
.seg .on {
  border-bottom: 2px solid var(--key);
  color: var(--ink);
  font-weight: 600;
}
.error {
  min-height: 1.5em;
  color: #b24b40;
  font-size: 13px;
}
.dark .error {
  color: #ffaaa2;
}
#login {
  height: 100%;
  display: grid;
  grid-template-columns: minmax(280px, 0.83fr) 1.17fr;
}
.brandpanel {
  background: #283454;
  color: #f3f4fc;
  display: flex;
  position: relative;
  overflow: hidden;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(30px, 4vw, 64px);
}
.brandword {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -1.5px;
}
.brandword span {
  font-size: 14px;
  letter-spacing: 0.01em;
  font-weight: 400;
  color: #c9d3e7;
}
.portrait {
  position: relative;
  display: grid;
  place-items: center;
  margin: 25px 0;
}
.portrait:before,
.portrait:after {
  content: "";
  position: absolute;
  aspect-ratio: 1;
  width: min(26vw, 330px);
  border: 1px solid #5e6c89;
  transform: rotate(12deg);
  border-radius: 28%;
}
.portrait:after {
  transform: rotate(-11deg);
  width: min(30vw, 370px);
  border-color: #455471;
}
.portrait img {
  width: min(22vw, 265px);
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 25%;
  z-index: 1;
}
.brandfoot span {
  font-size: 25px;
  font-weight: 600;
}
.brandfoot p {
  color: #c7cedf;
  margin-top: 8px;
  font-size: 14px;
}
.authpane {
  position: relative;
  display: grid;
  place-items: center;
  padding: 30px;
}
.authpane form {
  width: min(100%, 365px);
}
h1 {
  font-size: 32px;
  letter-spacing: -0.04em;
  font-weight: 650;
}
.authlinks {
  justify-content: space-between;
  margin-top: 12px;
}
.authlinks button,
.footbtn {
  color: var(--dim);
  font-size: 13px;
}
.footbtn {
  position: absolute;
  bottom: 14px;
  right: 16px;
}
#workspace {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  height: 100%;
}
#workspace.fold {
  grid-template-columns: 0 minmax(0, 1fr);
}
#workspace.fold aside {
  visibility: hidden;
}
#rail {
  background: var(--rail);
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 24px 14px 12px;
  border-right: var(--line);
  overflow: hidden;
}
.railbrand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 3px 8px 28px;
  font-size: 23px;
  letter-spacing: -1px;
}
.railbrand img,
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  object-fit: cover;
}
.wide kbd {
  margin-left: auto;
}
kbd {
  font:
    10px/1.45 "Segoe UI",
    sans-serif;
  opacity: 0.8;
  border: 1px solid currentColor;
  padding: 1px 4px;
  border-radius: 4px;
  white-space: nowrap;
}
#newchat {
  justify-content: flex-start;
}
.search {
  margin: 17px 0 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 4px;
  color: var(--dim);
}
.search input {
  width: 0;
  flex: 1;
  border: 0;
  background: transparent;
  padding: 4px;
}
.search svg {
  width: 16px;
}
#history {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}
.group {
  font-size: 12px;
  font-weight: 600;
  color: var(--dim);
  margin: 17px 8px 5px;
}
.room {
  width: 100%;
  text-align: left;
  justify-content: flex-start;
  font-size: 13px;
}
.room span {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.on,
.room.active {
  color: var(--key);
  background: var(--wash);
}
.prof {
  border-top: var(--line);
  border-radius: 0;
  justify-content: flex-start;
  padding: 14px 2px 2px;
  margin-top: 8px;
}
.prof > span:nth-child(2) {
  flex: 1;
  text-align: left;
  min-width: 0;
}
.prof strong,
.prof small {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.avatar {
  display: grid;
  place-items: center;
  background: var(--wash);
  color: var(--key);
  font-weight: bold;
}
.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}
#stage {
  display: flex;
  flex-direction: column;
  height: 100vh;
  min-width: 0;
  position: relative;
  background: var(--bg);
}
.top {
  height: 64px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  border-bottom: var(--line);
}
.modelbtn {
  font-size: 16px;
}
.modelbtn svg {
  width: 14px;
}
.top .controls {
  gap: 2px;
}
#temp {
  color: var(--dim);
  font-size: 13px;
}
#scroll {
  overflow: auto;
  min-height: 0;
  flex: 1;
  scrollbar-gutter: stable;
}
.measure {
  width: min(calc(100% - 64px), 810px);
  margin: 0 auto;
}
#messages {
  padding: 24px 0 16px;
}
#empty {
  text-align: center;
  margin: 0 auto 22px;
}
#empty img {
  width: 59px;
  height: 59px;
  object-fit: cover;
  border-radius: 19px;
  margin-bottom: 8px;
}
#empty h1 {
  font-size: clamp(23px, 3vw, 36px);
  font-weight: 600;
  letter-spacing: -0.05em;
}
#stage.empty #scroll {
  display: none;
}
#stage.empty #empty {
  margin-top: auto;
}
#stage.empty #composerWrap {
  margin-bottom: auto;
}
#stage:not(.empty) #empty {
  display: none;
}
#composerWrap {
  padding: 8px 0 14px;
}
.composer {
  border: 1px solid color-mix(in srgb, var(--edge) 82%, var(--dim));
  border-radius: 18px;
  background: var(--plate);
  padding: 12px;
}
.composer:focus-within {
  border-color: var(--key);
}
#draft {
  display: block;
  width: 100%;
  max-height: 175px;
  resize: none;
  outline: 0;
  border: 0;
  background: transparent;
  padding: 1px 4px 7px;
  font-size: 16px;
}
.composerbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.composerbar button {
  font-size: 13px;
  color: var(--dim);
}
.composerbar .on {
  color: var(--key);
}
.composerbar .send {
  color: var(--keyfg);
  border-radius: 50%;
}
.keys {
  display: block;
  text-align: center;
  font-size: 11px;
  margin-top: 7px;
}
#attachments,
#modebar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
#modebar {
  align-items: center;
  margin: 0 0 5px;
  color: var(--dim);
}
#attachments {
  max-height: 8rem;
  overflow-y: auto;
}
#mail-hint { color: var(--dim); }
#announcement-dialog { max-width: min(440px, 92vw); max-height: 80dvh; overflow-y: auto; padding: 24px; }
#announcement-title { margin: 6px 0 12px; overflow-wrap: anywhere; }
#announcement-text { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0 0 20px; }
.chip {
  display: inline-flex;
  align-items: center;
  background: var(--wash);
  border-radius: 8px;
  padding: 3px 7px;
  font-size: 12px;
  gap: 4px;
}
.msg {
  margin: 14px 0 25px;
}
.msg.user {
  margin-left: auto;
  width: fit-content;
  max-width: 85%;
}
.bubble {
  background: var(--bubble);
  padding: 10px 15px;
  border-radius: 15px 15px 4px 15px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: var(--fs);
}
.by {
  display: flex;
  gap: 8px;
  align-items: center;
  font-weight: 650;
  margin-bottom: 10px;
}
.by img {
  width: 24px;
  height: 24px;
  border-radius: 8px;
}
.by small,
.metrics {
  font-size: 11px;
  font-weight: 400;
}
.actions {
  flex-wrap: wrap;
  color: var(--dim);
  margin-top: 7px;
}
.actions .square {
  width: 28px;
  height: 28px;
}
.actions svg {
  width: 15px;
  height: 15px;
}
.user .actions {
  justify-content: flex-end;
}
.rich {
  font-size: var(--fs);
  line-height: 1.72;
  overflow-wrap: anywhere;
}
.rich :is(p, ol, ul, blockquote, section, table) {
  margin: 0 0 0.65em;
}
.rich h1 {
  font-size: 1.6em;
}
.rich h2 {
  font-size: 1.35em;
}
.rich h3 {
  font-size: 1.15em;
}
.rich a {
  color: var(--key);
}
.rich blockquote,
.quoted {
  border-left: 3px solid var(--key);
  padding-left: 10px;
  color: var(--dim);
}
.rich section {
  border: var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: var(--plate);
}
.rich section header {
  display: flex;
  justify-content: space-between;
  padding: 2px 8px;
  align-items: center;
  border-bottom: var(--line);
  font-size: 12px;
}
.rich pre {
  padding: 10px 13px;
  white-space: pre;
  overflow: auto;
  margin: 0;
}
.rich table {
  border-collapse: collapse;
}
.rich td,
.rich th {
  border: var(--line);
  padding: 4px 9px;
}
.table-scroll,
.katex-display,
eqn {
  display: block;
  overflow-x: auto;
}
.rich code {
  font-family: Consolas, monospace;
}
.hljs-keyword,
.hljs-title {
  color: #8352ad;
}
.hljs-string,
.hljs-attr {
  color: #49846d;
}
.hljs-number,
.hljs-literal {
  color: #af6741;
}
.rich img,
.assetimg {
  max-width: 100%;
  max-height: 350px;
  border-radius: 12px;
}
.sources {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}
.sources a,
.filelink {
  font-size: 12px;
  display: inline-flex;
  padding: 3px 8px;
  text-decoration: none;
  color: var(--key);
  background: var(--wash);
  border-radius: 6px;
}
.metrics {
  color: var(--dim);
}
details {
  margin: 8px 0;
}
summary {
  cursor: pointer;
  font-weight: 550;
}
.preline {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.think {
  color: var(--dim);
  font-size: 13px;
}
dialog {
  background: var(--bg);
  color: var(--ink);
  border: var(--line);
  border-radius: 16px;
  width: min(570px, 90vw);
  max-height: 84vh;
  padding: 0;
  box-shadow: 0 20px 80px #1b243338;
}
dialog::backdrop {
  background: #17203655;
}
.dialoghead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 19px 24px 12px;
  border-bottom: var(--line);
}
.dialoghead h2 {
  font-size: 20px;
}
#panelbody {
  padding: 15px 24px 23px;
  max-height: calc(84vh - 65px);
  overflow: auto;
}
#panelbody h3 {
  font-size: 16px;
  margin: 15px 0 7px;
}
.row {
  width: 100%;
  justify-content: space-between;
  text-align: left;
  padding: 10px 8px;
}
.row small {
  font-size: 12px;
}
.row.sel {
  background: var(--wash);
  color: var(--key);
}
.cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.stat {
  background: var(--plate);
  border-radius: 10px;
  padding: 13px;
}
.stat strong,
.stat small {
  display: block;
}
.stat strong {
  font-size: 20px;
}
.divider {
  border: 0;
  border-top: var(--line);
  margin: 12px 0;
}
.warning {
  border-left: 3px solid #bb823d;
  background: var(--plate);
  padding: 8px 12px;
}
.canvas {
  width: 100%;
  height: 50vh;
  border: var(--line);
  background: white;
}
#toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  padding: 10px 18px;
  border-radius: 10px;
  background: var(--ink);
  color: var(--bg);
  max-width: 80vw;
  box-shadow: 0 3px 22px #1112;
}
.panelnotice {
  color: var(--key);
  background: var(--wash);
  padding: 7px 10px;
  border-radius: 7px;
  margin-bottom: 8px;
}
[hidden] {
  display: none !important;
}
@media (max-width: 900px) {
  #workspace {
    grid-template-columns: 205px minmax(0, 1fr);
  }
  .measure {
    width: calc(100% - 36px);
  }
  .top {
    padding: 0 9px;
  }
  .search kbd {
    display: none;
  }
}
