示例工程 61-chat-ui-streaming

61-chat-ui-streaming/app/src/styles/app.css

css · 6.6 KB

.app {
  min-height: 100vh;
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 58px;
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #ffffff, #f8fafc);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: #0f172a;
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
}

.brand h1 {
  margin: 0;
  font-size: 15px;
}

.header-side {
  display: flex;
  align-items: center;
  gap: 7px;
}

.pill {
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: 10px;
}

.ok-pill {
  border-color: #86efac;
  background: #f0fdf4;
  color: #166534;
}

.bad-pill {
  border-color: #fecaca;
  background: #fef2f2;
  color: #991b1b;
}

.warn-pill {
  border-color: #fcd34d;
  background: #fffbeb;
  color: #92400e;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 12px;
  padding: 12px 20px 16px;
  height: calc(100vh - 58px);
  box-sizing: border-box;
}

.chat {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.chat-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.chat-head h2 {
  margin: 0;
  font-size: 12.5px;
}

.messages {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 12px;
  background: #fbfdff;
}

.msg {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 92%;
  margin-bottom: 12px;
}

.msg.user {
  align-items: flex-end;
  margin-left: auto;
}

.bubble {
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  font-size: 11.4px;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.msg.user .bubble {
  border-color: #bfdbfe;
  background: #eff6ff;
}

.msg.assistant .bubble {
  border-top-left-radius: 3px;
}

.caret {
  display: inline-block;
  width: 6px;
  height: 13px;
  margin-left: 2px;
  background: var(--primary);
  vertical-align: -2px;
  animation: blink 1s steps(2, start) infinite;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

.msg .small {
  padding: 0 2px;
}

.tool-card,
.diff-card {
  margin-top: 5px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  overflow: hidden;
}

.tool-head,
.diff-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 7px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  font-size: 9px;
}

.args {
  margin: 0;
  padding: 7px;
  color: var(--muted);
  font-size: 8.8px;
  line-height: 1.5;
}

.tool-result {
  margin: 0;
  padding: 5px 7px;
}

.diff {
  margin: 0;
  padding: 5px 0;
  font-size: 9px;
  line-height: 1.55;
}

.diff-line {
  display: block;
  padding: 0 8px;
  white-space: pre;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.diff-line.add {
  background: #ecfdf5;
  color: #166534;
}

.diff-line.del {
  background: #fef2f2;
  color: #991b1b;
}

.diff-line.ctx {
  color: var(--muted);
}

.stopped {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 2px 0;
  color: #9a3412;
  font-size: 10px;
}

.btn {
  height: 28px;
  padding: 0 9px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-size: 10px;
}

.btn.primary {
  border-color: var(--primary);
  background: var(--primary);
  color: #ffffff;
}

.btn:disabled {
  opacity: 0.45;
}

.btn.retry {
  height: 24px;
  border-color: #fdba74;
  background: #fff7ed;
  color: #9a3412;
}

.composer {
  padding: 8px 10px 10px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.composer textarea {
  width: 100%;
  box-sizing: border-box;
  resize: none;
  padding: 7px 8px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #ffffff;
  color: var(--text);
  font-size: 11px;
  line-height: 1.5;
}

.composer textarea:disabled {
  background: var(--panel);
  color: var(--muted);
}

.composer-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 6px;
}

.composer-actions .small {
  margin-right: auto;
}

.side {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  overflow: auto;
}

.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 7px;
}

.card h2 {
  margin: 0;
  font-size: 12.5px;
}

.small {
  font-size: 10.5px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin: 0;
}

.stats div {
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--panel);
}

.stats dt {
  color: var(--muted);
  font-size: 8.6px;
}

.stats dd {
  margin: 2px 0 0;
  font-size: 11px;
  font-weight: 600;
}

.checks,
.notes {
  margin: 0;
  padding: 0;
  list-style: none;
}

.check-row {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 74px;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
  font-size: 9.2px;
}

.check-row:last-child {
  border-bottom: none;
}

.check-row code {
  color: var(--muted);
  font-size: 8px;
  text-align: right;
  overflow-wrap: anywhere;
}

.notes li {
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 9.6px;
  line-height: 1.5;
}

.notes li:last-child {
  border-bottom: none;
}

.tag {
  padding: 1px 5px;
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  font-size: 8px;
  font-weight: 600;
  white-space: nowrap;
  text-align: center;
}

.tag.tool {
  background: #fef3c7;
  color: #92400e;
}

.tag.done {
  background: #dcfce7;
  color: #166534;
}

.tag.error {
  background: #fee2e2;
  color: #991b1b;
}

.tag.diff {
  background: #dbeafe;
  color: #1e40af;
}

body[data-shot] .msg:nth-last-child(n + 3) {
  display: none;
}

body[data-shot="tool"] .notes-card,
body[data-shot="retry"] .notes-card {
  display: none;
}

body[data-shot="tool"] .diff-card {
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
}

body[data-shot="retry"] .stopped {
  padding: 5px 7px;
  border: 1px solid #fdba74;
  border-radius: 7px;
  background: #fff7ed;
}

body[data-shot="retry"] .checks-card {
  border-color: #fdba74;
  box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.08);
}

@media (max-width: 860px) {
  .layout {
    grid-template-columns: 1fr;
    height: auto;
  }

  .side {
    overflow: visible;
  }
}