@font-face {
  font-family: "Hanken Grotesk";
  src: url("/assets/fonts/hanken-grotesk-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/assets/fonts/ibm-plex-mono-normal-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

/* The app's palettes (packages/ui-tokens); the 3270 screen is black in both themes. */
:root {
  --background: #080808;
  --foreground: #e8e6e3;
  --card: #111111;
  --muted: #8a8884;
  --strong-muted: #b8b6b2;
  --border: #1b1b1b;
  --input: #242424;
  --accent: #171717;
  --sidebar: #0c0c0c;
  --search: #161616;
  --field: #151515;
  --popover: #121212;
  --code: #151515;
  --track: #2a2a2a;
  --hover-border: #333333;
  --hover: rgba(255, 255, 255, 0.03);
  --window-border: rgba(255, 255, 255, 0.08);
  --primary: #edebe8;
  --primary-hover: #ffffff;
  --success: #4ecb71;
  --working: #6e9ef5;
  --link: #6e9ef5;
  --glow: rgba(255, 255, 255, 0.055);
  --footer-light: rgba(255, 255, 255, 0.1);
  --terminal: #000000;
  --t-text: #4be36a;
  --t-field: #4fd8d0;
  --t-highlight: #f2dc4b;
  --t-title: #7aa2ff;
  --t-input: #f4f4f2;
  --t-error: #ff6b6b;
  --sans: "Hanken Grotesk", ui-sans-serif, system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --background: #fafaf8;
  --foreground: #1a1a1a;
  --card: #ffffff;
  --muted: #6c6c70;
  --strong-muted: #45454a;
  --border: #dcdcd6;
  --input: #eaeae6;
  --accent: #eaeae6;
  --sidebar: #ececE9;
  --search: #e2e2dd;
  --field: #f3f3f0;
  --popover: #ffffff;
  --code: #f0f0ed;
  --track: #cfcfca;
  --hover-border: #c4c4be;
  --hover: rgba(0, 0, 0, 0.03);
  --window-border: rgba(0, 0, 0, 0.1);
  --primary: #1a1a1a;
  --primary-hover: #000000;
  --success: #1b7232;
  --working: #2563eb;
  --link: #2563eb;
  --glow: rgba(0, 0, 0, 0.035);
  --footer-light: transparent;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--background);
  color: var(--foreground);
  font: 16px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--working); outline-offset: 2px; }

/* ---- Page ---------------------------------------------------------------------------------- */

.top, .hero, .features, .download, .site-footer {
  width: min(1240px, 100% - 32px);
  margin-inline: auto;
}
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0;
}
.brand { display: flex; align-items: center; gap: 10px; font-size: 19px; font-weight: 600; letter-spacing: -0.01em; }
.brand-link { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand .wordmark { display: block; height: 24px; width: auto; }
.wordmark.for-light, :root[data-theme="light"] .wordmark.for-dark { display: none; }
:root[data-theme="light"] .wordmark.for-light { display: block; }
.theme-switch { display: inline-flex; gap: 2px; padding: 3px; border-radius: 999px; background: var(--accent); }
.theme-switch button { display: grid; place-items: center; width: 34px; height: 28px; padding: 0; border: 0; border-radius: 999px; background: none; color: var(--muted); cursor: pointer; }
.theme-switch button:hover { color: var(--foreground); }
.theme-switch button[aria-checked="true"] { background: var(--card); color: var(--foreground); }
.footer-brand .brand .wordmark { height: 22px; }
.brand-divider { width: 1px; height: 20px; background: var(--input); }
.beta {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.top nav { display: flex; align-items: center; gap: 22px; font-size: 15px; }
.top nav a { text-decoration: none; color: var(--muted); }
.top nav a:hover { color: var(--foreground); }
.top nav .pill { color: var(--foreground); border: 1px solid var(--input); border-radius: 8px; padding: 6px 14px; background: var(--card); }

.hero { padding: clamp(16px, 3vw, 40px) 0 48px; }
.hero h1 {
  max-width: 640px;
  margin: 0;
  font-size: clamp(30px, 4.2vw, 44px);
  font-weight: 400;
  line-height: 1.06;
  letter-spacing: -0.035em;
}
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 36px; }
.button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 22px;
  border: 1px solid var(--input);
  border-radius: 10px;
  background: var(--card);
  text-decoration: none;
  font-size: 16px;
}
.button:hover { background: var(--accent); border-color: var(--hover-border); }
.button.primary { background: var(--primary); color: var(--background); border-color: var(--primary); }
.button.primary:hover { background: var(--primary-hover); }
.hint { margin: 14px 0 0; color: var(--muted); font-size: 14px; }

/* A painted-looking landscape behind the window, the way Cursor frames theirs. */
.stage {
  width: min(1320px, 100% - 32px);
  margin-inline: auto;
  padding: clamp(14px, 4.5vw, 64px);
  border-radius: 6px;
  background:
    linear-gradient(100deg, rgba(196, 178, 140, 0.35), transparent 45%, rgba(120, 138, 146, 0.3)),
    linear-gradient(180deg, #c9bea6 0%, #aab0a8 34%, #8a9396 52%, #6d7470 70%, #5a5e58 100%);
  position: relative;
  overflow: hidden;
  scroll-margin-top: 16px;
}
.stage::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.22;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  pointer-events: none;
}
.demo { position: relative; }
.noscript { margin: 0; padding: 80px 24px; text-align: center; background: var(--background); border-radius: 6px; }

/* Features: four cells on hairlines, with a plus where the lines cross. */
.features { padding: 120px 0 24px; }
.features-head { max-width: 680px; margin: 0 auto 56px; text-align: center; }
.features-head h2 { margin: 0 0 14px; font-size: clamp(30px, 4.2vw, 48px); font-weight: 400; line-height: 1.06; letter-spacing: -0.035em; }
.features-head p { margin: 0; color: var(--muted); font-size: 17px; line-height: 1.6; }
.features-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.feature {
  position: relative;
  padding: 44px 32px 48px;
  border-left: 1px solid var(--border);
  background: radial-gradient(70% 55% at 30% 0%, var(--glow), transparent 100%);
}
.feature:last-child { border-right: 1px solid var(--border); }
.feature::before {
  content: "";
  position: absolute;
  top: -7px;
  left: -7px;
  width: 13px;
  height: 13px;
  background:
    linear-gradient(var(--muted), var(--muted)) center / 1px 100% no-repeat,
    linear-gradient(var(--muted), var(--muted)) center / 100% 1px no-repeat;
  opacity: 0.6;
}
.feature-icon { display: grid; place-items: center; width: 46px; height: 46px; border: 1px solid var(--input); border-radius: 12px; background: var(--card); color: var(--foreground); }
.feature h3 { margin: 40px 0 10px; font-size: 18px; font-weight: 500; letter-spacing: -0.01em; }
.feature p { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.6; }

/* Integrations: logo tiles on a checkerboard that fades out at the edges. */
.integrations { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 48px; padding: 120px 0 24px; }
.integrations h2 { margin: 0 0 18px; font-size: clamp(30px, 4.2vw, 44px); font-weight: 400; line-height: 1.06; letter-spacing: -0.035em; }
.integrations p { max-width: 480px; margin: 0; color: var(--muted); font-size: 18px; line-height: 1.6; }
.tiles {
  position: relative;
  --cell: 72px;
  width: calc(var(--cell) * 5);
  height: calc(var(--cell) * 5);
  -webkit-mask-image: radial-gradient(ellipse at center, #000 62%, transparent 92%);
  mask-image: radial-gradient(ellipse at center, #000 62%, transparent 92%);
}
.tile {
  position: absolute;
  left: calc(var(--c) * var(--cell));
  top: calc(var(--r) * var(--cell));
  display: grid;
  place-items: center;
  width: var(--cell);
  height: var(--cell);
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
  color: var(--foreground);
}
.integrations { width: min(1240px, 100% - 32px); margin-inline: auto; }

/* Download: a large panel on hairlines, plus marks at the corners, a light from the top left. */
.no-mainframe { width: min(1240px, 100% - 32px); margin: 0 auto; padding: 160px 0 40px; text-align: center; }
.no-mainframe h2 { margin: 0 0 28px; font-size: clamp(56px, 11vw, 160px); font-weight: 800; line-height: 0.92; letter-spacing: -0.05em; }
.no-mainframe p { max-width: 560px; margin: 0 auto 32px; color: var(--muted); font-size: 18px; line-height: 1.6; }
.no-mainframe .button { padding: 14px 26px; font-size: 17px; }
.download { padding: 120px 0 104px; scroll-margin-top: 24px; }
.cta {
  position: relative;
  isolation: isolate;
  max-width: 1040px;
  margin: 0 auto;
  padding: 88px 48px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: radial-gradient(35% 80% at 25% 0%, var(--glow), transparent);
  text-align: center;
}
.cta::before, .cta::after { content: ""; position: absolute; top: -28px; bottom: -28px; width: 1px; background: var(--border); }
.cta::before { left: -1px; }
.cta::after { right: -1px; }
.cta-center { position: absolute; z-index: -1; top: 0; bottom: 0; left: 50%; border-left: 1px dashed var(--border); }
.corner {
  position: absolute;
  width: 17px;
  height: 17px;
  background:
    linear-gradient(var(--muted), var(--muted)) 8px 0 / 1px 100% no-repeat,
    linear-gradient(var(--muted), var(--muted)) 0 8px / 100% 1px no-repeat;
  opacity: 0.7;
}
.corner { z-index: 1; transform: translate(-50%, -50%); }
.corner.tl { top: 0; left: 0; }
.corner.tr { top: 0; left: 100%; }
.corner.bl { top: 100%; left: 0; }
.corner.br { top: 100%; left: 100%; }
.cta h2 { margin: 0; font-size: clamp(36px, 5.4vw, 64px); font-weight: 400; line-height: 1.04; letter-spacing: -0.035em; }
.version { margin: 18px 0 0; color: var(--muted); font-size: 18px; }
.version a { color: var(--foreground); text-decoration: none; }
.version a:hover { text-decoration: underline; text-underline-offset: 3px; }
.cta-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 36px; }
.cta-actions .button { padding: 14px 26px; font-size: 17px; }
.files { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 72px -48px 0; padding: 0; list-style: none; border-top: 1px solid var(--border); background: var(--background); }
.files li { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 26px 16px 28px; }
.files li + li { border-left: 1px solid var(--border); }
.files span { font-size: 16px; font-weight: 500; }
.files small { color: var(--muted); font-size: 14px; }
.files a { margin-top: 12px; color: var(--foreground); font-size: 14.5px; text-decoration: none; }
.files a:hover { text-decoration: underline; text-underline-offset: 3px; }
.note { max-width: 680px; margin: 36px auto 0; color: var(--muted); font-size: 14.5px; line-height: 1.6; text-align: center; }
.note strong { color: var(--foreground); font-weight: 500; }

/* FAQ: a heavy heading on the left, questions that open on the right. */
.faq { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 56px; width: min(1240px, 100% - 32px); margin: 0 auto; padding: 40px 0 104px; }
.faq-intro h2 { margin: 0 0 22px; font-size: clamp(40px, 6vw, 72px); font-weight: 800; line-height: 0.98; letter-spacing: -0.04em; }
.faq-intro p { max-width: 460px; margin: 0 0 16px; color: var(--muted); font-size: 17px; line-height: 1.6; }
.faq-intro a { color: var(--foreground); text-decoration: none; }
.faq-intro a:hover { text-decoration: underline; text-underline-offset: 3px; }
.faq-list { position: relative; align-self: center; border-top: 1px solid var(--border); }
.faq-list::before { content: ""; position: absolute; top: 0; bottom: 0; left: 12px; width: 1px; background: var(--border); }
.faq-item { position: relative; padding-left: 28px; border-bottom: 1px solid var(--border); }
.faq-item::after {
  content: "";
  position: absolute;
  bottom: -7px;
  left: 6px;
  width: 13px;
  height: 13px;
  background:
    linear-gradient(var(--muted), var(--muted)) center / 1px 100% no-repeat,
    linear-gradient(var(--muted), var(--muted)) center / 100% 1px no-repeat;
  opacity: 0.6;
}
.faq-item:last-child::after { display: none; }
.faq-item summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px 8px 20px 0; font-size: 17px; font-weight: 500; list-style: none; cursor: pointer; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary svg { flex: none; color: var(--muted); }
.faq-item[open] summary svg { transform: rotate(180deg); }
.faq-item summary:hover, .faq-item summary:focus-visible { text-decoration: underline; text-underline-offset: 4px; outline: 0; }
.faq-item p { margin: -6px 0 0; padding: 0 36px 22px 0; color: var(--muted); font-size: 15.5px; line-height: 1.65; }
@media (max-width: 900px) {
  .faq { grid-template-columns: 1fr; gap: 32px; padding-top: 24px; }
}

/* Footer: a rounded top edge with a soft light at its centre. */
.site-footer {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 24px;
  padding: 0 32px;
  border-top: 1px solid var(--border);
  border-radius: 48px 48px 0 0;
  background: radial-gradient(35% 128px at 50% 0%, var(--footer-light), transparent);
}
.footer-glow { position: absolute; top: 0; left: 50%; width: 33%; height: 1px; border-radius: 999px; background: var(--foreground); opacity: 0.2; filter: blur(4px); transform: translate(-50%, -50%); }
.footer-grid { display: grid; grid-template-columns: 1fr 2fr; gap: 32px; width: 100%; padding: 44px 0 40px; }
.footer-brand .brand { font-size: 17px; }
.footer-brand p { margin: 18px 0 22px; color: var(--muted); font-size: 14.5px; }
.footer-links { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 32px; }
.footer-links h2 { margin: 0 0 16px; font-size: 13px; font-weight: 500; }
.footer-links ul { margin: 0; padding: 0; list-style: none; font-size: 14.5px; }
.footer-links li + li { margin-top: 10px; }
.footer-links a { color: var(--muted); text-decoration: none; }
.footer-links a:hover { color: var(--foreground); }
.footer-rule { width: 100%; height: 1px; background: linear-gradient(90deg, transparent, var(--border), transparent); }
.footer-copy { margin: 0; padding: 18px 0 28px; color: var(--muted); font-size: 14px; }
/* Each column fades up once, in turn, when the footer comes into view. */
.reveal { opacity: 0; filter: blur(4px); transform: translateY(-8px); }
.reveal.shown { opacity: 1; filter: none; transform: none; transition: opacity 0.8s ease var(--delay, 0s), filter 0.8s ease var(--delay, 0s), transform 0.8s ease var(--delay, 0s); }

@media (max-width: 1000px) {
  .footer-grid { grid-template-columns: 1fr; gap: 40px; }
}
@media (max-width: 900px) {
  .features { padding-top: 88px; }
  .features-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .feature:nth-child(2n) { border-right: 1px solid var(--border); }
  .feature:nth-child(n + 3) { border-top: 1px solid var(--border); }
  .integrations { grid-template-columns: 1fr; gap: 32px; padding-top: 88px; justify-items: center; text-align: center; }
  .integrations p { margin-inline: auto; }
  .tiles { --cell: 62px; }
  .download { padding-top: 88px; }
  .cta { padding: 56px 20px 0; }
  .files { grid-template-columns: 1fr; margin: 48px -20px 0; }
  .files li + li { border-left: 0; border-top: 1px solid var(--border); }
}
@media (max-width: 560px) {
  .top nav a:not(.pill) { display: none; }
  .top .brand { gap: 8px; font-size: 17px; }
  .top .brand .wordmark { height: 19px; }
  .features-grid { grid-template-columns: 1fr; }
  .feature { border-right: 1px solid var(--border); padding: 32px 24px 36px; }
  .feature + .feature { border-top: 1px solid var(--border); }
  .feature h3 { margin-top: 28px; }
  .actions .button { width: 100%; justify-content: center; }
  .site-footer { padding: 0 20px; border-radius: 32px 32px 0 0; }
  .footer-links { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---- Privacy ------------------------------------------------------------------------------ */

.legal, .legal-footer { width: min(680px, 100% - 32px); margin-inline: auto; }
.legal { padding: 40px 0 64px; }
.legal h1 { margin: 0 0 12px; font-size: clamp(30px, 4vw, 40px); font-weight: 400; letter-spacing: -0.035em; line-height: 1.06; }
.legal-lede { color: var(--muted); }
.legal h2 { margin: 36px 0 8px; font-size: 17px; font-weight: 500; }
.legal p { margin: 0 0 12px; color: var(--strong-muted); }
.legal code { font-family: var(--mono); font-size: 14px; }
.legal a { color: var(--link); text-decoration: none; }
.legal a:hover { text-decoration: underline; }
.legal-footer { display: flex; justify-content: space-between; padding: 24px 0 40px; border-top: 1px solid var(--border); color: var(--muted); font-size: 14px; }
.legal-footer a { text-decoration: none; }

/* ---- The app window ------------------------------------------------------------------------ */

.app {
  position: relative;
  display: flex;
  flex-direction: column;
  height: min(720px, 88vh);
  min-height: 580px;
  border: 1px solid var(--window-border);
  border-radius: 12px;
  background: var(--card);
  overflow: hidden;
  font-size: 14px;
  line-height: 1.5;
}
.app-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr) 340px;
}
.app.no-panel .app-body { grid-template-columns: 84px minmax(0, 1fr); }
.app.list-open .app-body { grid-template-columns: 300px minmax(0, 1fr) 330px; }
.app.list-open.no-panel .app-body { grid-template-columns: 300px minmax(0, 1fr); }
.app.no-panel .panel { display: none; }
.rail, .chat, .panel { min-height: 0; background: var(--card); }

.icon-button { position: relative; display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 9px; background: none; color: var(--muted); cursor: pointer; }
.icon-button:hover, .icon-button[aria-expanded="true"], .icon-button[aria-pressed="true"] { background: var(--accent); color: var(--foreground); }
.pick { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 8px; border: 0; border-radius: 8px; background: none; color: var(--muted); font-size: 14px; cursor: pointer; white-space: nowrap; }
.pick:hover, .pick[aria-expanded="true"] { background: var(--accent); color: var(--foreground); }

/* Rail of agents */
.rail { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 0; overflow: hidden; }
.rail-top { flex: none; display: flex; flex-direction: column; align-items: center; gap: 4px; margin-bottom: 6px; }
.app.list-open .rail { align-items: stretch; padding: 12px 10px; }
.app.list-open .rail-top { flex-direction: row; justify-content: space-between; padding: 0 4px; }
.bots { flex: 0 1 auto; min-height: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; margin: 0; padding: 0; list-style: none; overflow-y: auto; scrollbar-width: none; }
.app.list-open .bots { align-items: stretch; gap: 2px; }
.bots button { position: relative; display: grid; place-items: center; width: 58px; height: 58px; padding: 0; border: 2px solid transparent; border-radius: 16px; background: none; cursor: pointer; }
.bots button:hover { background: var(--hover); }
.bots button[aria-current] { border-color: var(--link); background: var(--accent); }
.dot { position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--foreground); box-shadow: 0 0 0 2px var(--card); }
.app.list-open .bots button { display: flex; justify-content: flex-start; align-items: center; gap: 14px; width: 100%; height: auto; padding: 12px 14px; border: 0; border-radius: 18px; text-align: start; }
.app.list-open .bots button[aria-current] { background: var(--accent); }
.app.list-open .dot { top: auto; right: 12px; bottom: 16px; }
.bot-text { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 3px; }
.bot-line { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.bot-name { flex: 0 1 auto; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 16px; font-weight: 600; letter-spacing: -0.005em; }
.bot-title { min-width: 0; flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--muted); font-size: 14px; }
.bot-time { flex: none; margin-left: auto; color: var(--muted); font-size: 13px; }
.bot-preview { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; padding-right: 10px; color: var(--muted); font-size: 14.5px; line-height: 1.45; }
.bot-preview:empty { display: none; }
.bot-preview.needs-you { color: var(--foreground); }
.rail-connection { display: flex; align-items: center; justify-content: center; gap: 8px; width: 40px; height: 34px; margin-top: auto; padding: 0; border: 0; border-radius: 9px; background: none; color: var(--muted); font-size: 12.5px; cursor: pointer; }
.rail-connection:hover, .rail-connection[aria-expanded="true"] { background: var(--accent); color: var(--foreground); }
.rail-connection-text { display: none; white-space: nowrap; }
.app.list-open .rail-connection { justify-content: flex-start; width: auto; padding: 0 12px; }
.app.list-open .rail-connection-text { display: inline; color: var(--foreground); }
.rail-connection-text span { color: var(--muted); }

.avatar { flex: none; overflow: visible; }
.avatar.working { filter: drop-shadow(0 0 5px currentColor); animation: bob 1.4s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-1.5px) scale(1.04); } }
.group-avatar { position: relative; flex: none; display: inline-block; }
.group-avatar .avatar { position: absolute; }
.group-avatar .avatar:nth-child(1) { top: 0; left: 20%; }
.group-avatar .avatar:nth-child(2) { bottom: 6%; left: 0; }
.group-count { position: absolute; right: 0; bottom: 6%; display: grid; place-items: center; border-radius: 50%; background: var(--input); color: var(--foreground); font-weight: 600; line-height: 1; }

/* Chat */
.chat { position: relative; display: flex; flex-direction: column; overflow: hidden; }
.chat-header { flex: none; display: flex; align-items: center; gap: 10px; height: 56px; padding: 0 12px 0 22px; }
.header-tools { flex: none; display: flex; align-items: center; gap: 6px; margin-left: auto; }
.header-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; font-size: 15px; font-weight: 500; white-space: nowrap; }
.tabs { display: none; }
.transcript { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 22px 8px; font-size: 15px; scrollbar-width: thin; scrollbar-color: var(--track) transparent; }
.transcript > div + div { margin-top: 10px; }
.transcript p { margin: 0; }
.transcript p + p, .transcript ul + p, .transcript p + ul, .transcript p + pre { margin-top: 10px; }
.transcript ul { margin: 0; padding-left: 18px; }
.transcript li + li { margin-top: 3px; }
.transcript strong { font-weight: 600; }
.transcript code { white-space: nowrap; font-family: var(--mono); font-size: 12.5px; padding: 1px 4px; border-radius: 4px; background: var(--input); }
.transcript pre { margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--card); font: 12px/1.6 var(--mono); white-space: pre-wrap; word-break: break-word; }
.transcript .link { color: var(--link); text-decoration: none; }
.transcript .link:hover { text-decoration: underline; }
.msg-time { margin: 16px 0 6px; text-align: center; color: var(--muted); font-size: 13px; }
.transcript > .msg-time:first-child { margin-top: 4px; }
.msg-user { display: flex; justify-content: flex-end; }
.msg-user > div { max-width: 80%; padding: 10px 18px; border-radius: 22px; color: #0b0b0b; font-weight: 500; }
.msg-bot .bubble { width: fit-content; max-width: 88%; padding: 12px 18px; border-radius: 18px; background: var(--field); }
.byline { display: flex; align-items: center; gap: 7px; margin: 0 0 6px 4px; font-size: 12.5px; font-weight: 500; }
.table { width: fit-content; max-width: 100%; margin: 0; overflow: hidden; border-radius: 14px; background: var(--field); }
.table figcaption { display: flex; justify-content: space-between; gap: 16px; padding: 9px 14px 4px; color: var(--muted); font-size: 12.5px; }
.table figcaption span:first-child { color: var(--strong-muted); font-family: var(--mono); }
.table-scroll { max-height: 220px; overflow: auto; scrollbar-width: thin; scrollbar-color: var(--track) transparent; }
.table table { border-collapse: collapse; font-size: 12.5px; }
.table th { position: sticky; top: 0; padding: 6px 14px; background: var(--field); color: var(--muted); font-weight: 500; text-align: start; }
.table td { padding: 4px 14px; font-family: var(--mono); white-space: nowrap; color: var(--strong-muted); }
.table td:first-child { color: var(--foreground); }
.table tbody tr:last-child td { padding-bottom: 10px; }
.tool { display: flex; align-items: center; gap: 7px; min-width: 0; padding-left: 4px; font-size: 14px; color: var(--muted); white-space: nowrap; }
.tool + .tool { margin-top: 3px; }
.tool-verb { color: var(--strong-muted); }
.tool-target { overflow: hidden; text-overflow: ellipsis; font-family: var(--mono); font-size: 12.5px; }
.tool-mark { flex: none; width: 11px; height: 11px; border-radius: 50%; border: 1.5px solid var(--track); }
.tool.running .tool-mark { border-top-color: var(--foreground); animation: spin 0.8s linear infinite; }
.tool.running .tool-verb { color: var(--foreground); }
@keyframes spin { to { transform: rotate(360deg); } }
.handoff { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding-left: 4px; color: var(--muted); font-size: 13.5px; }
.handoff span { display: inline-flex; align-items: center; gap: 5px; color: var(--foreground); }
.open-bot { display: inline-flex; align-items: center; gap: 7px; margin-top: 12px; padding: 6px 12px; border: 0; border-radius: 999px; background: var(--input); font-size: 13px; cursor: pointer; }
.open-bot:hover { background: var(--hover-border); }

.approval { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 9px; min-width: 0; padding: 10px 10px 10px 16px; border-radius: 14px; background: var(--field); color: var(--muted); }
.approval > svg { flex: none; }
.approval-target { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--foreground); font-size: 14px; }
.approval-diff, .approval-kind { flex: none; font-size: 13.5px; white-space: nowrap; }
.approval-diff .add { color: var(--success); }
.approval-diff .del { color: var(--t-error); }
.approval-actions { flex: none; display: flex; gap: 6px; margin-left: auto; }
.approval-actions button { padding: 5px 13px; border: 0; border-radius: 8px; background: var(--input); font-size: 13px; font-weight: 500; cursor: pointer; }
.approval-actions .btn-approve { background: var(--primary); color: var(--background); }
.approval-actions .btn-approve:hover { background: var(--primary-hover); }
.approval-actions .btn-deny:hover { background: var(--hover-border); }
.approval-result { flex: none; margin-left: auto; font-size: 13px; }
.approval-result.approved { color: var(--success); }

.starters { flex: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0 22px; }
.starters:not(:empty) { padding-bottom: 10px; }
.starters button { padding: 6px 12px; border: 1px solid var(--input); border-radius: 999px; background: none; font-size: 12.5px; text-align: start; cursor: pointer; }
.starters button:hover { background: var(--accent); border-color: var(--hover-border); }

.composer { flex: none; margin: 0 16px 16px; padding: 10px 10px 8px 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--field); }
.composer input { display: block; width: 100%; height: 30px; padding: 0; border: 0; outline: 0; background: none; color: var(--foreground); font: inherit; font-size: 15px; }
.composer input::placeholder { color: var(--muted); }
.composer-tools { display: flex; align-items: center; gap: 4px; margin-top: 6px; }
.mode-pill { flex: none; border-radius: 999px; background: var(--input); padding: 0 10px; }
.composer-tools [data-menu="model"] { min-width: 0; }
.pick-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.send { flex: none; display: grid; place-items: center; width: 30px; height: 30px; margin-left: auto; padding: 0; border: 0; border-radius: 50%; background: var(--input); color: var(--foreground); cursor: pointer; }
.send:hover { background: var(--primary); color: var(--background); }
.composer.busy .send { color: var(--muted); background: var(--input); cursor: default; }

/* Menus */
.popover { position: absolute; z-index: 20; min-width: 230px; max-width: 300px; max-height: 340px; overflow-y: auto; padding: 6px; border: 1px solid var(--window-border); border-radius: 12px; background: var(--popover); font-size: 13.5px; }
.popover[hidden] { display: none; }
.popover button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 10px; border: 0; border-radius: 8px; background: none; color: var(--foreground); text-align: start; cursor: pointer; }
.popover button:hover, .popover button:focus-visible, .popover .menu-link:hover, .popover .menu-link:focus-visible { background: var(--accent); outline: 0; }
.popover button > span { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.popover button > svg:not(.avatar) { flex: none; color: var(--muted); }
.popover .mark { flex: none; }
.menu-label { padding: 8px 10px 4px; color: var(--muted); font-size: 12px; }
.menu-title { display: block; color: var(--foreground); }
.menu-hint { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 12.5px; }
.menu-text .menu-hint { white-space: normal; }
.menu-text, .menu-empty { padding: 8px 10px; color: var(--muted); }
.menu-link { display: block; padding: 7px 10px; border-radius: 8px; color: var(--link); text-decoration: none; }
.new-bot { display: flex; gap: 6px; padding: 4px 4px 6px; }
.new-bot input { flex: 1; min-width: 0; height: 34px; padding: 0 10px; border: 1px solid var(--border); border-radius: 8px; outline: 0; background: var(--field); color: var(--foreground); font: inherit; }
.new-bot input:focus { border-color: var(--hover-border); }
.popover .new-bot-create { flex: none; width: auto; padding: 0 14px; background: var(--primary); color: var(--background); font-weight: 500; }
.popover .new-bot-create:hover { background: var(--primary-hover); }

/* Mainframe: a small screen on the right */
.panel { position: relative; display: flex; flex-direction: column; gap: 10px; padding: 12px 20px 16px; overflow-y: auto; }
.panel-top { flex: none; display: flex; justify-content: flex-end; gap: 4px; margin-right: -8px; }
.thumb { display: block; width: 100%; padding: 0; border: 0; border-radius: 14px; background: none; cursor: zoom-in; }
.thumb:hover .screen { outline: 2px solid var(--hover-border); outline-offset: 2px; }
.screen { overflow: auto; border-radius: 12px; background: var(--terminal); color: var(--t-text); font: 12.5px/1.5 var(--mono); scrollbar-width: thin; scrollbar-color: #222 transparent; }
.screen.mini { display: block; aspect-ratio: 16 / 10; overflow: hidden; font-size: 7px; text-align: start; pointer-events: none; }
.screen-inner { width: max-content; min-width: 100%; padding: 10px 12px; white-space: pre; }
.screen-title { display: flex; justify-content: space-between; gap: 24px; min-width: 80ch; }
.thumb-caption { display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--strong-muted); font-size: 14px; }
.thumb-meta { margin-top: -6px; text-align: center; color: var(--muted); font-size: 12.5px; }
.caption-status { color: var(--t-highlight); }
:root[data-theme="light"] .caption-status { color: #8f5a0e; }
.caption-review { padding: 2px 10px; border: 0; border-radius: 6px; background: var(--input); font-size: 12.5px; cursor: pointer; }
.panel-label { margin-top: 14px; color: var(--muted); font-size: 13px; }
.live { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--working); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }
.t-title { color: var(--t-title); }
.t-field { color: var(--t-field); }
.t-highlight { color: var(--t-highlight); }
.t-error { color: var(--t-error); }
.t-input { color: var(--t-input); }
.caret { display: inline-block; width: 0.6em; height: 1.1em; margin-left: 1px; vertical-align: -0.2em; background: var(--t-input); animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.waiting { margin: 4px 0; font-family: var(--sans); font-size: 13px; color: var(--t-highlight); white-space: normal; }
.waiting button { margin-left: 10px; padding: 2px 10px; border: 1px solid #444; border-radius: 6px; background: none; color: var(--t-input); font-size: 12px; cursor: pointer; }
.idle { padding: 28px 0; text-align: center; font-family: var(--sans); color: var(--t-field); }
.commands { flex: none; margin: 0; padding: 0; list-style: none; }
.commands button { display: block; width: 100%; padding: 3px 0; border: 0; background: none; color: var(--muted); font: 13px/1.6 var(--mono); text-align: start; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.commands button:hover, .commands button[aria-current] { color: var(--foreground); text-decoration: underline; text-underline-offset: 3px; }

/* The screen, opened */
.expanded-view { position: absolute; z-index: 15; inset: 0; display: flex; padding: 64px 24px 24px; background: var(--card); }
.expanded-view[hidden] { display: none; }
.expanded-view .screen { flex: 1; min-height: 0; font-size: 13.5px; }
@media (pointer: fine) { .expanded-view, .expanded-view * { cursor: none; } }
.expanded-close { position: absolute; top: 14px; right: 22px; display: grid; place-items: center; width: 38px; height: 38px; padding: 0; border: 0; border-radius: 50%; background: var(--input); color: var(--foreground); }
.expanded-close:hover { background: var(--hover-border); }
.you-cursor { position: absolute; top: 0; left: 0; z-index: 2; display: none; pointer-events: none; will-change: transform; }
.you-cursor.shown { display: block; }
.you-cursor svg { display: block; }
.you-cursor span { position: absolute; top: 18px; left: 12px; padding: 2px 9px; border-radius: 999px; background: #111; color: #fff; font: 500 13px/1.5 var(--sans); white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
  .avatar.working, .live, .caret, .tool.running .tool-mark { animation: none; }
}

/* Narrower windows: chat and mainframe share one column behind tabs. */
@media (max-width: 1100px) {
  .app-body, .app.no-panel .app-body { grid-template-columns: 84px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
  .app.list-open .app-body, .app.list-open.no-panel .app-body { grid-template-columns: 260px minmax(0, 1fr); }
  .app.no-panel .panel { display: flex; }
  .chat, .panel { grid-column: 2; grid-row: 1; }
  .app[data-view="chat"] .panel { visibility: hidden; }
  .app[data-view="mainframe"] .chat { visibility: hidden; }
  .app[data-view="mainframe"] .panel { padding-top: 64px; }
  .panel-top [data-toggle="panel"], .panel-toggle { display: none; }
  .header-tools { margin-right: 0; }
  .chat-header { padding-right: 190px; }
  .tabs {
    display: flex;
    position: absolute;
    z-index: 2;
    top: 11px;
    right: 12px;
    padding: 3px;
    gap: 2px;
    border: 1px solid var(--input);
    border-radius: 999px;
    background: var(--card);
    visibility: visible;
  }
  .tabs button { padding: 4px 12px; border: 0; border-radius: 999px; background: none; color: var(--muted); font-size: 12.5px; cursor: pointer; }
  .tabs button[aria-selected="true"] { background: var(--accent); color: var(--foreground); }
}
@media (max-width: 720px) {
  .app { height: 640px; min-height: 0; font-size: 13.5px; }
  .app-body, .app.no-panel .app-body, .app.list-open .app-body, .app.list-open.no-panel .app-body { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .rail, .app.list-open .rail { flex-direction: row; align-items: center; gap: 4px; padding: 8px; overflow-x: auto; scrollbar-width: none; }
  .rail-top [data-toggle="list"], .bot-text, .rail-connection-text { display: none !important; }
  .rail-top { order: 2; margin: 0; }
  .bots, .app.list-open .bots { flex-direction: row; align-items: center; gap: 4px; overflow: visible; }
  .bots button, .app.list-open .bots button { width: 52px; height: 52px; padding: 0; justify-content: center; border: 2px solid transparent; }
  .app.list-open .bots button[aria-current] { border-color: var(--link); }
  .app.list-open .dot { top: 6px; right: 6px; bottom: auto; }
  .rail-connection, .app.list-open .rail-connection { order: 3; width: 40px; padding: 0; justify-content: center; }
  .rail-connection { margin: 0 0 0 auto; }
  .chat, .panel { grid-column: 1; grid-row: 2; }
  .chat-header { padding-right: 176px; padding-left: 16px; }
  .chat-header .avatar, .chat-header .group-avatar, .header-tools .pick .pick-label { display: none; }
  .transcript { padding: 8px 14px; font-size: 14px; }
  .composer { margin: 0 10px 10px; }
  .msg-bot .bubble, .msg-user > div { max-width: 92%; }
  .expanded-view { padding: 56px 10px 10px; }
  .expanded-view .screen { font-size: 10.5px; }
  .expanded-close { top: 10px; right: 12px; }
}
