/* Mirrors the Chainlit UI of the real app (dark by default, light via the moon button). */
:root {
  --bg: #212121; --surface: #2f2f2f; --surface-2: #3a3a3a; --code: #464646;
  --text: #ececec; --muted: #a3a3a3; --line: #3d3d3d; --accent: #f80061;
  --step-dot: #3c3c3c; --link: #9ab4ff;
}
:root[data-theme="light"] {
  --bg: #ffffff; --surface: #f4f4f5; --surface-2: #ececec; --code: #e8e8ea;
  --text: #18181b; --muted: #6b6b70; --line: #e4e4e7; --accent: #f80061;
  --step-dot: #e4e4e7; --link: #2f5bd3;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]):not([data-theme="light"]) {
    --bg: #ffffff; --surface: #f4f4f5; --surface-2: #ececec; --code: #e8e8ea;
    --text: #18181b; --muted: #6b6b70; --line: #e4e4e7; --step-dot: #e4e4e7; --link: #2f5bd3;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 15px/1.6 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--link); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.top {
  position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between;
  align-items: center; gap: 12px; padding: 10px 16px; background: var(--bg);
}
.left, .right { display: flex; align-items: center; gap: 10px; min-width: 0; }
.icon {
  display: grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 8px;
  background: none; color: var(--text); cursor: pointer;
}
.icon:hover { background: var(--surface); }
.profile select {
  max-width: 62vw; background: var(--surface); color: var(--text); border: 1px solid var(--line);
  border-radius: 8px; padding: 6px 10px; font: inherit; font-size: 14px; cursor: pointer;
}
.readme { color: var(--text); text-decoration: none; font-weight: 600; font-size: 14px; padding: 6px 8px; }
.avatar {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
  background: var(--accent); color: #fff; font-weight: 700; font-size: 14px; text-transform: uppercase;
}

.thread { max-width: 768px; margin: 0 auto; padding: 8px 16px 200px; }
.log { display: flex; flex-direction: column; gap: 6px; }

.user-row { display: flex; justify-content: flex-end; margin: 14px 0 8px; }
.user-bubble {
  max-width: 75%; background: var(--surface-2); padding: 10px 18px; border-radius: 22px;
  white-space: pre-wrap; overflow-wrap: anywhere;
}

.row { display: grid; grid-template-columns: 24px 1fr; gap: 12px; align-items: start; }
.mark { width: 20px; height: 20px; margin-top: 3px; }
.dot { width: 20px; height: 20px; margin-top: 3px; border-radius: 50%; background: var(--step-dot); }

details.step { margin: 4px 0; }
details.step > summary {
  list-style: none; cursor: pointer; color: var(--muted); font-size: 15px; user-select: none;
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 0;
}
details.step > summary::-webkit-details-marker { display: none; }
details.step > summary::after {
  content: ""; width: 7px; height: 7px; border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor; transform: rotate(45deg) translateY(-2px); margin-left: 4px;
}
details.step[open] > summary { color: var(--text); font-weight: 600; }
details.step[open] > summary::after { transform: rotate(-135deg) translateY(-1px); }
details.step .detail {
  margin: 10px 0 8px 4px; padding: 4px 0 4px 18px; border-left: 2px solid var(--accent);
  font-size: 14px; overflow-x: auto;
}
details.step .detail p { margin: 0 0 6px; }

.msg { overflow-wrap: anywhere; }
.msg p { margin: 0 0 10px; } .msg p:last-child { margin-bottom: 0; }
.msg ol, .msg ul { margin: 6px 0 12px; padding-left: 22px; }
.msg-row { margin: 10px 0; }

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px;
  background: var(--code); padding: 1px 6px; border-radius: 4px;
}
.codeblock { border-radius: 12px; overflow: hidden; background: var(--surface); margin: 8px 0; }
.codeblock .cb-head { padding: 10px 16px; color: var(--muted); font-size: 13px; }
.codeblock pre {
  margin: 0; padding: 12px 10px; background: var(--code); overflow-x: auto; white-space: pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13.5px; line-height: 1.6;
}
.table-wrap { border: 1px solid var(--line); border-radius: 12px; overflow-x: auto; margin: 8px 0; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 500; }
tr:last-child td { border-bottom: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }

.actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.actions button {
  background: none; color: var(--text); border: 1px solid var(--line); border-radius: 8px;
  padding: 7px 16px; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
}
.actions button:hover { background: var(--surface); }
.chosen { color: var(--muted); font-size: 14px; }
.end { color: var(--muted); font-size: 13px; text-align: center; margin: 14px 0; }

.dock {
  position: fixed; left: 0; right: 0; bottom: 0; padding: 0 16px 10px;
  background: linear-gradient(to bottom, transparent, var(--bg) 22%);
}
.composer {
  max-width: 736px; margin: 0 auto; background: var(--surface); border-radius: 24px;
  padding: 14px 16px 10px;
}
.composer input {
  width: 100%; border: 0; outline: 0; background: none; color: var(--text); font: inherit;
  font-size: 16px; text-overflow: ellipsis;
}
.composer input::placeholder { color: var(--muted); }
.composer-row { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; }
.clip { color: var(--muted); display: grid; }
.send {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; border: 0;
  background: var(--accent); color: #fff; cursor: pointer;
}
.send:disabled { opacity: .4; cursor: default; }
.disclaimer {
  max-width: 736px; margin: 8px auto 0; text-align: center; font-size: 12px; color: var(--muted);
}
@media (max-width: 600px) {
  .readme { display: none; }
  .user-bubble { max-width: 88%; }
  .thread { padding-bottom: 230px; }
}
