@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:ital,wght@0,100..700;1,100..700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:ital,wght@0,100..800;1,100..800&display=swap');
:root {
  --font: "IBM Plex Sans", sans-serif;
  --font-mono: "JetBrains Mono", monospace;
  --border-radius: 8px;
  --foreground: #0a0a0a;
  --foreground-alt: #737373;
  --border: #e5e5e5;
  --surface: #fafafa;
  --background: #ffffff;
  --placeholder: #cccccc;
  --primary: #36a014;
  --success: #16a34a;
  --danger: #dc2626;
  --alert-success-bg: #f0fdf4;
  --alert-danger-bg: #fef2f2;
  --shadow: 0 1px 2px 0 #0000000d;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --foreground: #f5f5f5;
  --foreground-alt: #a3a3a3;
  --border: #333333;
  --surface: #1e1e1e;
  --background: #121212;
  --primary: #72d55a;
  --success: #4ade80;
  --danger: #f87171;
  --alert-success-bg: #052e16;
  --alert-danger-bg: #450a0a;
  --scrollbar: rgba(255, 255, 255, 0.18);
  --scrollbar-hover: rgba(255, 255, 255, 0.32);
  --shadow: 0 1px 2px 0 #00000066;
  color-scheme: dark;
}
html, body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.4;
  color: var(--foreground);
  background: var(--background);
  tab-size: 4;
}
* {
  box-sizing: border-box;
}
a {
  color: var(--foreground);
  text-decoration: none;
}
a:hover {
  cursor: pointer;
  color: var(--foreground-alt);
}
ul {
  padding-left: 16px;
}
img {
  max-width: 100%;
  vertical-align: middle;
}

/* sections */
.app-header {
  display: flex;
  gap: 8px;
  align-items: center;
  width: 100%;
  padding: 8px 16px;
  background: var(--surface);
  margin-bottom: 8px;
}
.app-logo {
  display: block;
  height: 28px;
  width: auto;
}
.app-quote {
  color: var(--foreground-alt);
  font-size: 13px;
  max-width: min(480px, 42vw);
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.container {
  max-width: 1024px;
  margin: 0 auto;
  padding: 16px;
}
.home {
  max-width: 720px;
  padding-top: 48px;
}
.home-compose {
  margin-bottom: 56px;
}
.home-agent {
  display: block;
  width: auto;
  max-width: 100%;
  margin: 0 0 8px;
  padding: 4px 0;
  border: none;
  background: transparent;
  box-shadow: none;
  font-family: var(--font);
  font-size: 14px;
  color: var(--foreground-alt);
  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23737373' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 2px center;
  padding-right: 18px;
}
.home-agent:focus {
  color: var(--foreground);
}
.home-prompt {
  display: block;
  width: 100%;
  margin: 0;
  padding: 8px 0;
  border: none;
  background: transparent;
  box-shadow: none;
  resize: vertical;
  font-family: var(--font);
  font-size: 18px;
  line-height: 1.5;
  color: var(--foreground);
  outline: none;
}
.home-prompt::placeholder {
  color: var(--placeholder);
}
.home-compose-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin-top: 8px;
}
.button-small {
  padding: 0 10px;
  line-height: 26px;
  font-size: 13px;
}
.home-sessions {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.home-session {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 8px 0;
  color: var(--foreground);
}
.home-session:hover {
  color: var(--foreground);
}
.home-session:hover .home-session-name {
  color: var(--foreground-alt);
}
.home-session-name {
  font-size: 16px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.home-session-updated {
  font-size: 12px;
  color: var(--foreground-alt);
  white-space: nowrap;
}
.home-session-dot {
  width: 6px;
  height: 6px;
  min-width: 6px;
  border-radius: 50%;
  background: var(--success);
  align-self: center;
}
.session-page { max-width: 800px; padding-bottom: 80px; }
.session-messages { display: flex; flex-direction: column; gap: 16px; margin-bottom: 32px; }
.session-msg-user {
  background: var(--surface);
  padding: 8px;
  margin: 0 -8px;
  border-radius: var(--border-radius);
}
.session-msg-role { font-size: 12px; font-weight: 600; color: var(--foreground-alt); margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.04em; }
.session-msg-body.markdown > *:first-child { margin-top: 0; }
.session-msg-body.markdown > *:last-child { margin-bottom: 0; }
.session-msg-system { font-size: 13px; color: var(--foreground-alt); font-style: italic; }
.session-tool { padding: 0; border: 0; background: none; }
.session-tool summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}
.session-tool summary::-webkit-details-marker { display: none; }
.session-tool-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--foreground-alt);
  white-space: nowrap;
}
.session-tool-arg {
  font-size: 12px;
  color: var(--foreground);
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.session-tool-io { margin-top: 6px; }
.session-tool-io pre { white-space: pre-wrap; word-break: break-word; font-size: 12px; max-height: 240px; overflow: auto; }
.session-artefacts { display: flex; flex-direction: column; gap: 24px; margin-bottom: 32px; }
.session-artefact { border-top: 1px solid var(--border); padding-top: 16px; }
.artefact-frame { width: 100%; min-height: 280px; border: 1px solid var(--border); border-radius: var(--border-radius); background: #fff; }
.artefact-image { max-width: 100%; border-radius: var(--border-radius); }
.session-compose { position: sticky; bottom: 0; padding: 12px 0 8px; background: linear-gradient(transparent, var(--background) 24%); }
.auth {
  padding: 8px;
  max-width: 300px;
  margin: 20vh auto;
}

/* components */
.icon {
  width: 20px;
  height: 20px;
  min-width: 20px;
  vertical-align: middle;
  fill: none;
  stroke-width: 2px;
  stroke: currentColor;
}
.icon-small {
  width: 16px;
  height: 16px;
  min-width: 16px;
}
.button {
  cursor: pointer;
  display: inline-block;
  font-family: var(--font);
  color: var(--foreground);
  background: var(--background);
  padding: 0 10px;
  line-height: 30px;
  border: none;
  outline: none;
  font-size: 14px;
  border-radius: var(--border-radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.button:hover {
  background: var(--surface);
}
.button-danger {
  color: var(--danger);
  background: var(--alert-danger-bg);
  border-color: var(--danger);
}
.button-danger:hover {
  color: var(--danger);
  background: var(--alert-danger-bg);
  border-color: var(--danger);
}
.button-large {
  padding: 10px 14px;
  line-height: 20px;
  font-size: 16px;
}
.button-primary {
    color: var(--background);
    background: var(--primary);
    border-color: var(--primary);
}
.button.button-primary:hover {
  color: var(--background);
  background: var(--primary);
  border-color: var(--primary);
}
.input {
  font: var(--font);
  padding: 10px 14px;
  border: 1px solid var(--border);
  background: var(--background);
  font-size: 16px;
  outline: none;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
}
.input::placeholder {
  color: var(--placeholder);
}
.label {
  font-size: 14px;
  margin-bottom: 4px;
}
.title {
  font-size: 28px;
  margin: 0 0 16px;
}
.subtitle {
  font-size: 22px;
  margin: 0 0 8px;
}
.alert {
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 14px;
  border-radius: var(--border-radius);
}
.alert-success {
  background: var(--alert-success-bg);
  color: var(--success);
}
.alert-danger {
  background: var(--alert-danger-bg);
  color: var(--danger);
}
.table {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
}
.table table {
  width: 100%;
  border-collapse: collapse;
}
.table th, .table td {
  padding: 4px 8px;
  text-align: left;
  white-space: nowrap;
}
.table th {
  font-size: 14px;
  font-weight: bold;
  background: var(--surface);
}
.table td {
  border-top: 1px solid var(--border);
}
.table th:last-child,
.table td:last-child {
  text-align: right;
}
.table tr.table-group td {
  text-align: left;
  font-size: 14px;
  font-weight: bold;
  background: var(--surface);
}
.table td:last-child > .flex {
  justify-content: flex-end;
}
.tabs {
  display: inline-flex;
  gap: 4px;
  flex-wrap: wrap;
  padding: 4px;
  margin-bottom: 32px;
  background: var(--surface);
  border-radius: calc(var(--border-radius) + 4px);
}
.tabs a {
  display: inline-block;
  padding: 0 10px;
  line-height: 30px;
  font-size: 14px;
  font-weight: 500;
  color: var(--foreground-alt);
  border-radius: var(--border-radius);
  transition: color 300ms;
}
.tabs a:hover {
  color: var(--foreground);
}
.tabs a.active {
  color: var(--foreground);
  background: var(--background);
  box-shadow: var(--shadow);
}
.markdown { font-size: 14px; }
.markdown p:first-child { margin-top: 0; }
.markdown p:last-child { margin-bottom: 0; }
.markdown h1 { font-size: 22px; margin: 16px 0 8px; }
.markdown h2 { font-size: 18px; margin: 16px 0 8px; }
.markdown h3 { font-size: 16px; margin: 16px 0 8px; }
.markdown h4 { font-size: 14px; margin: 16px 0 8px; }
.markdown p, .markdown pre { margin: 8px 0; }
.markdown hr { margin: 16px 0; border: none; border-bottom: 1px solid var(--border); }
.markdown ul { margin: 8px 0; padding-left: 16px; }
.markdown ul ul { margin: 0; }
.markdown ol { padding-left: 20px; }
.markdown li p { margin: 0; }
.markdown blockquote { margin: 8px 0; padding: 8px; border-left: 4px solid var(--border); }
.markdown code { background: var(--surface); padding: 2px; border-radius: var(--border-radius); font-family: var(--font-mono); }
.markdown pre { background: var(--surface); padding: 8px; overflow-x: auto; font-size: 14px; border-radius: var(--border-radius); }
.markdown table { width: 100%; border-collapse: collapse; }
.markdown th { text-align: left; border-bottom: 2px solid var(--border); }
.markdown th, .markdown td { padding: 4px; border-bottom: 1px solid var(--border); }
.markdown-code-block { position: relative; margin: 8px 0; }
.markdown-code-block .markdown-code-block { margin: 0; }
.markdown-code-block pre { margin: 0; padding: 32px 8px 8px; }
.copy-button {
  position: absolute;
  top: 6px;
  right: 6px;
  border: 0;
  background: transparent;
  padding: 2px 4px;
  color: var(--foreground-alt);
  font: 12px var(--font);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.copy-button:hover { color: var(--foreground); }

/* utilities */
.hidden { display: none!important; }
.pointer { cursor: pointer; }
.relative { position: relative; }
.overflow-h { overflow: hidden; }
.scroll-x { overflow-x: auto; }
.scroll-y { overflow-y: auto; }
.w-full { width: 100%; }
.h-vfull { height: 100vh; }
.p-2 { padding: 8px; }
.p-4 { padding: 16px; }
.py-16 { padding: 48px; }
.py-20 { padding-top: 80px; padding-bottom: 80px; }
.m-0 { margin: 0; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.mb-8 { margin-bottom: 32px; }
.pt-4 { padding-top: 16px; }
.mb-10 { margin-bottom: 48px; }
.border, .border-r, .border-t, .border-b { border: 0 solid var(--border); }
.border { border-width: 1px; }
.border-t { border-top-width: 1px; }
.border-b { border-bottom-width: 1px; }
.border-r { border-right-width: 1px; }
.rounded { border-radius: var(--border-radius); overflow: hidden; }
.circle { border-radius: 100%; }
.block { display: block; }
.flex { display: flex; }
.items-center { align-items: center; }
.items-end { align-items: flex-end; }
.flex-column { flex-direction: column; }
.flex-1 { flex: 1; }
.flex-side { flex: 0 0 240px; width: 240px; }
main.flex-1 { min-width: 0; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }
.font-bold { font-weight: bold; }
.font-mono { font-family: var(--font-mono); }
.text-xs { font-size: 12px; }
.text-sm { font-size: 14px; }
.text-lg { font-size: 18px; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.text-center,
.table td.text-center,
.table th.text-center { text-align: center; }
.capitalize { text-transform: capitalize; }
.text-label { font-size: 12px; letter-spacing: -0.02em; text-transform: uppercase; font-weight: bold; opacity: 0.6; }
.text-faded,
.text-muted { opacity: 0.6; }
.truncate { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.primary { color: var(--primary); }
.bg-primary { background: var(--primary); }
.bg-surface { background: var(--surface); }
.positive { color: var(--success); }
.negative { color: var(--danger-strong); }
.badge { padding: 2px 6px; border-radius: 999px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.badge-success { background: var(--alert-success-bg); color: var(--foreground); }

* {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar) transparent;
}
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background-color: transparent;
}
::-webkit-scrollbar-thumb {
  border-radius: 100%;
  background: var(--scrollbar);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-hover);
}
