:root {
  color-scheme: light;
  --page: #f4f7f3;
  --surface: #fcfdfb;
  --ink: #192c23;
  --muted: #53665b;
  --line: #d9e3d9;
  --forest: #225a46;
  --forest-deep: #194737;
  --mint: #e6f2e9;
  --rail: #1b3028;
  --rail-ink: #e8f2eb;
  --rail-muted: #b7c9be;
  --danger: #9a382d;
  --content: 810px;
  font-family: "Microsoft YaHei UI", "PingFang SC", "Noto Sans SC", system-ui, sans-serif;
  font-size: 16px;
  color: var(--ink);
  background: var(--page);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
button, summary, input, textarea, select, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, summary:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible {
  outline: 2px solid #4b9875;
  outline-offset: 3px;
}
a { color: var(--forest); text-underline-offset: .2em; }
button { color: inherit; }

.workbench { display: grid; grid-template-columns: 250px minmax(0, 1fr); height: 100dvh; }
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 26px;
  padding: 25px 16px 14px;
  min-height: 0;
  background: var(--rail);
  color: var(--rail-ink);
}
.identity { display: flex; align-items: center; gap: 12px; padding: 0 8px; }
.identity strong { display: block; font-size: 1.05rem; font-weight: 700; }
.identity div > span { display: block; margin-top: 3px; color: var(--rail-muted); font-size: .8rem; }
.brand-mark {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  width: 37px;
  height: 37px;
  padding-bottom: 9px;
  border-radius: 11px 11px 4px 11px;
  background: #cbe8d3;
  flex: 0 0 auto;
}
.brand-mark i { display: block; width: 4px; background: #245742; border-radius: 4px; }
.brand-mark i:nth-child(1) { height: 9px; }
.brand-mark i:nth-child(2) { height: 16px; }
.brand-mark i:nth-child(3) { height: 20px; }
.icon {
  width: 19px;
  height: 19px;
  display: block;
  flex: none;
  stroke: currentColor;
  stroke-width: 1.65;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.new-chat, .sidebar-setting, .icon-button, .tool-button, .send-button, .connection-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.new-chat {
  justify-content: flex-start;
  gap: 11px;
  padding: 11px 12px;
  background: #2d4b3e;
  border: 1px solid #4e6d5d;
  border-radius: 9px;
  min-height: 44px;
  font-size: .925rem;
  font-weight: 650;
}
.new-chat:hover { background: #365849; }
.history-panel { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.history-header { padding: 0 7px; display: flex; align-items: baseline; justify-content: space-between; color: var(--rail-muted); }
.history-header h2 { font-size: .875rem; font-weight: 650; margin: 0 0 11px; }
.history-header span { font-size: .78rem; }
.history-search {
  display: flex;
  gap: 6px;
  align-items: center;
  color: var(--rail-muted);
  background: #172820;
  border: 1px solid #385447;
  border-radius: 8px;
  padding: 7px 8px;
}
.history-search:focus-within { border-color: #91bea8; }
.history-search .icon { width: 16px; height: 16px; }
.history-search input { appearance: none; background: transparent; border: 0; outline: none; width: 100%; min-width: 0; font-size: .875rem; }
.history-search input:focus-visible { outline: none; }
.history-search input::placeholder { color: var(--rail-muted); }
.history-shortcut { flex: none; border: 1px solid #476354; border-radius: 4px; padding: 1px 4px; font: inherit; font-size: .75rem; }
.history { margin-top: 12px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #577363 transparent; }
.history-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  padding: 9px 8px;
  margin: 2px 0;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--rail-ink);
  font-size: .875rem;
  min-height: 38px;
}
.history-item .icon { width: 16px; height: 16px; color: var(--rail-muted); }
.history-item span:last-child { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.history-item:hover, .history-item[aria-current="page"] { background: #2b493c; }
.history-item[aria-current="page"] { border-color: #4c6f5c; }
.history-empty { color: var(--rail-muted); margin: 8px 8px 0; font-size: .83rem; line-height: 1.65; }
.sidebar-footer { border-top: 1px solid #3e584b; padding: 11px 0 2px; }
.sidebar-setting {
  justify-content: flex-start;
  width: 100%;
  gap: 9px;
  padding: 9px 8px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  font-size: .875rem;
}
.sidebar-setting:hover { background: #2b493c; }
.storage-label { display: flex; gap: 8px; align-items: center; font-size: .77rem; color: var(--rail-muted); padding: 7px 9px 3px; }
.storage-label .icon { width: 15px; height: 15px; }

.workspace { display: grid; grid-template-rows: 64px minmax(0, 1fr) auto; min-width: 0; }
.topbar {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 23px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  z-index: 2;
}
.context, .topbar-actions { display: flex; align-items: center; gap: 10px; }
.context { min-width: 0; }
.topbar-actions { flex: none; }
.current-title { min-width: 0; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; font-size: .95rem; font-weight: 650; }
.context-icon { color: #536f60; }
.drawer-toggle { display: none !important; }
.icon-button {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  padding: 0;
  flex: none;
}
.icon-button:hover { background: #eaf0e9; color: var(--ink); }
.connection-status {
  gap: 8px;
  padding: 7px 9px 7px 11px;
  min-height: 36px;
  background: #f0f5ef;
  color: var(--forest-deep);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: .875rem;
  white-space: nowrap;
}
.connection-status:hover { background: #e6f1e8; }
.connection-dot { width: 7px; height: 7px; border-radius: 100%; background: #a97731; }
.connection-status[data-state="verified"] .connection-dot { background: #35845d; }
.connection-status[data-state="saved"] .connection-dot { background: #607d69; }
.conn-icon .icon { width: 14px; height: 14px; }
.chat-actions { position: relative; }
summary { cursor: pointer; list-style: none; }
summary::-webkit-details-marker { display: none; }
.menu {
  position: absolute;
  min-width: 175px;
  top: calc(100% + 7px);
  right: 0;
  border: 1px solid var(--line);
  padding: 5px;
  border-radius: 9px;
  background: var(--surface);
  box-shadow: 0 12px 24px #19382b16;
}
.menu button {
  background: transparent;
  border: 0;
  border-radius: 6px;
  width: 100%;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px;
  font-size: .875rem;
}
.menu button:hover { background: #eaf0e9; }
.menu .icon { width: 16px; height: 16px; }
.delete-action { color: var(--danger); }

.scroller { overflow-y: auto; min-height: 0; display: flex; flex-direction: column; overflow-anchor: none; scrollbar-width: thin; }
.content-width { width: min(var(--content), calc(100% - 64px)); margin-inline: auto; }
.welcome { margin-block: auto; padding-block: clamp(36px, 8vh, 94px) clamp(28px, 5vh, 62px); }
.welcome-heading::before {
  content: "";
  display: block;
  width: 43px;
  height: 4px;
  border-radius: 2px;
  background: #5d9b79;
  margin-bottom: 21px;
}
.welcome h1 {
  font: 700 clamp(2rem, 4.5vw, 3.3rem)/1.24 "Songti SC", "STZhongsong", "Noto Serif SC", SimSun, "Microsoft YaHei UI", serif;
  letter-spacing: .035em;
  margin: 0;
}
.welcome p { font-size: 1rem; margin: 14px 0 0; line-height: 1.75; color: var(--muted); }
.starter-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 34px;
  border-block: 1px solid #d1ded1;
}
.starter {
  border: 0;
  display: flex;
  align-items: center;
  text-align: left;
  gap: 10px;
  background: transparent;
  padding: 16px 13px;
  min-width: 0;
  min-height: 76px;
}
.starter:hover { background: #eaf2e8; }
.starter + .starter { border-left: 1px solid #d1ded1; }
.starter-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #e4efe4;
  color: var(--forest);
  flex: none;
}
.starter strong { display: block; font-size: .94rem; font-weight: 700; }
.starter small { display: block; margin-top: 4px; color: var(--muted); font-size: .8rem; line-height: 1.45; }
.composer-dock { background: var(--page); padding-top: 8px; padding-bottom: max(16px, env(safe-area-inset-bottom)); }
.composer {
  border: 1px solid #b8cbbc;
  border-radius: 16px;
  background: white;
  box-shadow: 0 7px 24px #20392e0a;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.composer:focus-within { border-color: #6e9d80; box-shadow: 0 0 0 2px #dcece0; }
.composer.dragging { outline: 2px dashed var(--forest); outline-offset: 4px; background: #f5fbf5; }
.composer textarea {
  display: block;
  width: 100%;
  border: 0;
  outline: none;
  resize: none;
  background: transparent;
  padding: 15px 16px 4px;
  min-height: 71px;
  max-height: min(32vh, 220px);
  font-size: 1rem;
  line-height: 1.6;
}
.composer textarea::placeholder { color: #65786e; opacity: 1; }
.composer-tools {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 8px 10px 10px;
}
.tool-group, .send-group { display: flex; align-items: center; gap: 5px; }
.send-group { margin-left: auto; gap: 8px; }
.tool-button {
  background: transparent;
  border: 1px solid transparent;
  padding: 5px 7px;
  gap: 5px;
  border-radius: 7px;
  min-height: 33px;
  color: #496356;
  font-size: .875rem;
  white-space: nowrap;
}
.tool-button:hover:enabled { background: #f1f5f0; }
.tool-button[aria-pressed="true"] { border-color: #c6e1cb; color: var(--forest-deep); background: var(--mint); }
.tool-button[aria-pressed="true"]:hover:enabled { background: #dceee0; }
.tool-button:disabled { opacity: .48; }
.tool-button .icon { width: 16px; height: 16px; }
.tool-icon { width: 34px; }
.tool-icon .icon { width: 18px; height: 18px; }
.tool-icon.is-recording { color: var(--danger); background: #fff1ec; border-color: #edc7bd; }
.tool-divider { width: 1px; height: 18px; background: var(--line); margin-inline: 1px; }
.model-select { display: flex; align-items: center; position: relative; min-width: 0; }
.model-select select {
  max-width: 168px;
  appearance: none;
  background: #f6f8f5;
  border: 1px solid var(--line);
  border-radius: 7px;
  cursor: pointer;
  font-size: .83rem;
  padding: 7px 26px 7px 8px;
  color: var(--ink);
}
.model-select select:disabled { cursor: default; }
.model-select > span { position: absolute; inset-inline-end: 8px; color: var(--muted); pointer-events: none; }
.model-select .icon { width: 14px; height: 14px; }
.search-select select { padding-left: 24px; max-width: 112px; }
.search-select [data-icon="globe"] { inset-inline-start: 7px; inset-inline-end: auto; }
.search-select select:disabled { opacity: .48; }
.send-button {
  color: white;
  background: var(--forest);
  border: 1px solid var(--forest);
  border-radius: 8px;
  width: 37px;
  height: 37px;
  padding: 0;
}
.send-button:hover:enabled { background: var(--forest-deep); }
.send-button:disabled { background: #e7eee8; border-color: #e7eee8; color: #678173; }
.composer-help { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: .77rem; margin: 9px 2px 0; line-height: 1.45; }
.attachment-tray { display: flex; flex-wrap: wrap; gap: 7px; padding: 10px 10px 0; }
.attachment-card {
  display: flex;
  align-items: center;
  gap: 7px;
  max-width: min(100%, 335px);
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  text-decoration: none;
  color: var(--ink);
}
a.attachment-card:hover { border-color: #7da389; }
.attachment-card .icon { width: 17px; height: 17px; color: var(--forest); }
.attachment-title { min-width: 0; }
.attachment-title strong { font-size: .875rem; font-weight: 600; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-title small { font-size: .75rem; color: var(--muted); }
.attachment-card .icon-button { width: 30px; height: 30px; margin-left: auto; }

.messages { display: flex; flex-direction: column; gap: 26px; padding-block: 27px 24px; }
.message { min-width: 0; }
.message.user { align-self: end; max-width: min(92%, 660px); }
.user-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin: 0;
  border: 1px solid #d0e2d3;
  border-radius: 14px 14px 3px 14px;
  padding: 10px 13px;
  background: #e8f2e9;
  line-height: 1.65;
}
.message-attachments { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px; margin-block: 0 8px; }
.user .message-attachments { justify-content: flex-end; }
.media-item { width: min(340px, 100%); margin: 0; padding: 0; }
.media-item img, .media-item video {
  background: #e3ede3;
  border: 1px solid var(--line);
  border-radius: 10px;
  width: 100%;
  max-height: 460px;
  object-fit: contain;
  display: block;
}
.media-item audio { width: 100%; }
.media-item figcaption { margin-top: 5px; }
.media-item figcaption .attachment-card { max-width: 100%; }
.assistant { display: grid; align-items: start; grid-template-columns: 34px minmax(0, 1fr); column-gap: 10px; }
.assistant-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid #cae2cd;
  border-radius: 8px 8px 3px 8px;
  background: #e2f1e5;
  color: var(--forest-deep);
}
.assistant-identity { font-size: .85rem; color: var(--muted); min-height: 31px; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.assistant-identity strong { color: var(--ink); font-weight: 700; }
.search-label { color: var(--forest); display: flex; align-items: center; gap: 4px; }
.search-label .icon { width: 13px; height: 13px; }
.message-content { overflow-wrap: anywhere; min-width: 0; line-height: 1.72; }
.message-content > :first-child { margin-top: 0; }
.message-content > :last-child { margin-bottom: 0; }
.message-content p { margin-block: .65em; }
.message-content h1, .message-content h2, .message-content h3 { font-size: 1.25rem; line-height: 1.45; margin: 1em 0 .4em; }
.message-content h3 { font-size: 1.06rem; }
.message-content ul, .message-content ol { padding-inline-start: 1.6em; margin-block: .65em; }
.message-content blockquote { margin: .6em 0; padding-left: 12px; border-left: 3px solid #9cb9a5; color: var(--muted); }
.message-content hr { border: 0; border-top: 1px solid var(--line); }
.message-content pre {
  padding: 13px;
  overflow: auto;
  background: #20342c;
  color: #edf6ec;
  border-radius: 8px;
  font-size: .875rem;
  line-height: 1.55;
  overflow-wrap: normal;
}
.message-content :not(pre) > code { background: #e7efe5; border-radius: 4px; padding: 2px 4px; }
.table-scroll { overflow: auto; margin-block: 10px; }
.message-content table { border-collapse: collapse; width: 100%; font-size: .92rem; }
.message-content :is(th, td) { border: 1px solid var(--line); padding: 7px 10px; text-align: start; }
.message-content th { background: #e7f0e6; }
.reasoning {
  margin: 1px 0 9px;
  padding: 7px 9px;
  border-left: 2px solid #9fbba8;
  border-radius: 0 7px 7px 0;
  background: #edf3ec;
  color: var(--muted);
  font-size: .875rem;
}
.reasoning > summary, .sources > summary { display: flex; align-items: center; gap: 6px; min-height: 24px; }
.reasoning .icon, .sources .icon { width: 15px; height: 15px; }
.reasoning[open] summary [data-icon="chevron"], .sources[open] summary [data-icon="chevron"] { transform: rotate(180deg); }
.reasoning-text { max-height: 18rem; overflow: auto; white-space: pre-wrap; padding-block: 6px 2px; margin: 0; line-height: 1.6; }
.message-status { margin: 6px 0 0; color: var(--muted); font-size: .875rem; }
.message-status.error { color: var(--danger); }
.message-status.streaming { display: flex; align-items: center; gap: 8px; }
.message-status.streaming::before {
  content: "";
  width: 9px;
  height: 9px;
  background: #559571;
  border-radius: 100%;
  animation: breathe 1.5s ease-in-out infinite;
}
@keyframes breathe { 50% { opacity: .42; } }
.message-actions { display: flex; align-items: center; gap: 4px; margin-top: 8px; }
.message-actions .icon-button { width: 33px; height: 33px; }
.message-actions .icon { width: 17px; height: 17px; }
.reply-audio { display: block; margin-top: 8px; max-width: 100%; }
.sources { margin-top: 12px; font-size: .875rem; color: var(--forest-deep); }
.sources ol { padding-inline-start: 22px; line-height: 1.7; margin: 6px 0 0; }
.sources li { overflow-wrap: anywhere; }

.chart-block {
  margin: 12px 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 14px;
}
.chart-block figcaption { font-weight: 700; }
.chart-block svg { display: block; width: 100%; min-width: 300px; max-height: 250px; margin: 9px 0 0; overflow: visible; }
.chart-scroll { overflow: auto; padding: 3px; }
.chart-axis { color: #476757; font-size: 13px; }
.chart-grid { stroke: #dce7dc; stroke-width: 1px; }
.chart-track { stroke: #34765a; fill: none; stroke-width: 2.5px; }
.chart-point { fill: #3d8063; }
.chart-point:focus, .chart-point:hover { fill: #9a592e; outline: none; }
.chart-block output { display: block; margin-top: 4px; color: var(--muted); font-size: .875rem; }
.map-places { margin: 6px 0 0; padding-left: 22px; }

.dialog {
  color: var(--ink);
  border: 1px solid #b5cdbc;
  background: var(--surface);
  border-radius: 15px;
  width: min(470px, calc(100% - 30px));
  padding: 0;
  box-shadow: 0 20px 65px #193a2d26;
}
.dialog::backdrop { background: #11251e65; }
.dialog-content { padding: 19px; display: flex; flex-direction: column; align-items: stretch; gap: 9px; }
.dialog-title { display: flex; justify-content: space-between; align-items: center; }
.dialog-title h2 { font-size: 1.25rem; margin: 0; }
.dialog p { margin: 0; line-height: 1.65; color: var(--muted); font-size: .92rem; }
.doc-link { font-size: .875rem; align-self: flex-start; }
.field-label { font-weight: 650; font-size: .875rem; margin-top: 9px; }
.dialog input {
  min-height: 40px;
  padding: 8px 10px;
  background: white;
  border: 1px solid #bacdc0;
  border-radius: 8px;
}
.dialog output { min-height: 1.25em; color: var(--muted); font-size: .875rem; }
.dialog output[data-error] { color: var(--danger); }
.dialog-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 7px; margin-top: 3px; }
.dialog-actions button { padding: 7px 11px; border-radius: 7px; font-size: .875rem; min-height: 36px; }
.dialog-actions button:disabled { opacity: .55; }
.button-primary { border: 1px solid var(--forest); background: var(--forest); color: white; }
.button-primary:hover:enabled { background: var(--forest-deep); }
.button-secondary { border: 1px solid #bbcfc0; background: #f6f9f5; color: var(--ink); }
.button-secondary:hover:enabled { background: #eaf3ea; }
.button-quiet { border: 1px solid transparent; background: transparent; margin-right: auto; }
.button-quiet:hover:enabled { background: #fff0ec; }
.danger-button { background: var(--danger); color: white; border: 1px solid var(--danger); }
.danger-button:hover:enabled { background: #7b2c23; }
.toast {
  position: fixed;
  z-index: 4;
  right: 18px;
  bottom: 21px;
  max-width: min(430px, calc(100vw - 36px));
  border-radius: 8px;
  padding: 11px 13px;
  background: var(--rail);
  color: var(--rail-ink);
  font-size: .9rem;
  line-height: 1.55;
  box-shadow: 0 5px 22px #1b392a26;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (max-width: 1120px) {
  .workbench { grid-template-columns: 218px minmax(0, 1fr); }
  .content-width { width: min(var(--content), calc(100% - 44px)); }
}
@media (max-width: 780px) {
  .workbench { display: block; }
  .workspace { height: 100%; grid-template-rows: 56px minmax(0, 1fr) auto; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(274px, 85vw); z-index: 6; transform: translateX(-105%); transition: transform .18s ease; }
  .sidebar.open { transform: translateX(0); }
  .drawer-overlay { position: fixed; z-index: 5; inset: 0; border: 0; background: #11251e65; }
  .drawer-toggle { display: inline-flex !important; }
  .context-icon { display: none; }
  .topbar { padding-inline: 10px; }
  .context { gap: 5px; }
  .tool-button { min-height: 38px; }
  .send-button { width: 42px; height: 42px; }
  .model-select select { min-height: 38px; }
}
@media (max-width: 520px) {
  .content-width { width: calc(100% - 26px); }
  .welcome { padding-block: 27px; }
  .welcome-heading::before { margin-bottom: 12px; }
  .welcome p { margin-top: 8px; }
  .starter-list { margin-top: 20px; grid-template-columns: minmax(0, 1fr); }
  .starter { min-height: 56px; padding: 7px 9px; }
  .starter + .starter { border-left: 0; border-top: 1px solid #d1ded1; }
  .starter small { margin-top: 2px; }
  .composer-tools { gap: 4px; }
  .tool-group { flex-wrap: wrap; }
  .composer-privacy { display: none; }
  .composer-dock { padding-bottom: max(10px, env(safe-area-inset-bottom)); }
  .composer-help { margin-top: 6px; }
  .messages { padding-block: 19px; gap: 18px; }
  .assistant { grid-template-columns: 28px minmax(0, 1fr); column-gap: 7px; }
  .assistant-mark { width: 28px; height: 28px; }
  .assistant-mark .icon { width: 16px; height: 16px; }
  .assistant-identity { min-height: 26px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
