:root {
  color-scheme: light;
  --ink: #18211b;
  --muted: #667168;
  --line: #dfe5df;
  --panel: #f6f8f5;
  --green: #176b43;
  --green-dark: #0d4f31;
  --cream: #fbfaf5;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--cream); }
button, textarea { font: inherit; }
button { cursor: pointer; }
.shell { min-height: 100vh; display: grid; grid-template-columns: 260px minmax(0, 1fr) 300px; }
.sidebar, .trace { background: #fff; border-color: var(--line); border-style: solid; }
.sidebar { border-width: 0 1px 0 0; padding: 24px 18px; display: flex; flex-direction: column; }
.trace { border-width: 0 0 0 1px; padding: 20px 16px; }
.brand { display: flex; gap: 12px; align-items: center; margin-bottom: 28px; }
.mark { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; color: #fff; background: var(--green); font-weight: 800; }
h1, h2, h3, p { margin: 0; }
.brand h1 { font-size: 18px; }
.brand p, .eyebrow, .label { color: var(--muted); font-size: 12px; }
.primary { border: 0; border-radius: 10px; padding: 11px 15px; color: #fff; background: var(--green); font-weight: 700; }
.primary:hover { background: var(--green-dark); }
.primary:disabled { opacity: .45; cursor: default; }
.label { margin: 24px 4px 8px; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
.threads { display: grid; gap: 5px; overflow: auto; }
.thread { border: 0; background: transparent; border-radius: 8px; padding: 9px 10px; text-align: left; color: var(--ink); }
.thread:hover, .thread.active { background: var(--panel); }
.connection { margin-top: auto; display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 12px; }
#dot { width: 8px; height: 8px; border-radius: 50%; background: #b85a51; }
#dot.online { background: #2a9d62; }
.main { min-width: 0; display: grid; grid-template-rows: auto 1fr auto auto; max-height: 100vh; }
header { padding: 20px 28px; background: rgba(255,255,255,.8); border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
header h2 { margin-top: 4px; font-size: 20px; }
.current-operation { margin-top: 5px; color: var(--green); font-size: 11px; font-weight: 650; }
.runtime { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.runtime button { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 7px 10px; }
.empty { align-self: center; justify-self: center; max-width: 650px; padding: 60px 30px; text-align: center; }
.empty h3 { font-size: 32px; line-height: 1.15; }
.empty p { margin-top: 14px; color: var(--muted); }
.starters { margin-top: 28px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.starters button { border: 1px solid var(--line); border-radius: 12px; background: #fff; padding: 18px 12px; }
.chat { overflow-y: auto; padding: 30px max(24px, calc((100% - 820px) / 2)); }
.hidden { display: none !important; }
.message { max-width: 760px; margin-bottom: 18px; white-space: pre-wrap; line-height: 1.55; }
.message.user { margin-left: auto; width: fit-content; max-width: 78%; background: var(--green); color: #fff; border-radius: 16px 16px 4px 16px; padding: 11px 15px; }
.message.assistant { background: #fff; border: 1px solid var(--line); border-radius: 4px 16px 16px 16px; padding: 14px 16px; }
.message.streaming::after, .reasoning-card.streaming .reasoning-body::after {
  content: "";
  display: inline-block;
  width: 6px;
  height: 14px;
  margin-left: 4px;
  background: var(--green);
  vertical-align: -2px;
  animation: blink .85s infinite;
}
.reasoning-card {
  max-width: 760px;
  margin: 0 0 18px;
  overflow: hidden;
  background: #f4f1fb;
  border: 1px solid #ddd5ef;
  border-radius: 12px;
}
.reasoning-card summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 13px;
  color: #54456f;
  cursor: pointer;
  font-size: 11px;
  font-weight: 750;
  list-style: none;
}
.reasoning-card summary::-webkit-details-marker { display: none; }
.reasoning-card summary > span:first-child { margin-right: auto; }
.reasoning-body {
  padding: 11px 14px 13px;
  color: #625775;
  border-top: 1px solid #ddd5ef;
  font-size: 11px;
  line-height: 1.6;
  white-space: pre-wrap;
}
.products { margin: 8px 0 24px; display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.product { min-width: 0; background: #fff; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; display: flex; flex-direction: column; }
.product img { width: 100%; height: 150px; object-fit: contain; background: #fafafa; }
.product-body { padding: 13px; display: grid; gap: 8px; flex: 1; }
.product-brand { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.product-name { font-size: 14px; line-height: 1.35; }
.product-price { font-size: 17px; font-weight: 800; }
.product-meta { color: var(--muted); font-size: 11px; }
.product button { margin-top: auto; border: 1px solid var(--green); color: var(--green); background: #fff; border-radius: 8px; padding: 8px; font-weight: 700; }
.clarification { border-left: 3px solid #d49e33; padding: 10px 14px; background: #fff8e7; margin: 8px 0 18px; font-size: 13px; }
.cart { border-top: 1px solid var(--line); background: #fff; padding: 11px 28px; display: flex; justify-content: space-between; font-size: 13px; }
.cart div { display: flex; gap: 12px; }
footer { display: flex; gap: 10px; padding: 16px 28px 22px; border-top: 1px solid var(--line); background: #fff; }
textarea { flex: 1; resize: none; border: 1px solid var(--line); border-radius: 12px; padding: 11px 13px; min-height: 44px; max-height: 150px; }
.trace-head { display: flex; justify-content: space-between; align-items: center; }
.trace-subtitle { display: flex; align-items: center; gap: 6px; margin-top: 5px; color: var(--muted); font-size: 9px; font-weight: 500; }
.trace-subtitle i { width: 6px; height: 6px; border-radius: 50%; background: #2a9d62; box-shadow: 0 0 0 3px rgba(42,157,98,.12); }
.trace-empty {
  margin-top: 18px;
  padding: 14px;
  color: var(--muted);
  background: var(--panel);
  border: 1px dashed var(--line);
  border-radius: 10px;
  font-size: 11px;
  line-height: 1.5;
}
.trace-items { margin-top: 16px; display: grid; gap: 10px; max-height: calc(100vh - 96px); overflow: auto; }
.trace-item { border-left: 2px solid var(--line); padding-left: 10px; font-size: 12px; }
.trace-item.running { border-left-color: #b18b34; }
.trace-item.completed { border-left-color: #2a9d62; }
.trace-item.warning { border-left-color: #d49e33; }
.trace-item.failed { border-left-color: #b85a51; }
.trace-item strong { display: block; }
.trace-item span { display: block; color: var(--muted); margin-top: 3px; word-break: break-word; }

@keyframes blink { 0%, 45% { opacity: 1; } 46%, 100% { opacity: .16; } }

@media (max-width: 1050px) {
  .shell { grid-template-columns: 220px minmax(0, 1fr); }
  .trace { display: none; }
}
@media (max-width: 720px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .starters { grid-template-columns: 1fr; }
  header, footer { padding-left: 16px; padding-right: 16px; }
}