:root {
  --bg: #14161a;
  --panel: #1c1f25;
  --line: #2b2f37;
  --text: #e7e8ea;
  --muted: #9097a3;
  --accent: #b39dfa;
  --good: #7fd69b;
  --bad: #f2848b;
  --warn: #f0c674;
  --radius: 12px;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #fbfbfc;
    --panel: #ffffff;
    --line: #e2e4e8;
    --text: #1d2026;
    --muted: #646b78;
    --accent: #6b4fd8;
    --good: #1f8a4c;
    --bad: #c4323d;
    --warn: #9a6a00;
    color-scheme: light;
  }
}
* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
  margin: 0;
}
body {
  background: var(--bg);
  color: var(--text);
  font:
    15px/1.5 -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    system-ui,
    sans-serif;
  -webkit-text-size-adjust: 100%;
}
#app {
  height: 100dvh;
  display: flex;
  flex-direction: column;
}
.center {
  margin: auto;
  text-align: center;
  padding: 24px;
  max-width: 26rem;
}
.muted {
  color: var(--muted);
}
button,
select,
input,
textarea {
  font: inherit;
  color: inherit;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
}
button {
  padding: 0.55em 1em;
  cursor: pointer;
}
button.primary {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
  font-weight: 600;
}
button:disabled {
  opacity: 0.5;
  cursor: default;
}
input {
  padding: 0.6em 0.8em;
  width: 100%;
}
.stack > * + * {
  margin-top: 12px;
}
header {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: calc(env(safe-area-inset-top, 0px) + 8px) 12px 8px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
header .where {
  font-weight: 600;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
header select {
  padding: 0.3em 0.4em;
  max-width: 11rem;
}
header .cost {
  color: var(--muted);
  font-size: 0.85em;
}
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  flex: none;
}
.dot.on {
  background: var(--good);
}
#log {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px 4px;
  overscroll-behavior: contain;
}
.msg {
  margin: 0 0 14px;
  overflow-wrap: anywhere;
}
.msg.user {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 12px;
  margin-left: 15%;
}
.msg.note {
  color: var(--muted);
  font-size: 0.9em;
}
.msg.note.warning {
  color: var(--warn);
}
.msg.note.error {
  color: var(--bad);
}
.msg p {
  margin: 0 0 0.6em;
}
.msg p:last-child {
  margin-bottom: 0;
}
.msg pre {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  overflow-x: auto;
  font-size: 0.88em;
}
.msg code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.92em;
}
.msg :not(pre) > code {
  background: var(--panel);
  padding: 0.05em 0.3em;
  border-radius: 4px;
}
.msg a {
  color: var(--accent);
}
.msg ul,
.msg ol {
  padding-left: 1.3em;
  margin: 0 0 0.6em;
}
.call {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85em;
  color: var(--muted);
  margin: 0 0 6px;
}
.call summary {
  cursor: pointer;
  list-style: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.call summary::-webkit-details-marker {
  display: none;
}
.call .mark.completed {
  color: var(--good);
}
.call .mark.failed {
  color: var(--bad);
}
.call .mark.pending,
.call .mark.in_progress {
  color: var(--warn);
}
.call pre {
  white-space: pre-wrap;
  max-height: 16rem;
  overflow: auto;
  background: var(--panel);
  border-radius: 8px;
  padding: 6px 8px;
}
.thought {
  color: var(--muted);
  font-style: italic;
  font-size: 0.9em;
  margin: 0 0 8px;
}
.plan {
  border-left: 2px solid var(--line);
  padding-left: 10px;
  margin: 0 0 12px;
  font-size: 0.9em;
}
.plan .completed {
  color: var(--muted);
  text-decoration: line-through;
}
.plan .in_progress {
  color: var(--accent);
}
.card {
  background: var(--panel);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 12px;
  margin: 0 0 14px;
}
.card .title {
  font-weight: 600;
  margin-bottom: 8px;
  overflow-wrap: anywhere;
}
.card .choices {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.card label {
  display: block;
  margin: 4px 0;
}
.card input.tick {
  width: auto;
}
.card fieldset {
  border: 0;
  padding: 0;
  margin: 0 0 10px;
}
.card legend {
  font-weight: 600;
  margin-bottom: 4px;
}
footer {
  border-top: 1px solid var(--line);
  padding: 8px 10px calc(env(safe-area-inset-bottom, 0px) + 8px);
  position: relative;
}
footer form {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
footer .attach {
  font-size: 1.3em;
  line-height: 1;
  padding: 0.35em 0.6em;
}
.tray,
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tray {
  margin-bottom: 8px;
}
.chips {
  margin-top: 6px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 3px 8px 3px 3px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  font-size: 0.85em;
}
.chip img {
  width: 36px;
  height: 36px;
  object-fit: cover;
  border-radius: 6px;
}
.chip .clip {
  padding: 0 4px;
}
.chip .name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 14em;
}
.chip button {
  border: 0;
  background: transparent;
  padding: 0 2px;
  color: var(--muted);
}
footer textarea {
  flex: 1;
  resize: none;
  padding: 0.55em 0.8em;
  max-height: 40vh;
  min-height: 2.6em;
}
#commands {
  position: absolute;
  bottom: 100%;
  left: 10px;
  right: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  max-height: 45vh;
  overflow-y: auto;
}
#commands button {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 8px 12px;
}
#commands button span {
  color: var(--muted);
  font-size: 0.85em;
  margin-left: 8px;
}
#commands button.chosen {
  background: var(--line);
}
.sheet {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 5;
}
.sheet > div {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 16px 16px 0 0;
  width: min(36rem, 100%);
  max-height: 75vh;
  overflow-y: auto;
  padding: 14px 14px calc(env(safe-area-inset-bottom, 0px) + 14px);
}
.sheet h2 {
  font-size: 1rem;
  margin: 0 0 10px;
}
.sheet button.row {
  display: block;
  width: 100%;
  text-align: left;
  margin: 0 0 6px;
}
.sheet button.row small {
  display: block;
  color: var(--muted);
}
.stack div.row {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.center.wide {
  max-width: 44rem;
  width: 100%;
}

pre.diff {
  text-align: left;
  overflow-x: auto;
  font-size: 0.8rem;
  padding: 0.75rem;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--line);
}

pre.diff .added {
  color: var(--good);
}

pre.diff .removed {
  color: var(--bad);
}

label.check {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  justify-content: center;
}

label.check input {
  width: auto;
  margin: 0;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.activity {
  text-align: left;
}

.activity .line {
  border-bottom: 1px solid var(--line);
  padding: 8px 0;
  overflow-wrap: anywhere;
}

.activity .line .muted {
  font-size: 0.85em;
}

.activity .line.failed {
  color: var(--bad);
}

iframe.page {
  flex: 1;
  width: 100%;
  border: 0;
  background: #fff;
}

a.line {
  display: block;
  color: inherit;
  text-decoration: none;
}
