:root {
  color-scheme: light;
  --paper: #fafbf8;
  --surface: #ffffff;
  --ink: #233b34;
  --muted: #7d8881;
  --line: #e5e9e1;
  --green: #244d3e;
  --lime: #ddecbd;
  font-family: "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}
* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
body {
  margin: 0;
}
button,
input,
textarea,
select {
  font: inherit;
}
button {
  cursor: pointer;
}
button {
  transition:
    background 0.16s,
    transform 0.16s;
}
button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
button:active:not(:disabled) {
  transform: translateY(1px);
}
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 2px solid #81a16d;
  outline-offset: 3px;
}
input,
select,
textarea {
  min-width: 0;
}
input,
select {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
}
label {
  display: block;
  font-size: 13px;
  margin: 18px 0 8px;
}
button {
  border: 0;
}
.workspace {
  display: grid;
  grid-template-columns: 288px minmax(0, 1fr);
  height: 100dvh;
  min-height: 550px;
}
.sidebar {
  background: #f0f3ed;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 28px 18px 0;
  min-height: 0;
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 7px 30px;
}
.brand strong {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 23px;
  letter-spacing: 2px;
}
.brand small {
  display: block;
  font-size: 10px;
  letter-spacing: 1px;
  color: var(--muted);
  margin-top: 5px;
}
.demo-tag {
  font-size: 8px;
  letter-spacing: 1px;
  border: 1px solid #d3dcc9;
  border-radius: 4px;
  padding: 2px 4px;
  color: #73866a;
  font-weight: 500;
}
.new-thread {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--green);
  border-radius: 10px;
  color: #fff;
  padding: 14px 16px;
  font-size: 13px;
  text-align: left;
}
.new-thread:hover,
.primary:hover {
  background: #32604d;
}
.new-thread > span:first-child {
  font-size: 18px;
  line-height: 14px;
}
.shortcut {
  margin-left: auto;
  opacity: 0.5;
  font-size: 9px;
  letter-spacing: 1px;
}
.list-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 25px 7px 6px;
  color: #74816f;
  font-size: 11px;
  letter-spacing: 1px;
}
.icon-button {
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  height: 31px;
  width: 31px;
  border-radius: 7px;
  background: transparent;
  color: #78867b;
  font-size: 21px;
}
.icon-button:hover {
  background: #e6ebdf;
}
.search-box {
  display: flex;
  align-items: center;
  border: 1px solid #e1e6dc;
  background: #f7f9f4;
  padding: 0 11px;
  border-radius: 8px;
  gap: 6px;
  margin: 0 2px 12px;
}
.search-box span {
  color: #8d9889;
  font-size: 21px;
}
.search-box input {
  border: 0;
  background: transparent;
  padding: 9px 4px;
  font-size: 12px;
}
.thread-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
}
.thread-card {
  display: block;
  width: 100%;
  padding: 14px 12px;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 9px;
  margin-bottom: 5px;
}
.thread-card:hover {
  background: #e8ede2;
}
.thread-card.selected {
  background: #fff;
  border-color: #dce4d3;
  box-shadow: 0 2px 4px #294d3505;
}
.thread-card strong {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: #465347;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.thread-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
  color: #8c9688;
  font-size: 10px;
}
.thread-meta span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.thread-meta time {
  flex-shrink: 0;
}
.sidebar-footer {
  border-top: 1px solid #e1e7da;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 19px 7px 22px;
  margin-top: 14px;
}
.connection-dot,
.green-dot {
  width: 7px;
  height: 7px;
  display: inline-block;
  border-radius: 50%;
  background: #7d9f60;
  flex-shrink: 0;
}
.sidebar-footer strong {
  font-size: 11px;
  font-weight: 500;
}
.sidebar-footer small {
  display: block;
  color: #8c9688;
  font-size: 10px;
  margin-top: 5px;
}
.device-symbol {
  margin-left: auto;
  color: #95a18e;
  font-size: 25px;
}
.main {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  min-height: 0;
  background: var(--paper);
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 22px 34px;
  min-height: 92px;
  border-bottom: 1px solid var(--line);
  background: #ffffff80;
}
.topbar-title {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.topbar-title > div {
  min-width: 0;
}
.topbar-title strong {
  font-size: 14px;
  font-weight: 550;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 420px;
}
.topbar-title small {
  display: block;
  font-size: 10px;
  margin-top: 6px;
  color: #8a9588;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 400px;
}
.codex-mark {
  display: grid;
  place-items: center;
  width: 35px;
  height: 35px;
  border: 1px solid #dce4d4;
  border-radius: 9px;
  color: #6e855f;
  font-size: 24px;
  flex-shrink: 0;
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}
.quiet-button {
  color: #7b8977;
  background: transparent;
  font-size: 11px;
  white-space: nowrap;
}
.model-button {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 13px;
  background: white;
  border: 1px solid #dfe6d8;
  border-radius: 9px;
  font-size: 11px;
  color: #506348;
}
#model-short {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.session-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 35px;
}
.mode-label {
  font-size: 9px;
  letter-spacing: 1.7px;
  color: #9ba490;
}
.task-status {
  font-size: 10px;
  color: #758c65;
  padding: 5px 9px;
  background: #edf2e6;
  border-radius: 5px;
}
.task-status.busy {
  color: #9c7331;
  background: #faf0d9;
}
.empty-state {
  margin: auto;
  padding: 28px 25px 50px;
  text-align: center;
}
.empty-icon {
  display: grid;
  place-items: center;
  width: 65px;
  height: 65px;
  border: 1px solid #d8e2ce;
  border-radius: 20px;
  background: linear-gradient(145deg, #f1f6e9, #e5eddc);
  color: #59734b;
  margin: 0 auto 25px;
  font-size: 38px;
  transform: rotate(-7deg);
}
.eyebrow {
  display: block;
  font-size: 10px;
  color: #8c9b7d;
  letter-spacing: 2px;
}
.empty-state h1 {
  font-size: clamp(29px, 3.2vw, 43px);
  font-weight: 550;
  letter-spacing: 2px;
  line-height: 1.5;
  margin: 15px 0;
}
.empty-state h1 span {
  color: #8b9e79;
}
.empty-state p {
  font-size: 12px;
  color: #8a9383;
  line-height: 2;
  margin-bottom: 25px;
}
.primary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  padding: 13px 18px;
  background: var(--green);
  color: #f3f7ec;
  border-radius: 9px;
  font-size: 12px;
}
.empty-state .primary {
  margin: 0 auto;
}
.capability-row {
  display: flex;
  justify-content: center;
  gap: 25px;
  margin-top: 40px;
  color: #9aa38f;
  font-size: 10px;
}
.composer-area {
  padding: 10px 36px 16px;
  flex-shrink: 0;
}
.composer {
  max-width: 900px;
  margin: 0 auto;
  border: 1px solid #dce3d4;
  border-radius: 15px;
  background: #fff;
  box-shadow: 0 3px 15px #344e2510;
  padding: 14px 16px 10px;
}
.composer:focus-within {
  border-color: #9eaf8c;
}
.composer textarea {
  display: block;
  width: 100%;
  resize: none;
  min-height: 42px;
  max-height: 130px;
  outline: none;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.7;
}
.composer textarea::placeholder {
  color: #a1a999;
}
.composer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 7px;
}
.composer-bottom > span {
  color: #9da693;
  font-size: 10px;
}
.send-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.send-button {
  height: 32px;
  width: 32px;
  background: var(--green);
  border-radius: 9px;
  color: white;
  font-size: 21px;
}
.stop-button {
  background: #f5eeeb;
  color: #976e5f;
  padding: 7px 9px;
  font-size: 11px;
  border-radius: 7px;
}
.footer-note {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  max-width: 900px;
  margin: 10px auto 0;
  font-size: 9px;
  color: #a2ab98;
}
.conversation {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px max(30px, calc((100% - 820px) / 2)) 30px;
  scrollbar-width: thin;
}
.history-note {
  background: #f0f3e8;
  border: 1px solid #dfe7d3;
  border-radius: 8px;
  padding: 11px 14px;
  color: #7f8e70;
  font-size: 11px;
  line-height: 1.8;
  margin-bottom: 24px;
}
.message {
  margin: 0 0 24px;
}
.message-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #617656;
  font-size: 10px;
  letter-spacing: 1px;
  margin-bottom: 9px;
  font-weight: 600;
}
.message-label::before {
  content: "⌘";
  width: 22px;
  height: 22px;
  background: #e9f0e0;
  display: grid;
  place-items: center;
  border-radius: 6px;
  font-size: 16px;
}
.message.user .message-label::before {
  content: "你";
  background: #eff0ed;
  color: #89917f;
  font-size: 10px;
}
.message-text {
  font-size: 13px;
  line-height: 1.95;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin: 0;
}
.message.user .message-text {
  background: #eef2e9;
  padding: 13px 17px;
  border-radius: 2px 12px 12px;
}
.tool-message {
  margin-bottom: 15px;
  border: 1px solid #e2e7da;
  border-radius: 9px;
  background: #f3f5ef;
  padding: 10px 13px;
}
.tool-message summary {
  cursor: pointer;
  color: #7d8a72;
  font-size: 11px;
}
.tool-message pre {
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 11px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 300px;
  overflow-y: auto;
  margin-bottom: 0;
}
.approval-card {
  padding: 18px;
  border: 1px solid #d5dfbf;
  border-radius: 12px;
  background: #f2f6e9;
  margin-bottom: 16px;
}
.approval-card h3 {
  font-size: 13px;
  margin: 0 0 10px;
}
.approval-card pre {
  font-size: 11px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 200px;
  overflow-y: auto;
}
.approval-card p {
  font-size: 12px;
  line-height: 1.8;
}
.approval-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}
.secondary {
  background: #eef2e7;
  color: #516647;
  border: 1px solid #dce5d0;
  padding: 11px 16px;
  border-radius: 8px;
  font-size: 12px;
}
.task-error,
.error-text {
  color: #9e6551;
  font-size: 12px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.task-error {
  background: #faf0ea;
  border: 1px solid #eedacc;
  padding: 14px;
  border-radius: 9px;
  line-height: 1.8;
  margin: 12px 0;
}
dialog {
  background: #fbfcf8;
  border: 1px solid #dfe6d5;
  border-radius: 18px;
  padding: 0;
  width: min(480px, calc(100% - 32px));
  max-height: 88dvh;
  color: var(--ink);
  box-shadow: 0 25px 100px #172b2640;
}
dialog::backdrop {
  background: #162e284a;
  backdrop-filter: blur(3px);
}
.dialog-body {
  padding: 27px;
}
.dialog-heading {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
}
.dialog-heading h2 {
  font-size: 21px;
  font-weight: 550;
  margin: 10px 0;
}
.dialog-heading .eyebrow {
  font-size: 8px;
  letter-spacing: 1.5px;
}
.muted {
  font-size: 12px;
  line-height: 1.9;
  color: #85917a;
}
.field-note {
  font-size: 10px;
  line-height: 1.9;
  color: #939e87;
  margin: 12px 0 18px;
}
.dialog-body form > .primary {
  width: 100%;
}
.gateway-description {
  font-size: 10px;
  color: #8d9b80;
  overflow-wrap: anywhere;
  margin-top: 9px;
}
.model-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.model-chip {
  padding: 6px 9px;
  font-size: 10px;
  background: #edf2e4;
  color: #78886c;
  border-radius: 5px;
  overflow-wrap: anywhere;
  max-width: 100%;
  text-align: left;
}
.model-chip.active {
  background: #dce9c8;
  color: #3f6138;
}
.custom-profile {
  border-top: 1px solid var(--line);
  padding-top: 18px;
  margin-top: 25px;
}
.custom-profile > summary {
  font-size: 12px;
  color: #7d8f70;
  cursor: pointer;
}
.qr-area {
  min-height: 240px;
  display: grid;
  place-items: center;
  margin: 20px 0;
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.qr-area img {
  max-width: 100%;
  display: block;
}
#copy-link {
  width: 100%;
}
.text-button {
  background: transparent;
  color: #889c76;
  font-size: 11px;
  padding: 12px;
}
.danger {
  color: #a57e68;
}
.pair-gate {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(ellipse at 50% 30%, #eaf0df, transparent 60%);
}
.gate-card {
  max-width: 370px;
  width: 100%;
}
.gate-card img {
  margin-bottom: 30px;
}
.gate-card h1 {
  font-weight: 500;
  font-size: 30px;
}
.gate-card > p {
  font-size: 13px;
  color: #879579;
  line-height: 1.9;
}
.gate-card .primary {
  width: 100%;
  margin-top: 15px;
}
.gate-card small {
  display: block;
  color: #9ba88d;
  margin-top: 30px;
  font-size: 10px;
}
.toast {
  position: fixed;
  z-index: 10;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  max-width: min(500px, 90vw);
  background: #284738;
  color: #f5f7ee;
  border: 1px solid #425b3b;
  border-radius: 9px;
  padding: 13px 19px;
  box-shadow: 0 6px 25px #142b2520;
  font-size: 12px;
  line-height: 1.7;
}
.mobile-only {
  display: none;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
@media (min-width: 1450px) {
  .workspace {
    grid-template-columns: 310px minmax(0, 1fr);
  }
}
@media (max-width: 1050px) {
  .workspace {
    grid-template-columns: 245px minmax(0, 1fr);
  }
  .topbar {
    padding: 20px;
  }
  .topbar-title strong {
    max-width: 200px;
  }
  .topbar-title small {
    max-width: 200px;
  }
  #model-short {
    max-width: 120px;
  }
  .quiet-button span {
    display: none;
  }
}
@media (max-width: 720px) {
  .workspace {
    display: block;
    min-height: 0;
  }
  .main {
    min-height: 0;
  }
  .sidebar {
    position: fixed;
    z-index: 5;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(310px, 86vw);
    transform: translateX(-100%);
    transition: transform 0.2s;
    padding-top: max(24px, env(safe-area-inset-top));
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar-shade {
    display: block;
    position: fixed;
    inset: 0;
    background: #162e2855;
    z-index: 4;
  }
  .mobile-only {
    display: inline-grid;
  }
  #close-sidebar {
    margin-left: auto;
  }
  .topbar {
    min-height: 75px;
    padding: max(14px, env(safe-area-inset-top)) 15px 14px 10px;
    gap: 7px;
  }
  .topbar-title {
    gap: 7px;
  }
  .topbar-title strong {
    font-size: 12px;
    max-width: 170px;
  }
  .topbar-title small {
    max-width: 170px;
    font-size: 9px;
  }
  .codex-mark {
    display: none;
  }
  .topbar-actions {
    gap: 6px;
  }
  .quiet-button {
    display: none;
  }
  .model-button {
    padding: 9px;
    gap: 6px;
    font-size: 10px;
  }
  #model-short {
    max-width: 92px;
  }
  .session-toolbar {
    padding: 12px 20px;
  }
  .empty-state {
    padding: 18px 18px 28px;
  }
  .empty-icon {
    width: 54px;
    height: 54px;
    font-size: 31px;
    border-radius: 16px;
    margin-bottom: 22px;
  }
  .empty-state h1 {
    font-size: 31px;
  }
  .empty-state .eyebrow {
    font-size: 9px;
    letter-spacing: 1px;
  }
  .empty-state p {
    font-size: 11px;
  }
  .capability-row {
    gap: 20px;
    margin-top: 30px;
    font-size: 9px;
  }
  .composer-area {
    padding: 8px 12px max(13px, env(safe-area-inset-bottom));
  }
  .composer {
    padding: 12px 13px 9px;
    border-radius: 12px;
  }
  .composer textarea {
    font-size: 16px;
  }
  .composer-bottom > span {
    font-size: 9px;
  }
  .footer-note {
    margin: 8px 5px 0;
    font-size: 8px;
  }
  .conversation {
    padding: 12px 19px 20px;
  }
  .message-text {
    font-size: 13px;
  }
  .dialog-body {
    padding: 23px;
  }
  input,
  select {
    font-size: 16px;
  }
}
@media (max-height: 700px) {
  .empty-state {
    padding-top: 0;
    padding-bottom: 10px;
  }
  .empty-icon {
    display: none;
  }
  .empty-state h1 {
    margin: 12px 0;
    font-size: 29px;
  }
  .capability-row {
    margin-top: 23px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
  }
}
