:root {
  color-scheme: light;
  --bg: #ffffff;
  --sidebar: #f9fafb;
  --line: #ebebeb;
  --ink: #1f2328;
  --muted: #8b8e95;
  --chip: #f3f4f6;
  --bubble: #f5f5f5;
  --send: #4d6bfe;
  font-family: "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

button, textarea { font: inherit; color: inherit; }

.app {
  display: grid;
  grid-template-columns: 260px 1fr;
  height: 100%;
  min-height: 100vh;
}

.side {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  padding: 16px 12px 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 12px;
  font-size: 16px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.brand img, .empty img, .msg img {
  background: #000;
  object-fit: cover;
}

.brand img {
  width: 36px;
  height: 36px;
  border-radius: 10px;
}

.new, .account {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  height: 38px;
  text-align: left;
  padding: 0 12px;
  cursor: pointer;
}

.new:hover, .account:hover, .chip:hover { background: #f3f4f6; }

.history {
  flex: 1;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.history button {
  border: 0;
  background: transparent;
  text-align: left;
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
  color: #3d4248;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history button:hover, .history button.on { background: #efefef; }

.price {
  margin: 0;
  padding: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.main {
  display: grid;
  grid-template-rows: 52px 1fr auto;
  min-width: 0;
  height: 100vh;
}

.topbar {
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 600;
  border-bottom: 1px solid transparent;
}

.thread {
  overflow: auto;
  padding: 24px 16px 12px;
}

.empty {
  min-height: 100%;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 8px;
  text-align: center;
}

.empty img {
  width: 72px;
  height: 72px;
  border-radius: 18px;
}

.empty h1 {
  margin: 8px 0 0;
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.empty p { margin: 0; color: var(--muted); }

.msg {
  max-width: 768px;
  margin: 0 auto 18px;
  display: flex;
  gap: 12px;
}

.msg.user { justify-content: flex-end; }

.msg img {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  flex: none;
}

.bubble {
  max-width: min(80%, 640px);
  padding: 10px 14px;
  border-radius: 16px;
  background: var(--bubble);
  line-height: 1.55;
  white-space: pre-wrap;
}

.msg.assistant .bubble {
  background: transparent;
  padding: 2px 0;
  max-width: 100%;
}

.reason {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.dock {
  padding: 8px 16px 18px;
}

.composer {
  max-width: 768px;
  margin: 0 auto;
  border: 1px solid #e5e5e5;
  border-radius: 24px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.05);
  background: #fff;
  padding: 12px 12px 8px;
}

textarea {
  display: block;
  width: 100%;
  border: 0;
  resize: none;
  outline: none;
  min-height: 48px;
  max-height: 180px;
  padding: 4px 8px;
  line-height: 1.45;
  background: transparent;
}

.row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 4px 2px;
}

.chip {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  height: 32px;
  padding: 0 12px;
  cursor: pointer;
  color: #4b5160;
}

.chip.on {
  background: #eef1ff;
  border-color: #c9d2ff;
  color: var(--send);
}

.send {
  margin-left: auto;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: var(--send);
  color: #fff;
  cursor: pointer;
}

.send:disabled { opacity: 0.45; cursor: wait; }

.work {
  max-width: 768px;
  margin: 8px auto 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  background: #fff;
}

.work h2 {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.work p { margin: 8px 0 0; min-height: 1.2em; }

.work input, .work button {
  border: 1px solid var(--line);
  border-radius: 10px;
  height: 36px;
  padding: 0 10px;
  background: #fff;
}

.status { color: var(--muted); font-size: 13px; min-height: 1.2em; }

@media (max-width: 800px) {
  .app { grid-template-columns: 1fr; }
  .side { display: none; }
  .side.open {
    display: flex;
    position: fixed;
    inset: 0 auto 0 0;
    width: min(280px, 86vw);
    z-index: 3;
  }
}
