/* Bots: a calm roster of faces and a chat with each. Colors and sizes follow Grok Bot's desktop app. */

:root {
  color-scheme: light;
  --side: #f6f6f5;
  --main: #ffffff;
  --panel: #ffffff;
  --card-line: rgba(0, 0, 0, 0.1);
  --link: #1f6fe5;
  --line: rgba(0, 0, 0, 0.08);
  --hover: rgba(0, 0, 0, 0.04);
  --active: rgba(0, 0, 0, 0.07);
  --bubble: #f0f0ef;
  --bubble-text: #0d0d0d;
  --user-bubble: #2a2a2a;
  --user-text: #ffffff;
  --pill: rgba(0, 0, 0, 0.035);
  --pill-line: rgba(0, 0, 0, 0.08);
  --field: #ffffff;
  --field-line: rgba(0, 0, 0, 0.1);
  --composer: #f3f3f2;
  --composer-line: rgba(0, 0, 0, 0.08);
  --plus: rgba(0, 0, 0, 0.07);
  --send: #111111;
  --send-icon: #ffffff;
  --text: #0d0d0d;
  --text-2: rgba(0, 0, 0, 0.55);
  --text-3: rgba(0, 0, 0, 0.38);
  --unread: #2f7cf6;
  --green: #178a43;
  --amber: #c9761a;
  --amber-bg: rgba(241, 157, 56, 0.16);
  --violet: #7a4cf0;
  --danger: #d93a2b;
  --eye: #141414;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);
  /* Small things that float over a chat: the day, the way down, search and the rail's previews. */
  --float: #ffffff;
  --float-line: rgba(0, 0, 0, 0.08);
  --float-hover: #f6f6f5;
  --float-shadow: 0 4px 14px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.06);
  --hairline: 1px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --side: #111111;
    --main: #070707;
    --panel: #070707;
    --card-line: rgba(255, 255, 255, 0.16);
    --link: #54a8ff;
    --line: rgba(255, 255, 255, 0.1);
    --hover: rgba(255, 255, 255, 0.06);
    --active: rgba(255, 255, 255, 0.135);
    --bubble: #262626;
    --bubble-text: #ffffff;
    --user-bubble: #5a5a5a;
    --user-text: #ffffff;
    --pill: rgba(255, 255, 255, 0.07);
    --pill-line: rgba(255, 255, 255, 0.1);
    --field: rgba(255, 255, 255, 0.06);
    --field-line: rgba(255, 255, 255, 0.08);
    --composer: #2f2f2f;
    --composer-line: rgba(255, 255, 255, 0.12);
    --plus: rgba(255, 255, 255, 0.1);
    --send: #ffffff;
    --send-icon: #0b0b0b;
    --text: #ffffff;
    --text-2: rgba(255, 255, 255, 0.62);
    --text-3: rgba(255, 255, 255, 0.4);
    --unread: #3b8cf6;
    --green: #30d158;
    --amber: #f19d38;
    --amber-bg: rgba(241, 157, 56, 0.14);
    --violet: #9b78ff;
    --danger: #ff5a4b;
    --shadow: 0 16px 48px rgba(0, 0, 0, 0.6), 0 2px 8px rgba(0, 0, 0, 0.4);
    --float: #1c1c1c;
    --float-line: rgba(255, 255, 255, 0.12);
    --float-hover: #262626;
    --float-shadow: 0 4px 16px rgba(0, 0, 0, 0.5), 0 1px 3px rgba(0, 0, 0, 0.4);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --side: #111111;
  --main: #070707;
  --panel: #070707;
  --card-line: rgba(255, 255, 255, 0.16);
  --link: #54a8ff;
  --line: rgba(255, 255, 255, 0.1);
  --hover: rgba(255, 255, 255, 0.06);
  --active: rgba(255, 255, 255, 0.135);
  --bubble: #262626;
  --bubble-text: #ffffff;
  --user-bubble: #5a5a5a;
  --user-text: #ffffff;
  --pill: rgba(255, 255, 255, 0.07);
  --pill-line: rgba(255, 255, 255, 0.1);
  --field: rgba(255, 255, 255, 0.06);
  --field-line: rgba(255, 255, 255, 0.08);
  --composer: #2f2f2f;
  --composer-line: rgba(255, 255, 255, 0.12);
  --plus: rgba(255, 255, 255, 0.1);
  --send: #ffffff;
  --send-icon: #0b0b0b;
  --text: #ffffff;
  --text-2: rgba(255, 255, 255, 0.62);
  --text-3: rgba(255, 255, 255, 0.4);
  --unread: #3b8cf6;
  --green: #30d158;
  --amber: #f19d38;
  --amber-bg: rgba(241, 157, 56, 0.14);
  --violet: #9b78ff;
  --danger: #ff5a4b;
  --shadow: 0 16px 48px rgba(0, 0, 0, 0.6), 0 2px 8px rgba(0, 0, 0, 0.4);
  --float: #1c1c1c;
  --float-line: rgba(255, 255, 255, 0.12);
  --float-hover: #262626;
  --float-shadow: 0 4px 16px rgba(0, 0, 0, 0.5), 0 1px 3px rgba(0, 0, 0, 0.4);
}

@media (min-resolution: 2dppx) {
  :root { --hairline: 0.5px; }
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  background: var(--main);
  color: var(--text);
  font: 15px/22px -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow: hidden;
  overscroll-behavior: none;
  /* Two quick taps, as on the send arrow, never zoom the page. Pinching still does. */
  touch-action: manipulation;
}

button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { cursor: default; }
:focus { outline: none; }
:focus-visible { outline: 2px solid color-mix(in srgb, var(--text) 35%, transparent); outline-offset: 2px; }
input:focus-visible, textarea:focus-visible, select:focus-visible { outline: none; }
::selection { background: color-mix(in srgb, #885cf5 40%, transparent); }
[hidden] { display: none !important; }

.icon { flex: none; display: block; }

/* ------------------------------------------------------------------ faces */

.face { display: block; flex: none; overflow: visible; }
.face-head { fill: var(--face, #f2f2ee); stroke: var(--face-edge, transparent); stroke-width: 2.5; transition: fill 0.5s; }
/* A white face needs an edge on a light page. */
.face[data-color="snow"] { --face-edge: rgba(0, 0, 0, 0.14); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .face[data-color="snow"] { --face-edge: transparent; } }
:root[data-theme="dark"] .face[data-color="snow"] { --face-edge: transparent; }
.face-eye { fill: var(--eye); }
.face-body, .face-move, .face-lids { transform-box: fill-box; transform-origin: 50% 50%; }
.face-body { transform-origin: 50% 100%; }
.face-gaze { transition: transform 0.45s cubic-bezier(0.3, 0.7, 0.3, 1); }
.face-lids { animation: blink 6s infinite; }
.face-move { transition: transform 0.6s cubic-bezier(0.3, 0.7, 0.3, 1); }

@keyframes blink {
  0%, 92%, 100% { transform: scaleY(1); }
  95% { transform: scaleY(0.12); }
}

.face[data-state="thinking"] .face-move { animation: ponder 2.8s ease-in-out infinite; }
.face[data-state="typing"] .face-move { animation: read 1.6s ease-in-out infinite; }
.face[data-state="working"] .face-move { animation: scan 0.9s ease-in-out infinite; }
.face[data-state="working"] .face-body { animation: busy 0.45s ease-in-out infinite alternate; }
.face[data-state="waiting"] .face-body { animation: wait 1.8s ease-in-out infinite; }
.face[data-state="waiting"] .face-move { transform: translate(-3px, 5px); }
.face[data-state="error"] .face-lids { animation: none; transform: scaleY(0.35); }
.face[data-state="error"] .face-move { transform: translate(-2px, 6px); }
.face.ack .face-body { animation: hop 0.6s cubic-bezier(0.3, 1.4, 0.5, 1); }
.face.ack .face-lids { animation: none; transform: scaleY(1.2); }
.face.done .face-lids { animation: none; transform: scaleY(0.4) translateY(-6px); }
.face.done .face-body { animation: hop 0.7s cubic-bezier(0.3, 1.4, 0.5, 1); }

@keyframes ponder { 0%, 100% { transform: translate(-6px, -7px); } 50% { transform: translate(-2px, -9px); } }
@keyframes read { 0%, 100% { transform: translate(-1px, 6px); } 50% { transform: translate(5px, 6px); } }
@keyframes scan { 0%, 100% { transform: translate(-7px, 1px); } 50% { transform: translate(5px, 1px); } }
@keyframes busy { from { transform: translateY(0); } to { transform: translateY(-3%); } }
@keyframes wait { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5%); } }
@keyframes hop { 0% { transform: translateY(0) scale(1); } 35% { transform: translateY(-14%) scale(1.02, 0.98); } 70% { transform: translateY(0) scale(1.03, 0.96); } 100% { transform: translateY(0) scale(1); } }

@media (prefers-reduced-motion: reduce) {
  .face *, .face { animation: none !important; transition: none !important; }
  .shimmer { animation: none !important; }
}

/* ------------------------------------------------------------------ layout */

.app {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr) auto;
  height: 100vh;
  height: 100dvh;
  background: var(--main);
}
/* Touch screens: the part of the screen the keyboard leaves free, which ui/main.ts measures. */
@media (pointer: coarse) {
  .app { position: fixed; top: var(--app-top, 0); left: 0; right: 0; height: var(--app-height, 100dvh); }
}

.sidebar {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--side);
  border-right: var(--hairline) solid var(--line);
}

.side-top {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 56px;
  padding: 0 14px 0 20px;
  flex: none;
}
.brand { flex: 1; font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }

.icon-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  color: var(--text-2);
  transition: background 0.15s, color 0.15s;
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.side-top .icon-btn { border: var(--hairline) solid var(--pill-line); background: var(--pill); color: var(--text); }

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  margin: 0 14px 10px;
  padding: 0 10px;
  border-radius: 10px;
  background: var(--field);
  border: var(--hairline) solid var(--field-line);
  color: var(--text-3);
  flex: none;
}
.search input { flex: 1; min-width: 0; height: 100%; border: 0; background: none; font-size: 14px; color: var(--text); }
.search input::placeholder { color: var(--text-3); }
.search input::-webkit-search-cancel-button { display: none; }

.roster { flex: 1; min-height: 0; overflow-y: auto; padding: 2px 10px 10px; scrollbar-width: none; }
.roster::-webkit-scrollbar { display: none; }
.roster-empty { margin: 24px 12px; color: var(--text-3); font-size: 13px; text-align: center; }

.row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  height: 58px;
  padding: 0 10px;
  margin-bottom: 2px;
  border-radius: 12px;
  text-align: left;
  transition: background 0.15s;
}
.row:hover { background: var(--hover); }
.row.active { background: var(--active); }
.avatar { position: relative; flex: none; display: grid; place-items: center; width: 38px; height: 38px; }
.avatar > .face { width: 36px; height: 36px; }
.dot {
  position: absolute;
  right: 14px;
  top: 50%;
  width: 9px;
  height: 9px;
  margin-top: -4.5px;
  border-radius: 50%;
}
/* One dot a chat, as ui/main.ts picks it: a decision waits for David, a run ended on an error, or an answer is new. */
.dot.ok, .dot.answer { background: var(--amber); }
.dot.error { background: var(--danger); }
.dot.new { background: var(--green); }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; padding-right: 22px; }
.row-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; line-height: 20px; color: var(--text); }

.home { flex: none; display: flex; justify-content: center; padding: 2px 0 12px; }
.home:empty { display: none; }
.home-btn { position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 120px; padding: 12px 18px 10px; border-radius: 16px; transition: background 0.15s; }
.home-btn:hover { background: var(--hover); }
.home-btn.active { background: var(--active); }
.home-face { position: relative; display: block; }
.home-face .face { width: 56px; height: 56px; }
.home-star { position: absolute; right: -5px; bottom: -3px; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: #f19d38; color: #fff; box-shadow: 0 0 0 2.5px var(--side); }
.home-btn.active .home-star { box-shadow: 0 0 0 2.5px color-mix(in srgb, var(--side) 80%, var(--text) 20%); }
.home .dot { right: -10px; top: 4px; margin: 0; }
.home-name { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; color: var(--text); }
.row-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; line-height: 18px; color: var(--text-2); }
.row-sub.busy { color: var(--text-3); }

.rail-new { display: none; }

.side-bottom { flex: none; padding: 10px 14px 16px; }
.me { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; }
.initials { display: grid; place-items: center; width: 36px; height: 36px; flex: none; border-radius: 50%; background: var(--plus); color: var(--text-2); font-size: 12px; font-weight: 600; letter-spacing: 0.03em; }
/* The person's Bluesky picture, over their initials until it loads. */
.me-face { position: relative; flex: none; width: 36px; height: 36px; border-radius: 50%; overflow: hidden; transition: box-shadow 0.15s; }
.me-face:hover { box-shadow: 0 0 0 2px var(--active); }
.me-face .initials { width: 100%; height: 100%; }
.me-picture { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 0.2s; }
.me-face.has-picture .me-picture { opacity: 1; }
/* A dot on the owner's picture while someone waits to be let in. */
.me-holder { position: relative; flex: none; display: flex; }
.me-waiting { position: absolute; top: -1px; right: -1px; width: 10px; height: 10px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 0 2px var(--side, var(--main)); pointer-events: none; }
.menu-hint.waiting { color: var(--amber); }
/* What is left of the Claude plan, and when it starts over. */
/* The usage carousel: one account at a time, with arrows to turn when there are several. */
.me-usage { flex: 1; min-width: 0; height: 36px; display: flex; align-items: center; overflow: hidden; white-space: nowrap; font-size: 14px; border-radius: 999px; background: var(--pill); border: var(--hairline) solid var(--pill-line); }
.usage-main { flex: 1; min-width: 0; height: 100%; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 0 12px; border-radius: 999px; transition: background 0.15s; }
.me-usage.turns .usage-main { padding: 0 2px; }
.usage-main:hover { background: var(--hover); }
.me-usage .usage-turn { flex: none; display: grid; place-items: center; width: 26px; height: 100%; color: var(--text-3); transition: color 0.15s; }
.me-usage .usage-turn.prev { padding-left: 4px; }
.me-usage .usage-turn.next { padding-right: 4px; }
.me-usage .usage-turn:hover { color: var(--text); }
.usage-main .usage-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; color: var(--text-2); font-size: 13px; }
.usage-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: color-mix(in srgb, var(--text) 22%, transparent); }
.usage-left { flex: none; }
.usage-left.muted { color: var(--text-3); font-size: 13px; }
.usage-reset { min-width: 0; display: inline-flex; align-items: center; gap: 4px; overflow: hidden; font-size: 13px; color: var(--text-2); }
.usage-reset .icon { flex: none; }
.usage-ring { flex: none; width: 14px; height: 14px; border-radius: 50%;
  background: conic-gradient(var(--usage, var(--text)) calc(var(--left) * 1%), color-mix(in srgb, var(--text) 16%, transparent) 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3.2px), #000 calc(100% - 2.6px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 3.2px), #000 calc(100% - 2.6px)); }
.usage-ring.low, .usage-bar.low { --usage: var(--amber); }
.usage-ring.out, .usage-bar.out { --usage: var(--danger); }
.me-menu { min-width: 300px; }
.usage-row { padding: 6px 10px 9px; }
.usage-line { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; line-height: 18px; }
.usage-label { flex: none; color: var(--text); }
.usage-value { min-width: 0; color: var(--text-2); text-align: right; }
.usage-bar { margin-top: 6px; height: 5px; border-radius: 999px; background: color-mix(in srgb, var(--text) 12%, transparent); overflow: hidden; }
.usage-bar i { display: block; height: 100%; width: calc(var(--left) * 1%); border-radius: inherit; background: var(--usage, var(--text)); }
.usage-when { margin-top: 5px; font-size: 12px; line-height: 16px; color: var(--text-3); }
.usage-card { margin: 2px 4px 6px; padding: 4px 0 8px; border-radius: 12px; background: color-mix(in srgb, var(--text) 4%, transparent); }
.usage-head { display: flex; align-items: center; gap: 4px; padding: 2px 4px 2px; min-height: 40px; }
.usage-head .usage-turn { width: 30px; height: 30px; color: var(--text-2); }
.usage-title { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; text-align: center; }
.usage-head .usage-turn:first-child + .usage-title, .usage-title:first-child { padding-left: 6px; }
.usage-plan { font-size: 14px; line-height: 19px; font-weight: 500; color: var(--text); }
.usage-from { font-size: 12px; line-height: 16px; color: var(--text-3); }
.usage-note { margin: 2px 10px 4px; font-size: 13px; line-height: 18px; color: var(--text-2); text-align: center; }
.usage-dots { display: flex; justify-content: center; gap: 5px; padding-top: 6px; }
.usage-dots i { width: 5px; height: 5px; border-radius: 50%; background: color-mix(in srgb, var(--text) 20%, transparent); }
.usage-dots i.on { background: var(--text); }

/* ------------------------------------------------------------------ chat */

.chat { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--main); position: relative; }

.chat-head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 64px;
  padding: 0 14px;
  flex: none;
  position: relative;
  z-index: 2;
}
.back-btn { position: absolute; left: 12px; display: none; }
.who {
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: min(70%, 520px);
  height: 40px;
  padding: 0 16px 0 8px;
  border-radius: 999px;
  background: var(--pill);
  border: var(--hairline) solid var(--pill-line);
  transition: background 0.15s;
}
.who:hover { background: var(--active); }
.who > .face { width: 24px; height: 24px; }
.who-cluster { display: block; flex: none; }
.who-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
.head-actions { position: absolute; right: 14px; display: flex; gap: 4px; }
.computer-btn.on { color: var(--violet); }
.computer-btn.on::after { content: ""; position: absolute; width: 6px; height: 6px; margin: -16px 0 0 18px; border-radius: 50%; background: var(--violet); box-shadow: 0 0 0 2px var(--main); }
.computer-btn.open { background: var(--active); color: var(--text); }

.to { display: flex; align-items: center; gap: 8px; width: 100%; max-width: 760px; height: 40px; padding: 0 16px; border-radius: 999px; background: var(--pill); border: var(--hairline) solid var(--pill-line); }
.to-label { color: var(--text-3); font-size: 15px; }
.to-input { flex: 1; min-width: 0; border: 0; background: none; font-size: 15px; }
.to-input::placeholder { color: var(--text-3); }

.scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--active) transparent; }
.transcript { display: flex; flex-direction: column; max-width: 860px; margin: 0 auto; padding: 4px 18px 24px; min-height: 100%; }

.item { flex: none; }
.item + .item { margin-top: 12px; }
.divider + .item, .item + .divider { margin-top: 18px; }
.assistant + .assistant, .user + .user { margin-top: 4px; }
.divider { align-self: center; font-size: 13px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.event { align-self: center; font-size: 13px; color: var(--text-3); text-align: center; }
.event strong { color: var(--text); font-weight: 500; }
/* A group a bot of this group asked in, which opens it. */
.event .event-link { color: var(--text); font-weight: 500; text-decoration: none; }
.event .event-link:hover { text-decoration: underline; }

.bubble {
  max-width: min(76%, 620px);
  padding: 10px 14px;
  border-radius: 22px;
  font-size: 15px;
  line-height: 22px;
  overflow-wrap: anywhere;
}
.user { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.user .bubble { background: var(--user-bubble); color: var(--user-text); white-space: pre-wrap; }
.user.pending { opacity: 0.6; }
.user .via { display: inline-flex; align-items: center; gap: 4px; margin-right: 4px; font-size: 12px; line-height: 16px; color: var(--text-3); }
.user .via img { width: 12px; height: 12px; }
/* Who wrote a message, above it, where several people write to the bots. One's own messages carry no name. */
.user .by { margin-right: 6px; font-size: 13px; line-height: 18px; color: var(--text-2); }
.tg-open { align-self: flex-start; text-decoration: none; }
.voice-key { display: flex; gap: 8px; }
.voice-key input { flex: 1; min-width: 0; height: 36px; padding: 0 12px; border-radius: 12px; border: var(--hairline) solid var(--field-line);
  background: var(--field); color: var(--text); font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 13px; outline: none; }
.voice-key input:focus { border-color: color-mix(in srgb, var(--text) 30%, transparent); }
.voice-key .primary-btn.small { height: 36px; }
.voice-on .icon { color: var(--green); }
.voice-on .link-btn { margin-left: auto; }
.tg-open img { width: 18px; height: 18px; }
.assistant { display: flex; }
.assistant .bubble { background: var(--bubble); color: var(--bubble-text); }

.photos { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; max-width: 76%; }
.photos img, .photo img { display: block; max-width: 220px; max-height: 220px; border-radius: 16px; object-fit: cover; }

.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 10px; }
.md .md-heading { font-weight: 600; margin: 12px 0 4px; }
.md ul, .md ol { margin: 4px 0 10px; padding-left: 22px; }
.md li + li { margin-top: 2px; }
.md li.task, .md li.mark { list-style: none; margin-left: -20px; }
.md li.task::before { content: "○ "; color: var(--text-3); }
.md li.task.done::before { content: "✓ "; color: var(--text-2); }
.md strong { font-weight: 600; }
.md a { color: inherit; text-decoration: underline; text-decoration-color: var(--text-3); text-underline-offset: 2px; }
.md a:hover { text-decoration-color: currentColor; }
.md code { font: 13px/18px ui-monospace, "SF Mono", Menlo, monospace; padding: 1px 5px; border-radius: 6px; background: color-mix(in srgb, var(--text) 9%, transparent); }
.md pre { margin: 8px 0; padding: 10px 12px; border-radius: 12px; background: color-mix(in srgb, var(--main) 55%, transparent); overflow-x: auto; }
.md pre code { padding: 0; background: none; font-size: 12.5px; }
.md blockquote { margin: 6px 0; padding-left: 12px; border-left: 2px solid var(--line); color: var(--text-2); }
.md hr { border: 0; border-top: var(--hairline) solid var(--line); margin: 12px 0; }

.notice { align-self: center; display: flex; align-items: center; gap: 6px; max-width: 80%; font-size: 13px; color: var(--text-3); text-align: center; }
.notice.error { color: var(--danger); }

.activity { display: flex; align-items: center; gap: 10px; margin-top: 16px; font-size: 15px; }
.activity .face { width: 24px; height: 24px; }
.activity span, .shimmer {
  background: linear-gradient(90deg, var(--text-3) 0%, var(--text-3) 35%, var(--text) 50%, var(--text-3) 65%, var(--text-3) 100%);
  background-size: 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shimmer 2.4s linear infinite;
}
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0% 0; } }

.card {
  align-self: flex-start;
  width: min(76%, 520px);
  padding: 12px 14px;
  border-radius: 20px;
  background: var(--bubble);
}
.card-head { display: flex; align-items: center; gap: 8px; }
.card-title { flex: 1; font-size: 14px; font-weight: 600; }
.card-caption { margin-top: 4px; font-size: 15px; }
.pill { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 500; }
.pill.working { color: var(--amber); background: var(--amber-bg); }
.pill.working i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: pulse 1.2s ease-in-out infinite; }
.pill.muted { color: var(--text-3); background: var(--hover); }
@keyframes pulse { 50% { opacity: 0.35; } }
.shot { display: block; width: 100%; margin-top: 10px; border-radius: 12px; overflow: hidden; background: var(--main); }
.shot img { display: block; width: 100%; height: auto; max-height: 300px; object-fit: cover; object-position: top; transition: transform 0.4s; }
.shot:hover img { transform: scale(1.01); }
.steps { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 3px; }
.step { display: flex; align-items: flex-start; flex-wrap: wrap; gap: 8px; font-size: 13px; line-height: 18px; color: var(--text-2); }
.step .icon { margin-top: 2px; color: var(--text-3); }
.step.done .icon { color: var(--text-2); }
.step.error .icon, .step.interrupted .icon { color: var(--amber); }
.step-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.step.more button { color: var(--text-3); font-size: 12px; padding-left: 22px; }
.step.more button:hover { color: var(--text); }
.step-output { width: 100%; padding-left: 22px; }
.step-output summary { cursor: pointer; color: var(--text-3); font-size: 12px; list-style: none; }
.step-output summary::-webkit-details-marker { display: none; }
.step-output .step-more { margin: 0 0 4px; font-size: 12px; }
.step-output pre { margin: 6px 0 2px; padding: 8px 10px; max-height: 220px; overflow: auto; border-radius: 10px; background: color-mix(in srgb, var(--main) 55%, transparent); font: 12px/17px ui-monospace, "SF Mono", Menlo, monospace; color: var(--text-2); white-space: pre-wrap; }
.spinner { width: 12px; height: 12px; margin: 3px 1px 0; flex: none; border-radius: 50%; border: 1.6px solid var(--text-3); border-top-color: var(--text); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.empty-chat { margin: auto; display: flex; flex-direction: column; align-items: center; text-align: center; padding: 40px 20px 60px; }
.empty-chat > .face { width: 72px; height: 72px; }
.empty-chat > .cluster { margin-bottom: 2px; }
.empty-name { margin: 16px 0 2px; font-size: 17px; font-weight: 600; }
.empty-sub { margin: 0; max-width: 340px; color: var(--text-2); font-size: 14px; line-height: 20px; }
.loading { margin: auto; width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--text-2); animation: spin 0.8s linear infinite; }

/* ------------------------------------------------------------------ finding your way in a long chat */

/* The chat's scrolling part, with the rail, the day, the way down and search over it. Its width decides whether the
   rail fits beside the messages. */
.scroll-wrap { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; container-type: inline-size; }

/* The rail, as in Einstein: a mark 10 px apart for each part of the chat, a little more between days, the part
   being read darkest and parts with a search match in amber. Hovering a mark shows what was asked, the answer and when. */
.rail { position: absolute; z-index: 3; right: 12px; top: 50%; transform: translateY(-50%); width: 28px;
  max-height: min(max(0px, calc(100% - 64px)), 420px); display: flex; flex-direction: column; }
.rail-scroll { position: relative; max-height: inherit; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; }
.rail-scroll::-webkit-scrollbar { display: none; }
.rail-scroll.fade-top { mask-image: linear-gradient(#0000 0, #000 24px 100%); }
.rail-scroll.fade-bottom { mask-image: linear-gradient(#000 0 calc(100% - 24px), #0000 100%); }
.rail-scroll.fade-top.fade-bottom { mask-image: linear-gradient(#0000 0, #000 24px calc(100% - 24px), #0000 100%); }
.rail-marks { display: flex; flex-direction: column; padding: 1px 0; }
.rail-mark { position: relative; flex: none; width: 100%; height: 10px; border-radius: 8px; }
.rail-mark.day { margin-top: 6px; }
.rail-mark::before { content: ""; position: absolute; top: 50%; right: 0; width: 20px; height: 2px; border-radius: 2px;
  background: color-mix(in srgb, var(--text) 20%, transparent); transform-origin: 100% 50%; transform: translateY(-50%) scaleX(0.6);
  transition: transform 0.14s, background-color 0.14s; }
.rail-mark.preview::before { background: var(--text-3); transform: translateY(-50%) scaleX(0.9); }
.rail-mark.hit::before { background: var(--amber); transform: translateY(-50%) scaleX(0.8); }
.rail-mark.active::before { background: var(--text); transform: translateY(-50%) scaleX(1); }
.rail-mark:focus-visible { outline: none; }
.rail-mark:focus-visible::after { content: ""; position: absolute; inset: 0 0 0 auto; width: 20px; border-radius: inherit;
  outline: 1px solid color-mix(in srgb, var(--text) 45%, transparent); outline-offset: -1px; }
.rail-preview { position: absolute; top: 0; right: calc(100% + 10px); width: min(300px, calc(100cqw - 120px)); max-height: 132px;
  overflow: hidden; padding: 10px 12px; border-radius: 12px; background: var(--float); border: var(--hairline) solid var(--float-line);
  box-shadow: var(--shadow); pointer-events: none; transition: top 0.14s cubic-bezier(0.2, 0.8, 0.2, 1); }
.rail-when { font-size: 12px; line-height: 16px; color: var(--text-3); font-variant-numeric: tabular-nums;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-prompt, .rail-answer { display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.rail-prompt { margin-top: 2px; font-size: 13px; line-height: 18px; font-weight: 600; -webkit-line-clamp: 2; }
.rail-answer { margin-top: 4px; font-size: 12px; line-height: 17px; color: var(--text-2); -webkit-line-clamp: 3; }

/* The day at the top while scrolling through a chat of more than one day. */
.day-pill { position: absolute; z-index: 3; top: 10px; left: 50%; transform: translateX(-50%); padding: 3px 11px; border-radius: 999px;
  white-space: nowrap; font-size: 12px; line-height: 18px; font-weight: 500; color: var(--text-2); background: var(--float);
  border: var(--hairline) solid var(--float-line); box-shadow: var(--float-shadow); pointer-events: none; opacity: 0; transition: opacity 0.15s; }
.day-pill.on { opacity: 1; }

/* Back to the newest message, at the right edge of the messages, with a dot when something came below. */
.to-latest { position: absolute; z-index: 3; bottom: 12px; right: max(16px, calc((100% - 860px) / 2 + 18px)); display: grid; place-items: center;
  width: 34px; height: 34px; border-radius: 50%; color: var(--text); background: var(--float); border: var(--hairline) solid var(--float-line);
  box-shadow: var(--float-shadow); transition: background 0.15s; }
.to-latest:hover { background: var(--float-hover); }
.to-latest-dot { position: absolute; top: 0; right: 0; width: 9px; height: 9px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 2px var(--main); }

/* Search in the chat, at its top right like a browser's. */
.find { position: absolute; z-index: 4; top: 8px; right: max(12px, calc((100% - 860px) / 2 + 12px)); width: min(400px, calc(100% - 24px));
  display: flex; align-items: center; gap: 2px; height: 40px; padding: 0 4px 0 12px; border-radius: 999px; background: var(--float);
  border: var(--hairline) solid var(--float-line); box-shadow: var(--float-shadow); }
.find:focus-within { border-color: color-mix(in srgb, var(--text) 22%, transparent); }
.find-icon { color: var(--text-3); margin-right: 6px; }
.find-input { flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; background: none; font-size: 14px; }
.find-input::-webkit-search-cancel-button { display: none; }
.find-input::placeholder { color: var(--text-3); }
.find-count { flex: none; padding: 0 6px; white-space: nowrap; font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.find .find-step { width: 30px; height: 30px; }
.find .find-step:disabled { opacity: 0.4; background: none; cursor: default; }
::highlight(chat-find) { background-color: rgba(255, 196, 0, 0.32); }
::highlight(chat-find-now) { background-color: #ffad1f; color: #111111; }

/* From 920 px the rail fits beside the messages. Narrower chats make room for it, and below 680 px, or where nothing
   hovers, there is none. */
@media (hover: hover) {
  @container (min-width: 680px) and (max-width: 919px) {
    .scroll-wrap[data-rail] .transcript { padding-right: 56px; }
    .scroll-wrap[data-rail] .to-latest { right: 56px; }
  }
}
@container (max-width: 679px) { .rail { display: none; } }
@media (hover: none) { .rail { display: none; } }
@media (pointer: coarse) {
  .find { height: 44px; }
  .find .find-step { width: 36px; height: 36px; }
  .find-input { font-size: 16px; }
}

/* ------------------------------------------------------------------ composer */

.composer-wrap { flex: none; padding: 6px 16px 16px; padding-bottom: max(16px, env(safe-area-inset-bottom)); }
.composer {
  max-width: 860px;
  margin: 0 auto;
  border-radius: 24px;
  background: var(--composer);
  border: var(--hairline) solid var(--composer-line);
  transition: border-color 0.15s;
}
.composer:focus-within { border-color: color-mix(in srgb, var(--text) 22%, transparent); }
.composer-row { display: flex; align-items: flex-end; gap: 8px; padding: 7px; }
.composer textarea {
  flex: 1;
  min-width: 0;
  min-height: 30px;
  max-height: 200px;
  padding: 4px 2px;
  border: 0;
  background: none;
  resize: none;
  font-size: 15px;
  line-height: 22px;
}
.composer textarea::placeholder { color: var(--text-3); }
.composer-plus { display: grid; place-items: center; width: 30px; height: 30px; flex: none; border-radius: 50%; background: var(--plus); color: var(--text-2); transition: color 0.15s; }
.composer-plus:hover { color: var(--text); }
.composer-action { display: grid; place-items: center; width: 30px; height: 30px; flex: none; border-radius: 50%; background: var(--send); color: var(--send-icon); transition: opacity 0.15s, transform 0.15s; }
.composer-action:disabled { opacity: 0.35; }
.composer-action:not(:disabled):active { transform: scale(0.92); }
.composer-action.listening { background: var(--danger); color: #fff; animation: pulse 1.2s ease-in-out infinite; }
.attachments { display: flex; gap: 6px; padding: 8px 8px 0; flex-wrap: wrap; }
.attachment { position: relative; }
.attachment img { display: block; width: 56px; height: 56px; border-radius: 12px; object-fit: cover; }
.attachment button { position: absolute; top: -5px; right: -5px; display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--send); color: var(--send-icon); }

/* ------------------------------------------------------------------ new bot */

.picker {
  margin: 4px 0 0;
  padding: 6px;
  border-radius: 16px;
  background: var(--side);
  border: var(--hairline) solid var(--line);
  box-shadow: var(--shadow);
  align-self: stretch;
}
.pick { display: flex; align-items: center; gap: 12px; width: 100%; height: 42px; padding: 0 10px; border-radius: 10px; text-align: left; font-size: 15px; }
.pick .face { width: 24px; height: 24px; }
.pick:hover, .pick.hot { background: var(--hover); }
.pick-sub { margin-left: auto; padding-left: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-3); font-size: 13px; }
.pick-plus { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--plus); color: var(--text-2); }

/* ------------------------------------------------------------------ groups */

.cluster { position: relative; display: block; flex: none; }
.cluster .face { position: absolute; }
.cluster[data-count="1"] .face { left: 5%; top: 5%; }
.cluster[data-count="2"] .face:nth-child(1) { left: 0; top: 0; }
.cluster[data-count="2"] .face:nth-child(2) { right: 0; bottom: 0; }
.cluster[data-count="3"] .face:nth-child(1) { left: 0; top: 0; }
.cluster[data-count="3"] .face:nth-child(2) { right: 0; top: 6%; }
.cluster[data-count="3"] .face:nth-child(3) { left: 22%; bottom: 0; }
.cluster[data-count="4"] .face:nth-child(1) { left: 0; top: 0; }
.cluster[data-count="4"] .face:nth-child(2) { right: 0; top: 0; }
.cluster[data-count="4"] .face:nth-child(3) { left: 0; bottom: 0; }
.cluster[data-count="4"] .face:nth-child(4) { right: 0; bottom: 0; }

.say { display: flex; flex-direction: column; }
.item + .say.first { margin-top: 16px; }
.say + .say:not(.first) { margin-top: 4px; }
.say-name { margin: 0 0 4px 46px; font-size: 13px; line-height: 18px; color: var(--text-2); }
.say-name[style] { color: color-mix(in srgb, var(--name) 82%, var(--text)); }
.say-routine { display: inline-flex; align-items: center; gap: 3px; margin-left: 6px; color: var(--text-3); }
.say-routine svg { flex: none; }
/* Where a message written from another chat came from: the group, which it opens, or the bot's own chat. */
.say-from { margin-left: 6px; color: var(--text-3); text-decoration: none; }
a.say-from:hover { color: var(--text-2); text-decoration: underline; }
.say-row { display: flex; align-items: flex-end; gap: 8px; }
/* Pictures a bot handed on sit above its bubble, in line with it: past the 30 px face and the 8 px gap. */
.say-photos { justify-content: flex-start; margin: 0 0 4px 38px; }
.say-face { display: flex; align-items: flex-end; justify-content: center; width: 30px; flex: none; padding-bottom: 3px; }
.say .bubble { max-width: min(74%, 620px); background: var(--bubble); color: var(--bubble-text); }
.say-activity { gap: 8px; }
.say-activity .say-face { padding-bottom: 0; }

.mention { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; white-space: nowrap; vertical-align: -3px;
  color: color-mix(in srgb, var(--mention, currentColor) 78%, var(--text)); }
.mention .face { width: 16px; height: 16px; }
.user .mention { color: color-mix(in srgb, var(--mention, currentColor) 70%, var(--user-text)); }

.to { overflow-x: auto; scrollbar-width: none; }
.to::-webkit-scrollbar { display: none; }
.to-chips { display: contents; }
.chip { display: inline-flex; align-items: center; gap: 6px; flex: none; height: 28px; padding: 0 4px 0 6px; border-radius: 999px; background: var(--active); font-size: 14px; }
.chip .face { width: 18px; height: 18px; }
.chip-x { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; color: var(--text-2); }
.chip-x:hover { background: var(--hover); color: var(--text); }

.composer-wrap { position: relative; }
.mention-menu { position: absolute; z-index: 5; left: 16px; right: 16px; bottom: calc(100% - 4px); max-width: 860px; margin: 0 auto; max-height: 240px; overflow-y: auto; padding: 6px; border-radius: 16px; background: var(--side); border: var(--hairline) solid var(--line); box-shadow: var(--shadow); animation: pop 0.12s ease-out; }
.mention-option { display: flex; align-items: center; gap: 10px; width: 100%; height: 38px; padding: 0 10px; border-radius: 10px; font-size: 14px; text-align: left; }
.mention-option:hover, .mention-option.hot { background: var(--hover); }

.members { list-style: none; margin: 0; padding: 4px; display: flex; flex-direction: column; gap: 2px; border-radius: 14px; background: var(--field); border: var(--hairline) solid var(--field-line); }
.member { display: flex; align-items: center; gap: 2px; }
.member-open { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 10px; text-align: left; transition: background 0.15s; }
.member-open:hover { background: var(--hover); }
.member-text { display: flex; flex-direction: column; min-width: 0; }
.member-name { font-size: 14px; line-height: 19px; }
.member-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; line-height: 16px; color: var(--text-3); }
.member-remove { width: 30px; height: 30px; color: var(--text-3); }

/* ------------------------------------------------------------------ panels */

.panel { width: 0; overflow: hidden; background: var(--panel); border-left: var(--hairline) solid var(--line); }
.app[data-panel] .panel { width: 320px; display: flex; flex-direction: column; min-height: 0; }
.panel-head { display: grid; grid-template-columns: 40px 1fr 40px; align-items: center; height: 64px; padding: 0 8px; flex: none; }
.panel-back { visibility: hidden; }
.panel-title { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 15px; font-weight: 600; }
.panel-body { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 18px 24px; display: flex; flex-direction: column; gap: 14px; }
.hero { display: grid; place-items: center; padding: 8px 0 2px; }
.hero > .face { width: 72px; height: 72px; }
.swatches, .shapes { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
.swatch { width: 20px; height: 20px; border-radius: 50%; background: var(--swatch); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12); transition: transform 0.15s; }
.swatch:hover { transform: scale(1.12); }
.swatch.on { box-shadow: 0 0 0 2px var(--panel), 0 0 0 3.5px var(--text); }
.shape { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; transition: background 0.15s; }
.shape:hover { background: var(--hover); }
.shape.on { background: var(--active); }
.shape .face { width: 24px; height: 24px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: 13px; color: var(--text-2); }
.field input, .field textarea, .field select {
  width: 100%;
  min-height: 38px;
  padding: 8px 12px;
  border-radius: 12px;
  border: var(--hairline) solid var(--field-line);
  background: var(--field);
  font-size: 14px;
  line-height: 20px;
  transition: border-color 0.15s;
}
.field textarea { resize: vertical; min-height: 76px; }
.field select { appearance: none; padding-right: 30px; background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%); background-position: calc(100% - 17px) 17px, calc(100% - 12px) 17px; background-size: 5px 5px; background-repeat: no-repeat; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: color-mix(in srgb, var(--text) 30%, transparent); }
.field input::placeholder, .field textarea::placeholder { color: var(--text-3); }
.field-pair { display: grid; grid-template-columns: 1.4fr 1fr; gap: 10px; }
.main-note { margin: -4px 12px 0; font-size: 13px; line-height: 18px; color: var(--text-2); text-align: center; }
.main-note .icon { display: inline-block; vertical-align: -2px; margin-right: 5px; color: #f19d38; }
.ghost-btn { display: flex; align-items: center; justify-content: center; gap: 6px; align-self: center; height: 32px; padding: 0 14px; border-radius: 999px;
  border: var(--hairline) solid var(--pill-line); background: var(--pill); color: var(--text-2); font-size: 13px; transition: color 0.15s, background 0.15s; }
.ghost-btn:hover { color: var(--text); background: var(--active); }
.ghost-btn .icon { color: #f19d38; }
.made { display: flex; align-items: center; justify-content: center; gap: 6px; }
.made-bot { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px 2px 4px; border-radius: 999px; color: var(--text); transition: background 0.15s; }
.made-bot:hover { background: var(--hover); }
.made-bot strong { font-weight: 500; }
.made-bot.face-only { padding: 2px; }
.group-faces { display: inline-flex; }
.group-faces > * + * { margin-left: -5px; }
.sent { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.sent .made { flex-wrap: wrap; }
.sent-status { color: var(--text-3); }
.sent-status::before { content: "· "; }
.sent-text { max-width: min(520px, 88%); padding: 7px 12px; border-radius: 14px; background: color-mix(in srgb, var(--bubble) 60%, transparent);
  color: var(--text-2); font-size: 13px; line-height: 18px; text-align: left; white-space: pre-wrap; overflow-wrap: anywhere; }
.sent-text span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sent-text.open span { display: block; }
.peek { flex-wrap: wrap; }
.peek .made-bot.face-only + .made-bot.face-only { margin-left: -6px; }
.peek-file { display: inline-flex; align-items: center; gap: 4px; min-width: 0; max-width: 240px; color: var(--text); font-weight: 500; }
.peek-file span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.danger-btn { display: flex; align-items: center; justify-content: center; gap: 8px; height: 38px; margin-top: 6px; border-radius: 12px; color: var(--danger); background: color-mix(in srgb, var(--danger) 9%, transparent); font-size: 14px; }
.danger-btn:hover { background: color-mix(in srgb, var(--danger) 15%, transparent); }

.computer-tab { display: flex; flex-direction: column; gap: 12px; }
.computer-top { display: flex; align-items: center; justify-content: space-between; }
.app[data-panel="computer"] .panel { width: 360px; }
@media (min-width: 1280px) { .app[data-panel="bot"][data-tab="computer"] .panel { width: 440px; } }

.stage { position: relative; flex: none; width: 100%; aspect-ratio: 16 / 10; border-radius: 14px; overflow: hidden;
  background: var(--main); border: var(--hairline) solid var(--line); transition: box-shadow 0.2s; }
.stage[data-mode="watch"], .stage[data-mode="control"] { background: #0d1117; }
.stage iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; background: #0d1117; }
.stage[data-mode="watch"] iframe { pointer-events: none; }
.stage[data-mode="control"] { box-shadow: 0 0 0 2px var(--violet); }
.stage-empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; padding: 18px; text-align: center; background: var(--main); }
.stage-empty p { margin: 0; max-width: 260px; font-size: 13px; line-height: 18px; color: var(--text-2); }
.stage.expanded { position: fixed; z-index: 60; inset: 28px 40px 92px; width: auto; aspect-ratio: auto; border-radius: 16px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.55); }
.stage.expanded[data-mode="control"] { box-shadow: 0 0 0 2px var(--violet), 0 30px 90px rgba(0, 0, 0, 0.55); }
.stage-backdrop { position: fixed; inset: 0; z-index: 59; background: rgba(0, 0, 0, 0.7); backdrop-filter: blur(6px); animation: fade 0.15s ease-out; }
.stage-bar { display: none; }
.stage.expanded .stage-bar { position: fixed; z-index: 61; left: 50%; bottom: 26px; transform: translateX(-50%); display: flex;
  align-items: center; gap: 8px; padding: 6px; border-radius: 999px; background: rgba(20, 20, 20, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.12); box-shadow: var(--shadow); }
.stage.expanded .stage-bar .expand-btn { color: #fff; }
.screen-actions { display: flex; align-items: center; gap: 8px; }
.screen-actions:empty { display: none; }
.primary-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 16px;
  border-radius: 999px; background: var(--send); color: var(--send-icon); font-size: 14px; font-weight: 500; transition: transform 0.15s, opacity 0.15s; }
.primary-btn:active { transform: scale(0.97); }
.primary-btn:disabled { opacity: 0.5; }
.primary-btn.control { background: var(--violet); color: #fff; }
.expand-btn { margin-left: auto; border: var(--hairline) solid var(--pill-line); background: var(--pill); color: var(--text); }
.stage-bar .expand-btn { margin-left: 0; }
.pill.live { color: #23a45f; background: rgba(35, 164, 95, 0.13); }
.pill.live i, .pill.control i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: pulse 1.6s ease-in-out infinite; }
.pill.control { color: var(--violet); background: color-mix(in srgb, var(--violet) 14%, transparent); }
.computer-btn.control { color: var(--violet); background: color-mix(in srgb, var(--violet) 14%, transparent); }
.screen { display: block; width: 100%; aspect-ratio: 16 / 10; border-radius: 14px; overflow: hidden; background: var(--main); border: var(--hairline) solid var(--line); }
.screen img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top; }
.screen.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 20px; text-align: center; }
.screen.empty p { margin: 0; max-width: 220px; font-size: 13px; line-height: 18px; color: var(--text-2); }
.screen-note { margin: 0; font-size: 12px; line-height: 17px; color: var(--text-3); }
.panel-steps { margin-top: 4px; }

/* ------------------------------------------------------------------ menu, toast, lightbox, sign-in */

.menu { position: fixed; z-index: 30; min-width: 200px; padding: 6px; border-radius: 14px; background: var(--side); border: var(--hairline) solid var(--line); box-shadow: var(--shadow); animation: pop 0.14s ease-out; }
.menu-label { margin: 4px 10px 4px; font-size: 12px; color: var(--text-3); }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; height: 34px; padding: 0 10px; border-radius: 9px; font-size: 14px; text-align: left; color: var(--text-2); }
.menu-item:hover { background: var(--hover); color: var(--text); }
.menu-item.on { color: var(--text); }
.menu-check { margin-left: auto; }
.menu hr { border: 0; border-top: var(--hairline) solid var(--line); margin: 6px 4px; }
@keyframes pop { from { opacity: 0; transform: translateY(4px) scale(0.98); } }

.toast { position: fixed; z-index: 70; left: 50%; bottom: 96px; transform: translateX(-50%); max-width: min(90vw, 420px); padding: 10px 16px; border-radius: 14px; background: var(--text); color: var(--main); font-size: 14px; box-shadow: var(--shadow); animation: pop 0.18s ease-out; }

.lightbox { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 24px; background: rgba(0, 0, 0, 0.82); backdrop-filter: blur(6px); cursor: zoom-out; animation: fade 0.15s ease-out; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 14px; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5); }
@keyframes fade { from { opacity: 0; } }

.signin { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; padding: 24px; text-align: center; background: var(--main); grid-column: 1 / -1; }
.signin .face { width: 96px; height: 96px; }
.signin h1 { margin: 22px 0 4px; font-size: 26px; line-height: 32px; font-weight: 600; letter-spacing: -0.02em; }
.signin p { margin: 0; color: var(--text-2); font-size: 15px; }
.signin-btn { margin-top: 26px; display: inline-flex; align-items: center; height: 44px; padding: 0 22px; border-radius: 999px; background: var(--send); color: var(--send-icon); font-size: 15px; font-weight: 500; text-decoration: none; transition: transform 0.15s; }
.signin-btn:active { transform: scale(0.97); }
.signin .signin-error { margin-top: 16px; color: var(--danger); font-size: 13px; }
/* Shared bots ask whose account signs in. */
.signin-form { display: flex; flex-direction: column; align-items: stretch; gap: 10px; width: min(100%, 280px); margin-top: 26px; }
.signin-form input { height: 44px; padding: 0 16px; border-radius: 999px; border: var(--hairline) solid var(--field-line); background: var(--field); font-size: 16px; text-align: center; transition: border-color 0.15s; }
.signin-form input:focus { border-color: color-mix(in srgb, var(--text) 30%, transparent); }
.signin-form input::placeholder { color: var(--text-3); }
.signin-form .signin-btn { margin-top: 0; justify-content: center; }
.signin-form .signin-btn:disabled { opacity: 0.5; }
.signin .signin-note { max-width: 320px; margin-top: 18px; font-size: 13px; line-height: 18px; color: var(--text-3); }
.signin .signin-note .link-btn { font-size: 13px; }

/* ------------------------------------------------------------------ medium: the sidebar folds to faces while a panel is open */

@media (max-width: 1099px) and (min-width: 760px) {
  .app[data-panel] { grid-template-columns: 76px minmax(0, 1fr) auto; }
  .app[data-panel] .side-top, .app[data-panel] .search, .app[data-panel] .row-main, .app[data-panel] .me-usage, .app[data-panel] .home-name { display: none; }
  .app[data-panel] .home { padding: 14px 0 4px; }
  .app[data-panel] .home-btn { min-width: 0; padding: 8px; }
  .app[data-panel] .home-face .face { width: 40px; height: 40px; }
  .app[data-panel] .home-star { width: 16px; height: 16px; }
  .app[data-panel] .home-star .icon { width: 10px; height: 10px; }
  .app[data-panel] .roster { padding: 12px 10px; }
  .app[data-panel] .row { justify-content: center; height: 48px; padding: 0; margin-bottom: 6px; }
  .app[data-panel] .row .dot { right: 6px; top: 8px; margin: 0; width: 8px; height: 8px; box-shadow: 0 0 0 2px var(--side); }
  .app[data-panel] .rail-new { display: grid; place-items: center; padding: 6px 0; }
  .app[data-panel] .side-bottom { display: grid; place-items: center; padding: 10px 0 14px; }
  .app[data-panel] .me { width: auto; padding: 4px; }
  .app[data-panel] .panel { width: 300px; }
}

/* ------------------------------------------------------------------ phone: one pane at a time */

@media (max-width: 759px) {
  /* One row the height of the screen. The closed panel takes no row, or a short chat shares the screen with it and the
     message box floats above the bottom, then jumps down as the chat grows. */
  .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
  .app:not([data-panel]) .panel { display: none; }
  .sidebar { border-right: 0; }
  .app[data-view="list"] .chat, .app[data-view="list"] .panel { display: none; }
  .app[data-view="chat"] .sidebar, .app[data-view="new"] .sidebar { display: none; }
  .side-top { height: 52px; padding-top: env(safe-area-inset-top); box-sizing: content-box; }
  .brand { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
  .chat-head { height: 56px; padding-top: env(safe-area-inset-top); box-sizing: content-box; }
  .back-btn { display: grid; border: var(--hairline) solid var(--pill-line); background: var(--pill); color: var(--text); }
  /* The centered name keeps clear of the back button and of the buttons on the right: search alone in a group, search
     and the computer in a bot's chat. */
  .who { max-width: calc(100% - 80px); }
  .chat-head:has(.computer-btn) .who { max-width: calc(100% - 156px); }
  .head-actions .icon-btn { border: var(--hairline) solid var(--pill-line); background: var(--pill); color: var(--text); }
  /* A new group starts from the bot's menu on a phone, so the header has room for search. */
  .head-actions .group-btn { display: none; }
  .transcript { padding: 4px 12px 16px; }
  .find { left: 10px; right: 10px; width: auto; }
  .to-latest { right: 12px; bottom: 10px; }
  .bubble, .card { max-width: 86%; }
  .say .bubble { max-width: calc(100% - 44px); }
  .mention-menu { left: 10px; right: 10px; }
  .card { width: 86%; }
  .composer-wrap { padding: 6px 10px 10px; padding-bottom: max(10px, env(safe-area-inset-bottom)); }
  .to { padding: 0 14px; }
  .app[data-panel] .panel { position: fixed; inset: 0; z-index: 20; width: auto; border: 0; padding-top: env(safe-area-inset-top); animation: slide 0.22s ease-out; }
  .app[data-panel] .panel-back { visibility: visible; }
  @keyframes slide { from { transform: translateY(16px); opacity: 0; } }
}
/* A phone's open panel takes the part of the screen the keyboard leaves free too, like the app. */
@media (max-width: 759px) and (pointer: coarse) {
  .app[data-panel] .panel { top: var(--app-top, 0); bottom: auto; height: var(--app-height, 100dvh); }
}

@media (hover: none) {
  .row:hover { background: none; }
  .row.active { background: var(--active); }
}

/* ------------------------------------------------------------------ bot panel: hero, tabs, routines, library */

.bot-body { gap: 0; padding-top: 0; }
.bot-head { display: flex; justify-content: space-between; }
.head-tools { display: flex; align-items: center; gap: 6px; }
.bot-hero { display: flex; flex-direction: column; align-items: center; padding: 4px 0 0; }
.bot-body.editing .hero-name, .bot-body.editing .hero-label, .bot-body.editing .tabs, .bot-body.editing .tab-body { display: none; }

/* The face edits itself, as in Grok Bot: hovering darkens it and shows a pencil and a tip. */
.avatar-btn { position: relative; display: grid; place-items: center; width: 76px; height: 76px; border-radius: 22px; }
.avatar-btn .face { width: 64px; height: 64px; transition: filter 0.15s; }
.avatar-pencil { position: absolute; inset: 0; display: grid; place-items: center; color: #ffffff; opacity: 0; transition: opacity 0.15s; pointer-events: none; }
.avatar-btn:hover .face, .avatar-btn:focus-visible .face { filter: brightness(0.32); }
.avatar-btn:hover .avatar-pencil, .avatar-btn:focus-visible .avatar-pencil { opacity: 1; }
.avatar-tip { position: absolute; z-index: 3; top: calc(100% + 2px); left: 50%; transform: translateX(-50%); padding: 4px 9px; border-radius: 8px;
  background: #181818; border: var(--hairline) solid rgba(255, 255, 255, 0.14); color: #ffffff; font-size: 13px; line-height: 17px; white-space: nowrap;
  opacity: 0; pointer-events: none; transition: opacity 0.12s; }
.avatar-btn:hover .avatar-tip { opacity: 1; transition-delay: 0.35s; }
.bot-body.editing .avatar-tip { display: none; }
.hero-star { display: none; right: 2px; bottom: 2px; box-shadow: 0 0 0 2.5px var(--panel); }
.hero-star.shown { display: grid; }

/* The name and label are fields that look like text until touched. */
.hero-name, .hero-label { width: 100%; padding: 2px 8px; border: 0; border-radius: 8px; background: transparent; color: var(--text); text-align: center;
  text-overflow: ellipsis; outline: none; transition: background 0.15s; }
.hero-name { margin-top: 12px; font: inherit; font-size: 18px; line-height: 24px; font-weight: 500; }
.hero-label { margin-top: 3px; font: inherit; font-size: 13px; line-height: 19px; color: var(--text-2); }
.hero-name:hover, .hero-label:hover { background: var(--hover); }
.hero-name:focus, .hero-label:focus { background: var(--field); box-shadow: inset 0 0 0 1px var(--field-line); color: var(--text); }
.hero-label::placeholder { color: var(--text-2); }
.hero-name::placeholder { color: var(--text-3); }

/* An editor opens under the face in place of the tabs. */
.editor-host:empty { display: none; }
.editor-card { margin-top: 10px; border-radius: 20px; background: color-mix(in srgb, var(--text) 6%, var(--main)); border: var(--hairline) solid var(--card-line); overflow: hidden; }
.editor-bar { display: flex; align-items: center; gap: 4px; padding: 8px 10px; border-bottom: var(--hairline) solid var(--line); }
.editor-tab { height: 30px; padding: 0 12px; display: inline-flex; align-items: center; border-radius: 999px; font-size: 15px; color: var(--text-2); }
.editor-tab.on { color: var(--text); background: color-mix(in srgb, var(--text) 8%, transparent); }
.editor-action { margin-left: auto; height: 30px; padding: 0 10px; border-radius: 999px; font-size: 15px; color: var(--text-2); }
.editor-action:hover:not(:disabled) { color: var(--text); background: var(--hover); }
.editor-action:disabled { opacity: 0.45; }
.shape-grid { display: grid; grid-template-columns: repeat(5, 1fr); justify-items: center; gap: 10px 4px; padding: 18px 12px 8px; }
.shape-pick { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; transition: background 0.15s, transform 0.15s; }
.shape-pick:hover { background: var(--hover); transform: scale(1.06); }
.shape-pick.on { background: var(--active); }
.shape-pick .face { width: 38px; height: 38px; }
/* Seven to a row, so thirteen colors make two centered rows. */
.color-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px 10px; max-width: calc(7 * 26px + 6 * 10px + 28px); margin: 0 auto; padding: 14px 14px 20px; }
.color-pick { width: 26px; height: 26px; border-radius: 50%; background: var(--swatch); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12); transition: transform 0.15s; }
.color-pick:hover { transform: scale(1.1); }
.color-pick.on { box-shadow: 0 0 0 3px color-mix(in srgb, var(--text) 6%, var(--main)), 0 0 0 4.5px var(--text); }
.editor-body { display: flex; flex-direction: column; gap: 12px; padding: 14px; }
.editor-body textarea { width: 100%; min-height: 150px; resize: vertical; padding: 10px 12px; border-radius: 12px; border: var(--hairline) solid var(--field-line);
  background: var(--field); color: var(--text); font: inherit; font-size: 15px; line-height: 22px; outline: none; }
.editor-body textarea:focus { border-color: color-mix(in srgb, var(--text) 30%, transparent); }
.editor-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 0 14px 14px; }
.editor-foot .soft-btn, .editor-foot .primary-btn { flex: none; min-width: 84px; }
.menu-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-hint { margin-left: 10px; font-size: 13px; color: var(--text-3); white-space: nowrap; }
.menu-item.danger { color: var(--danger); }
.menu-item.danger:hover { color: var(--danger); background: color-mix(in srgb, var(--danger) 9%, transparent); }
.menu-note { display: flex; gap: 8px; margin: 4px 10px 6px; max-width: 220px; font-size: 13px; line-height: 18px; color: var(--text-2); }
.menu-note .icon { flex: none; margin-top: 2px; color: #f19d38; }
.bot-menu { min-width: 240px; }
.tabs { display: flex; justify-content: center; gap: 4px; margin: 18px 0 22px; }
.tab { height: 30px; padding: 0 12px; border-radius: 999px; font-size: 15px; color: var(--text-2); transition: background 0.15s, color 0.15s; }
.tab:hover { color: var(--text); }
.tab.on { color: var(--text); background: color-mix(in srgb, var(--text) 8%, transparent); }
.tab-body { display: flex; flex-direction: column; gap: 24px; }
.tab-loading { display: grid; place-items: center; padding: 28px 0; }
.section-label { margin: 0 0 10px; font-size: 14px; line-height: 18px; font-weight: 400; color: var(--text-2); }
.section-empty { margin: 0; padding: 13px 14px; border-radius: 14px; border: var(--hairline) solid var(--card-line); font-size: 14px; line-height: 20px; color: var(--text-2); }
.details-section { display: flex; flex-direction: column; gap: 12px; }
.details-section > .section-label { margin-bottom: -2px; }

.summary { display: flex; flex-direction: column; margin-bottom: 18px; }
.summary-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.summary-when { font-size: 12px; line-height: 18px; color: var(--text-3); white-space: nowrap; }
.summary-when.updating { animation: pulse 1.6s ease-in-out infinite; }
.summary-list { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 12px 14px 12px 30px; border-radius: 14px;
  border: var(--hairline) solid var(--card-line); font-size: 14px; line-height: 20px; color: var(--text); }
.summary-list li::marker { color: var(--text-3); }
.routines { display: flex; flex-direction: column; }
.routine-card { display: flex; align-items: center; gap: 10px; min-height: 56px; margin-bottom: 8px; padding-right: 12px; border-radius: 14px; border: var(--hairline) solid var(--card-line); transition: background 0.15s; }
.routine-card:hover { background: var(--hover); }
.routine-open { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 9px 0 9px 12px; text-align: left; }
.routine-title { max-width: 100%; font-size: 15px; line-height: 20px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.routine-when { max-width: 100%; font-size: 14px; line-height: 19px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.routine-card.paused .routine-title { color: var(--text-2); }
.toggle { position: relative; flex: none; width: 34px; height: 20px; border-radius: 999px; background: color-mix(in srgb, var(--text) 18%, transparent); transition: background 0.18s; }
.toggle i { position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #ffffff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); transition: transform 0.18s; }
.toggle.on { background: color-mix(in srgb, var(--text) 45%, transparent); }
.toggle.on i { transform: translateX(14px); }

/* A long title ends in an ellipsis instead of pushing the close button out of the panel. */
.routine-head .panel-title { min-width: 0; }
.routine-head-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.routine-body { gap: 22px; padding-top: 8px; }
.routine-body section { display: flex; flex-direction: column; }
.routine-prompt { margin: 0 0 12px; font-size: 15px; line-height: 22px; white-space: pre-wrap; overflow-wrap: anywhere; }
.routine-prompt:last-child { margin-bottom: 0; }
.routine-schedule { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 15px; line-height: 22px; color: var(--text-2); }
.routine-facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 14px 0 0; font-size: 13px; line-height: 18px; }
.routine-facts dt { color: var(--text-3); }
.routine-facts dd { margin: 0; color: var(--text-2); }
.routine-foot { flex: none; display: flex; gap: 8px; padding: 12px 16px 16px; padding-bottom: max(16px, env(safe-area-inset-bottom)); }
.soft-btn { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 0; height: 36px; padding: 0 12px; border-radius: 999px;
  background: color-mix(in srgb, var(--text) 8%, transparent); border: var(--hairline) solid color-mix(in srgb, var(--text) 13%, transparent);
  color: var(--text); font-size: 15px; white-space: nowrap; transition: background 0.15s; }
.soft-btn:hover { background: color-mix(in srgb, var(--text) 13%, transparent); }
.soft-btn:disabled { opacity: 0.5; }
.soft-btn.round { flex: none; width: 36px; padding: 0; color: var(--text-2); }
.routine-foot .soft-btn:not(.round), .routine-foot .primary-btn { flex: 1 1 auto; padding: 0 10px; }
.days { display: flex; gap: 6px; }
.day { flex: 1; height: 34px; border-radius: 999px; border: var(--hairline) solid var(--card-line); font-size: 13px; color: var(--text-2); transition: background 0.15s, color 0.15s; }
.day.on { background: var(--text); border-color: var(--text); color: var(--main); }
.form-error { margin: 0; font-size: 13px; color: var(--danger); }

.routine-line { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 6px; }
.routine-ref { display: inline-flex; align-items: center; gap: 5px; padding: 2px 6px; border-radius: 999px; color: var(--text-2); transition: background 0.15s, color 0.15s; }
button.routine-ref:hover { color: var(--text); background: var(--hover); }
.routine-note { color: var(--text-3); }
.routine-note::before { content: "· "; }
.summary-line { display: flex; flex-direction: column; align-items: center; gap: 6px; max-width: 100%; }
.summary-text { display: none; max-width: min(560px, 92%); padding: 10px 14px; border-radius: 14px; background: color-mix(in srgb, var(--bubble) 60%, transparent);
  color: var(--text-2); font-size: 13px; line-height: 19px; text-align: left; overflow-wrap: anywhere; }
.summary-line.open .summary-text { display: block; }

.item.file { display: flex; }
.file-card { display: flex; align-items: center; width: 100%; max-width: 308px; padding-right: 6px; border-radius: 16px;
  background: color-mix(in srgb, var(--text) 6%, var(--main)); border: var(--hairline) solid var(--card-line); }
.file-open { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 9px 0 9px 9px; text-align: left; }
.file-tile { flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 9px; color: var(--text-2); background: color-mix(in srgb, var(--text) 8%, transparent); }
.file-tile.md-tile { color: var(--unread); background: color-mix(in srgb, var(--unread) 22%, transparent); }
.file-text { min-width: 0; display: flex; flex-direction: column; }
.file-name { font-size: 15px; line-height: 20px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-size { font-size: 13px; line-height: 17px; color: var(--text-2); }
.file-download { flex: none; width: 32px; height: 32px; color: var(--text-2); }

/* A picture a bot made: as wide as a bubble may be, narrower when it is tall, its own shape while it loads, and its
   name, its model and a download under it. */
.item.picture { align-self: flex-start; display: flex; flex-direction: column; gap: 4px;
  width: min(var(--picture-cap, 76%), 460px, var(--picture-fit, 460px)); }
.picture-frame { display: block; width: 100%; border-radius: 18px; overflow: hidden; background: var(--bubble); cursor: zoom-in; }
.picture-frame img { display: block; width: 100%; height: auto; }
.picture-meta { display: flex; align-items: center; gap: 6px; min-width: 0; padding-left: 6px; font-size: 13px; line-height: 18px; color: var(--text-3); }
.picture-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.picture-model { flex: none; white-space: nowrap; }
.picture-model::before { content: "·"; margin-right: 6px; }
.picture-download { flex: none; margin-left: auto; width: 30px; height: 30px; color: var(--text-2); }
.pictures-model select { width: 100%; }

.library { display: flex; flex-direction: column; gap: 18px; }
.library-day { display: flex; flex-direction: column; gap: 8px; }
.library-day .section-label { margin-bottom: 2px; }
.library-item { display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 14px; border-radius: 14px; border: var(--hairline) solid var(--card-line); text-align: left; transition: background 0.15s; }
.library-item:hover { background: var(--hover); }
.library-mark { flex: none; display: grid; color: var(--text-2); }
.library-name { min-width: 0; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ------------------------------------------------------------------ document viewer */

.viewer-backdrop { position: fixed; inset: 0; z-index: 55; display: flex; padding: 38px; background: rgba(0, 0, 0, 0.55); backdrop-filter: blur(3px); animation: fade 0.15s ease-out; }
.viewer { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; border-radius: 14px; background: var(--main); border: var(--hairline) solid var(--line); box-shadow: 0 30px 90px rgba(0, 0, 0, 0.45); animation: pop 0.16s ease-out; }
.viewer-head { flex: none; display: flex; align-items: center; gap: 4px; height: 40px; padding: 0 6px 0 16px; background: var(--side); border-bottom: var(--hairline) solid var(--line); }
.viewer-title { flex: 1; min-width: 0; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-head .icon-btn { width: 32px; height: 32px; color: var(--text-2); }
.viewer-body { flex: 1; min-height: 0; overflow-y: auto; }
.viewer-loading, .viewer-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; height: 100%; padding: 24px; color: var(--text-2); text-align: center; }
.viewer-empty p { margin: 0; font-size: 14px; }
.viewer-empty .primary-btn { text-decoration: none; }
.viewer-image { display: grid; place-items: center; min-height: 100%; padding: 24px; }
.viewer-image img { max-width: 100%; border-radius: 10px; }
.doc { max-width: 560px; margin: 0 auto; padding: 44px 24px 72px; font-size: 15px; line-height: 23px; }
.doc p { margin: 0 0 14px; }
.doc .md-heading { margin: 26px 0 10px; font-weight: 600; letter-spacing: -0.01em; }
.doc .md-heading[data-level="1"] { margin-top: 0; font-size: 24px; line-height: 30px; }
.doc .md-heading[data-level="2"] { font-size: 20px; line-height: 26px; }
.doc .md-heading[data-level="3"] { font-size: 17px; line-height: 23px; }
.doc a { color: var(--link); text-decoration: none; }
.doc a:hover { text-decoration: underline; }
.doc li + li { margin-top: 4px; }
.doc-text { margin: 0; padding: 24px; font: 13px/19px ui-monospace, "SF Mono", Menlo, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.md-table { margin: 6px 0 16px; overflow-x: auto; }
.md table { border-collapse: collapse; min-width: 100%; font-size: 14px; line-height: 20px; }
.md th { padding: 8px 12px; font-weight: 500; text-align: left; vertical-align: bottom; border-bottom: var(--hairline) solid var(--card-line); }
/* Columns keep a readable width; a wide table scrolls sideways instead of squeezing words into letters. */
.md th, .md td { min-width: 6.5em; }
.md td { padding: 10px 12px; text-align: left; vertical-align: top; border-bottom: var(--hairline) solid var(--line); }
.md tr:last-child td { border-bottom: 0; }
.md .align-center { text-align: center; }
.md .align-right { text-align: right; }
.bubble .md-table { margin: 4px 0 10px; }

@media (max-width: 759px) {
  .viewer-backdrop { padding: 0; }
  .viewer { border-radius: 0; border: 0; padding-top: env(safe-area-inset-top); }
  .viewer-head { height: 48px; }
  .doc { padding: 28px 18px 56px; }
  .file-card { max-width: 86%; }
  .item.picture { --picture-cap: 86%; }
}

/* ------------------------------------------------------------------ models: the settings sheet and the bot's model picker */

.sheet-backdrop { padding: 38px max(38px, calc((100vw - 640px) / 2)); }
.sheet { flex: 0 1 640px; align-self: flex-start; max-height: 100%; margin: 0 auto; }
.sheet-body { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 22px; padding: 20px 20px 28px; }
.sheet-lead { margin: 0; font-size: 14px; line-height: 20px; color: var(--text-2); }
.sheet-section { display: flex; flex-direction: column; gap: 8px; }
.sheet-section > .section-label { margin-bottom: 2px; }
.sheet-note { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 12px; line-height: 17px; color: var(--text-3); }
.sheet-error { margin: 0; font-size: 13px; line-height: 18px; color: var(--danger); }
.provider-row { border-radius: 14px; border: var(--hairline) solid var(--card-line); }
.provider-main { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 8px 10px 8px 14px; }
.provider-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: color-mix(in srgb, var(--text) 18%, transparent); }
.provider-dot.on { background: #23a45f; }
.provider-dot.waiting { background: var(--amber); }
.sheet-empty { margin: 0; font-size: 14px; line-height: 20px; color: var(--text-3); }
.provider-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.provider-name { font-size: 15px; line-height: 20px; }
.provider-status { font-size: 13px; line-height: 18px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.provider-actions { flex: none; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; max-width: 60%; }
.primary-btn.small, .soft-btn.small { flex: none; height: 32px; padding: 0 12px; font-size: 13px; }
.login-holder { padding: 0 14px 14px; }
.login-card { display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: 12px; background: color-mix(in srgb, var(--text) 5%, transparent); }
.login-open { align-self: flex-start; text-decoration: none; }
.login-step, .login-hint { margin: 0; font-size: 13px; line-height: 18px; color: var(--text-2); }
.login-wait { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 13px; color: var(--text-2); }
.login-field input { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 13px; }
.login-options { display: flex; flex-wrap: wrap; gap: 6px; }
.login-actions { display: flex; justify-content: flex-end; gap: 8px; }
.login-other { margin: 0; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.link-btn { padding: 0; font-size: 13px; color: var(--text-2); text-decoration: underline; text-decoration-color: var(--text-3); text-underline-offset: 2px; }
.link-btn:hover { color: var(--text); }
.login-actions .soft-btn, .login-actions .primary-btn { flex: none; min-width: 84px; }
.device-code { align-self: flex-start; padding: 8px 14px; border-radius: 10px; background: var(--field); border: var(--hairline) solid var(--field-line);
  font: 600 20px/28px ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: 0.12em; user-select: all; }

.model-editor .editor-body { gap: 10px; }
.model-current { margin: 0; font-size: 15px; line-height: 20px; }
.model-editor input[type="search"] { width: 100%; height: 36px; padding: 0 12px; border-radius: 10px; border: var(--hairline) solid var(--field-line);
  background: var(--field); color: var(--text); font: inherit; font-size: 14px; outline: none; }
.model-editor input[type="search"]:focus { border-color: color-mix(in srgb, var(--text) 30%, transparent); }
.model-list { max-height: 300px; overflow-y: auto; margin: 0 -6px; padding: 0 6px; }
.model-group + .model-group { margin-top: 8px; }
.model-provider { position: sticky; top: 0; z-index: 1; margin: 0; padding: 6px 4px 4px; font-size: 12px; line-height: 16px; color: var(--text-3);
  background: color-mix(in srgb, var(--text) 6%, var(--main)); }
.model-row { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 34px; padding: 6px 8px; border-radius: 9px; text-align: left; font-size: 14px; }
.model-row:hover { background: var(--hover); }
.model-row.on { background: var(--active); }
.model-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.model-note { flex: none; font-size: 12px; color: var(--amber); }
.model-check { flex: none; }
.model-more { margin: 8px 4px 0; font-size: 12px; color: var(--text-3); }
.model-all { margin: 2px 0 0; padding: 6px 8px; font-size: 13px; color: var(--text-2); border-radius: 9px; }
.model-all:hover { color: var(--text); background: var(--hover); }
.model-from { color: var(--text-2); }
.model-connect { display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; padding: 4px 2px; font-size: 13px; color: var(--text-2); }
.model-connect:hover { color: var(--text); }

@media (max-width: 759px) {
  .sheet-backdrop { padding: 0; }
  .sheet { flex: 1; align-self: stretch; max-height: none; }
  .provider-main { flex-wrap: wrap; }
  .provider-actions { max-width: none; width: 100%; justify-content: flex-start; padding-left: 20px; }
}

/* ------------------------------------------------------------------ apps: Connect apps, as in Grok Bot, and questions in the chat */

/* The bottom of the sidebar: the usage carousel over the picture and the Connect apps pill. */
.side-bottom { display: flex; flex-direction: column; gap: 8px; }
.side-bottom > .me-usage { flex: none; width: 100%; height: 32px; }
.apps-pill { flex: 1; min-width: 0; height: 36px; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 0 8px 0 14px;
  border-radius: 999px; background: var(--pill); border: var(--hairline) solid var(--pill-line); font-size: 14px; color: var(--text); transition: background 0.15s; }
.apps-pill:hover { background: color-mix(in srgb, var(--text) 7%, transparent); }
.apps-pill-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.apps-pill-dot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--amber); }
.logo-stack { flex: none; display: inline-flex; align-items: center; }
.logo-stack .app-logo + .app-logo { margin-left: -6px; }
.logo-stack .app-logo { box-shadow: 0 0 0 1.5px var(--side); }

/* An app's logo on a rounded tile. Cursor's logos carry their own background; the tile shows behind transparent ones. */
.app-logo { flex: none; position: relative; display: inline-grid; place-items: center; overflow: hidden; background: #fff;
  box-shadow: inset 0 0 0 var(--hairline) rgba(0, 0, 0, 0.08); }
.app-logo img { width: 100%; height: 100%; object-fit: cover; }
.app-logo.round { background: none; box-shadow: none; }
a.soft-btn, a.primary-btn { text-decoration: none; }
.app-letter { font-size: 15px; font-weight: 600; color: #333; }

/* The sheet, wider than the Models sheet, with its own head instead of a title bar. */
.apps-backdrop { padding: 38px max(38px, calc((100vw - 900px) / 2)); }
.apps-sheet { flex-basis: 900px; }
.apps-body { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 22px; padding: 22px 30px 30px; }
.apps-top { display: flex; align-items: center; gap: 10px; min-height: 40px; }
.apps-top h2 { flex: 1; min-width: 0; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 22px; line-height: 28px; font-weight: 500; letter-spacing: -0.01em; }
.apps-top .apps-top-title { font-size: 17px; text-align: center; }
.apps-top-space { flex: 1; }
.apps-top .icon-btn { width: 36px; height: 36px; color: var(--text-2); }
.apps-connected { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 8px 0 10px; border-radius: 999px; font-size: 14px; color: var(--text-2); transition: background 0.15s, color 0.15s; }
.apps-connected:hover { background: var(--hover); color: var(--text); }
.apps-connected .logo-stack .app-logo { box-shadow: 0 0 0 1.5px var(--main); }
.apps-section { display: flex; flex-direction: column; gap: 8px; }
.apps-section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.apps-section-head h3 { margin: 0; font-size: 16px; line-height: 22px; font-weight: 500; }
.apps-count { font-size: 13px; color: var(--text-3); }
.apps-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 14px; margin: 0 -10px; }
.apps-grid.one { grid-template-columns: minmax(0, 1fr); }
.app-row { display: flex; align-items: center; gap: 14px; min-width: 0; padding: 10px; border-radius: 16px; cursor: pointer; transition: background 0.15s; }
.app-row:hover, .app-row:focus-visible { background: var(--hover); outline: none; }
.app-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.app-name { display: flex; align-items: center; gap: 6px; font-size: 15px; line-height: 21px; }
.app-desc { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; line-height: 20px; color: var(--text-2); }
.app-warn { display: inline-grid; color: var(--amber); }
.app-added { flex: none; display: inline-flex; align-items: center; gap: 4px; padding: 0 6px; font-size: 13px; color: var(--text-2); }
.app-action.soft-btn.small { min-width: 58px; }
.apps-empty { margin: 0; padding: 18px 0; font-size: 14px; color: var(--text-2); text-align: center; }
.apps-note { display: block; }
.apps-note .icon { display: inline-block; vertical-align: -2px; margin-right: 6px; }
.apps-note a { color: inherit; }
.apps-error { padding: 24px; }

/* One app: its logo and name, what bots can do with it, and where it comes from. */
.app-hero { display: flex; align-items: center; gap: 16px; }
.app-hero-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.app-hero h2 { margin: 0; font-size: 22px; line-height: 28px; font-weight: 500; }
.app-source { align-self: flex-start; display: inline-flex; align-items: center; gap: 3px; font-size: 14px; color: var(--text-2); text-decoration: none; }
.app-source:hover { color: var(--text); }
.app-hero .app-action, .app-hero .soft-btn { flex: none; min-width: 84px; }
.app-description { margin: 0; font-size: 15px; line-height: 22px; color: var(--text); }
.app-account { margin: 0; font-size: 14px; line-height: 20px; color: var(--text-2); }
.app-description a, .app-account a { color: var(--link); }
.app-problem { display: flex; align-items: flex-start; gap: 8px; padding: 10px 12px; border-radius: 12px; background: var(--amber-bg); color: var(--text); font-size: 13px; line-height: 19px; }
.app-problem .icon { flex: none; margin-top: 2px; color: var(--amber); }
.app-problem a { color: inherit; font-weight: 500; }
.apps-tools-list, .apps-info { display: flex; flex-direction: column; border-radius: 14px; background: color-mix(in srgb, var(--text) 4%, transparent); }
.apps-tool, .apps-info-row { display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 0 16px; font-size: 14px; }
.apps-tool + .apps-tool, .apps-info-row + .apps-info-row { border-top: var(--hairline) solid var(--line); }
.apps-tool-title { flex: 1; min-width: 0; }
.apps-info-row > span:first-child { flex: none; }
.apps-info-value { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: right; color: var(--text-2); }
.apps-info-value a { color: inherit; }
.apps-account-row .link-btn { flex: none; }
.apps-account-row > span:first-child { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.apps-more { align-self: flex-start; margin-left: 4px; text-decoration: none; }
.tag { flex: none; height: 22px; display: inline-flex; align-items: center; padding: 0 8px; border-radius: 999px; font-size: 12px; color: var(--amber); background: var(--amber-bg); }
.tag.danger { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); }
.apps-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.danger-text { color: var(--danger); }

/* Setting up Google once: the steps in his own Google Cloud project, then the client's ID and secret. */
.setup-steps { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 10px; font-size: 14px; line-height: 21px; color: var(--text); }
.setup-steps a { color: var(--link); }
.setup-copy { display: flex; align-items: center; gap: 4px; margin-top: 6px; padding: 4px 4px 4px 12px; border-radius: 10px; background: var(--field); border: var(--hairline) solid var(--field-line); }
.setup-copy code { flex: 1; min-width: 0; overflow-wrap: anywhere; font: 13px/18px ui-monospace, "SF Mono", Menlo, monospace; }
.copy-btn { flex: none; width: 30px; height: 30px; color: var(--text-2); }
.setup-fields { display: flex; flex-direction: column; gap: 12px; }
.setup-fields input { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 13px; }

/* A question in the chat: an app call that waits for David. */
.item.ask { display: flex; }
.ask-card { width: min(76%, 560px); padding: 12px 14px 12px; border-radius: 20px; background: var(--bubble); border: var(--hairline) solid var(--card-line); }
.ask-head { display: flex; align-items: center; gap: 8px; font-size: 13px; line-height: 18px; color: var(--text-2); }
.ask-app { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ask-wait { flex: none; color: var(--amber); }
.ask-title { margin-top: 6px; font-size: 15px; line-height: 21px; font-weight: 600; }
.ask-lines { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 3px 12px; margin: 8px 0 0; font-size: 13px; line-height: 19px; }
.ask-lines dt { color: var(--text-3); }
.ask-lines dd { margin: 0; min-width: 0; }
.ask-value { display: block; white-space: pre-wrap; overflow-wrap: anywhere; }
.ask-value.clamped { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; cursor: pointer; }
.ask-warn { display: flex; align-items: center; gap: 6px; margin: 8px 0 0; font-size: 13px; color: var(--danger); }
.ask-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
/* The call in words: facts with links, a preview of what it writes, and its raw arguments under Details. */
.ask-facts { margin-top: 10px; }
.ask-link { display: inline-flex; align-items: center; gap: 3px; max-width: 100%; color: var(--link); text-decoration: none; overflow-wrap: anywhere; }
.ask-link:hover { text-decoration: underline; }
.ask-link svg { flex: none; opacity: 0.7; }
.ask-preview { margin-top: 12px; border-radius: 14px; border: var(--hairline) solid var(--card-line); background: var(--main); overflow: hidden; }
.ask-preview-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 6px 6px 12px; border-bottom: var(--hairline) solid var(--line); }
.ask-preview-title { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 12px; line-height: 16px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ask-preview-title svg { flex: none; }
.ask-preview-head .soft-btn.small { flex: none; gap: 4px; }
/* The beginning of the preview, fading out at the bottom when there is more; a click opens all of it. */
.ask-preview-body { position: relative; max-height: 220px; overflow: hidden; padding: 10px 12px 12px; font-size: 13px; line-height: 19px; cursor: pointer; }
.ask-preview-body.overflows { -webkit-mask-image: linear-gradient(to bottom, #000 70%, transparent); mask-image: linear-gradient(to bottom, #000 70%, transparent); }
.ask-preview-body p { margin: 0 0 8px; }
.ask-preview-body .md-heading { margin: 10px 0 6px; font-size: 14px; line-height: 19px; font-weight: 600; }
.ask-preview-body .md-heading[data-level="1"] { margin-top: 0; font-size: 15px; }
.ask-preview-body .md-table { margin: 4px 0 8px; }
.ask-preview-body table { font-size: 12px; line-height: 16px; }
.ask-preview-body th, .ask-preview-body td { padding: 5px 8px; min-width: 4.5em; }
/* Spreadsheet cells stay on one line, as in a spreadsheet; a wide table scrolls sideways. */
.ask-preview-body td, .ask-preview-body th, .doc.wide td, .doc.wide th { white-space: nowrap; }
.doc.wide { max-width: 1000px; }
.ask-preview-body pre { margin: 4px 0; }
.ask-details { margin-top: 10px; font-size: 13px; }
.ask-details > summary { width: fit-content; color: var(--text-3); cursor: pointer; list-style-position: inside; }
.ask-details > summary:hover { color: var(--text-2); }
.ask-details .ask-lines { margin-top: 6px; }
.viewer-note { max-width: 560px; margin: 16px auto -28px; padding: 0 24px; font-size: 13px; color: var(--text-3); }
.ask-actions .soft-btn.small, .ask-actions .primary-btn.small { min-width: 72px; }
.say + .ask, .activity + .ask { margin-top: 12px; }

/* An app's own card of steps, with its logo where the computer card says Computer. */
.card.app-card .card-head .app-logo { border-radius: 5px; }

/* The tools a bot may use without asking, in its Details. */
.allowed { display: flex; flex-direction: column; margin-top: 18px; }
.allowed-row { display: flex; align-items: center; gap: 10px; min-height: 48px; margin-bottom: 8px; padding: 0 6px 0 12px; border-radius: 14px; border: var(--hairline) solid var(--card-line); font-size: 14px; }
.allowed-row .app-logo { border-radius: 6px; }
.allowed-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 19px; }
.allowed-app { font-size: 12px; color: var(--text-3); }
.allowed-row .icon-btn { color: var(--text-3); }

@media (max-width: 1099px) and (min-width: 760px) {
  .app[data-panel] .apps-pill { display: none; }
}

@media (max-width: 759px) {
  .apps-backdrop { padding: 0; }
  .apps-sheet { height: auto; }
  .apps-body { padding: 14px 16px 24px; padding-bottom: max(24px, env(safe-area-inset-bottom)); }
  .apps-grid { grid-template-columns: minmax(0, 1fr); margin: 0 -8px; }
  .app-row { padding: 8px; }
  .apps-top h2 { font-size: 20px; }
  .apps-connected .logo-stack { display: none; }
  .ask-card { width: 92%; }
  /* An account's row: its name on a line of its own, then what it has and what to do with it. */
  .apps-account-row { flex-wrap: wrap; row-gap: 2px; padding: 10px 16px; }
  .apps-account-row > span:first-child { flex: 1 1 100%; }
  .apps-account-row .apps-info-value { text-align: left; }
}

/* ---------------------------------------------------------------- the bot panel's icon tabs, as in Muse */
/* The open tab takes the room its name needs; the others share the rest. */
.icon-tabs { justify-content: space-between; gap: 2px; margin: 18px 0 20px; padding: 4px; border-radius: 999px;
  background: color-mix(in srgb, var(--text) 5%, transparent); border: var(--hairline) solid var(--card-line); }
.icon-tabs .tab { position: relative; flex: 1 1 0; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 0;
  height: 34px; padding: 0; font-size: 14px; }
.icon-tabs .tab.on { flex: 0 0 auto; padding: 0 13px 0 11px; color: var(--text); background: var(--panel);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 0 0 var(--hairline) var(--card-line); }
.tab-name { white-space: nowrap; }
.tab-dot { position: absolute; top: 7px; right: calc(50% - 13px); width: 6px; height: 6px; border-radius: 50%; background: var(--unread); display: none; }
.tab-dot.shown { display: block; }
.icon-tabs .tab.on .tab-dot { right: 6px; }
.section-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.section-row .section-label { margin: 0; }
.section-label.marked { display: inline-flex; align-items: center; gap: 7px; }
.section-label.marked::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--mark); }
.section-label.mark-blue { --mark: #6aaee0; }
.section-label.mark-amber { --mark: #f0b450; }

/* soul.md and memory.md: two cards, as in Muse */
.mind-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mind-card { position: relative; display: flex; flex-direction: column; align-items: flex-start; aspect-ratio: 1.12; padding: 13px 12px 12px;
  border-radius: 18px; overflow: hidden; color: #fff; text-align: left; isolation: isolate;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14), 0 6px 18px -10px rgba(0, 0, 0, 0.45);
  transition: transform 0.18s, box-shadow 0.18s; }
.mind-card::after { content: ""; position: absolute; inset: 0; z-index: -1; background: radial-gradient(120% 90% at 85% 100%, rgba(255, 255, 255, 0.22), transparent 55%); }
.mind-card.soul { background: linear-gradient(150deg, #ff6b7d 0%, #e8355f 42%, #b3123f 100%); }
.mind-card.memory { background: linear-gradient(150deg, #7e9bff 0%, #4560e6 45%, #6a3fd6 100%); }
.mind-card:active { transform: scale(0.98); }
.mind-title { font-size: 19px; line-height: 22px; font-weight: 700; letter-spacing: 0.02em; text-transform: uppercase; }
.mind-care { margin-top: 3px; font: 600 9.5px/13px ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: 0.04em; text-transform: uppercase; white-space: nowrap; opacity: 0.72; }
.mind-foot { display: flex; align-items: center; justify-content: space-between; width: 100%; margin-top: auto; }
.mind-date { font: 600 14px/18px ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: 0.02em; opacity: 0.9; }
.mind-heart { color: rgba(255, 255, 255, 0.85); }
.mind-head-title { font: 600 15px/20px ui-monospace, "SF Mono", Menlo, monospace; }
.mind-body { gap: 14px; padding-top: 6px; }
.mind-intro { margin: 0; font-size: 13px; line-height: 18px; color: var(--text-2); }
.mind-text { font-size: 15px; line-height: 22px; overflow-wrap: anywhere; }
.mind-text .md-heading { font-size: 15px; }
.mind-changed { margin: 4px 0 0; font-size: 12px; line-height: 16px; color: var(--text-3); }
.mind-editor { flex: 1; min-height: 240px; width: 100%; padding: 12px 14px; border-radius: 14px; border: var(--hairline) solid var(--field-line);
  background: var(--field); color: var(--text); font-size: 15px; line-height: 22px; resize: none; outline: none; }
.mind-editor:focus { border-color: color-mix(in srgb, var(--text) 30%, transparent); }
.mind-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12px; color: var(--text-3); }
.mind-count.over { color: var(--danger); }
.mind-line-text { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* goals, as in OpenMuse */
.goals { display: flex; flex-direction: column; }
.goal-row { display: flex; align-items: center; gap: 11px; width: 100%; margin-bottom: 8px; padding: 10px 12px; border-radius: 14px;
  border: var(--hairline) solid var(--card-line); text-align: left; transition: background 0.15s; }
.goal-row.done { opacity: 0.6; }
.goal-box { flex: none; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 7px;
  border: 1.5px solid color-mix(in srgb, var(--text) 30%, transparent); color: var(--main); }
.goal-row.done .goal-box, .milestone.done .goal-box { background: var(--text); border-color: var(--text); }
.goal-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.goal-title { font-size: 15px; line-height: 20px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.goal-line { display: flex; align-items: center; gap: 6px; font-size: 13px; line-height: 18px; color: var(--text-2); white-space: nowrap; overflow: hidden; }
.goal-owner { display: inline-flex; align-items: center; gap: 4px; color: var(--text-2); }
.goal-line .goal-owner::after { content: "·"; margin-left: 2px; color: var(--text-3); }
.goal-chevron { flex: none; color: var(--text-3); }
.progress { display: block; height: 4px; margin-top: 3px; border-radius: 4px; background: color-mix(in srgb, var(--text) 10%, transparent); overflow: hidden; }
.progress i { display: block; height: 100%; border-radius: 4px; background: #6aaee0; transition: width 0.3s; }
.goal-body .progress { margin: 0 0 6px; }
.goal-status { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.goal-status .soft-btn { margin-left: auto; }
.milestone { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 6px 0; border-bottom: var(--hairline) solid var(--line); }
.milestone:last-child { border-bottom: 0; }
.milestone button.goal-box { cursor: pointer; transition: background 0.15s; }
.milestone-title { flex: 1; min-width: 0; font-size: 14.5px; line-height: 20px; overflow-wrap: anywhere; }
.milestone.done .milestone-title { color: var(--text-2); }
.milestone-work { flex: none; height: 26px; padding: 0 10px; border-radius: 999px; font-size: 12.5px; color: var(--text-2);
  border: var(--hairline) solid var(--card-line); opacity: 0; transition: opacity 0.15s, background 0.15s; }
.milestone-work:focus-visible { opacity: 1; }

/* ideas, as in OpenMuse */
.ideas-head { margin-bottom: 0; }
.ideas-from { margin: 0; font-size: 13px; color: var(--text-2); }
.idea-list { display: flex; flex-direction: column; border-radius: 14px; border: var(--hairline) solid var(--card-line); overflow: hidden; }
.idea { border-bottom: var(--hairline) solid var(--line); }
.idea:last-child { border-bottom: 0; }
.idea-head { display: flex; align-items: flex-start; gap: 12px; width: 100%; padding: 12px 14px; text-align: left; transition: background 0.15s; }
.idea-tile { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; color: #c98a1c;
  background: color-mix(in srgb, #f0b450 18%, transparent); }
.idea-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.idea-title { font-size: 15px; line-height: 20px; font-weight: 500; }
.idea-why { font-size: 13.5px; line-height: 19px; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.idea.open .idea-why { display: block; }
.idea-meta { font-size: 12px; line-height: 16px; color: var(--text-3); }
.idea-more { display: flex; flex-direction: column; gap: 10px; padding: 0 14px 14px 60px; }
.idea-sources { display: flex; flex-direction: column; gap: 4px; margin: 0; padding-left: 16px; font-size: 13px; line-height: 18px; color: var(--text-2); }
.idea-sources a { color: var(--text); text-decoration: underline; text-decoration-color: var(--text-3); text-underline-offset: 2px; }
.idea-host { margin-left: 6px; color: var(--text-3); }
.idea-ask { padding: 10px 12px; border-radius: 12px; background: color-mix(in srgb, var(--text) 5%, transparent); }
.idea-label { font-size: 12px; line-height: 16px; color: var(--text-3); }
.idea-prompt { margin: 4px 0 0; font-size: 14px; line-height: 20px; white-space: pre-wrap; overflow-wrap: anywhere; }
.idea-prompt-edit { width: 100%; margin-top: 6px; padding: 8px 10px; border-radius: 10px; border: var(--hairline) solid var(--field-line);
  background: var(--field); color: var(--text); font-size: 14px; line-height: 20px; resize: vertical; outline: none; }
/* The buttons line up with the idea's tile, so all three fit on one line in the narrow panel. */
.idea-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-left: -46px; }
.ideas-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 28px 18px; border-radius: 14px; text-align: center;
  border: var(--hairline) solid var(--card-line); font-size: 13.5px; line-height: 19px; color: var(--text-2); }
.ideas-empty .icon { color: #c98a1c; }
.ideas-empty strong { font-size: 15px; font-weight: 500; color: var(--text); }
.ideas-started { display: flex; flex-direction: column; }
.idea-started { display: flex; align-items: center; gap: 8px; min-height: 34px; padding: 0 4px; border-radius: 10px; font-size: 14px; text-align: left; color: var(--text-2); }
.idea-started-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* activity, as in OpenMuse */
.filters { display: flex; gap: 6px; }
.filter { height: 30px; padding: 0 12px; border-radius: 999px; font-size: 13px; color: var(--text-2); border: var(--hairline) solid var(--card-line); transition: background 0.15s, color 0.15s; }
.filter.on { color: var(--main); background: var(--text); border-color: var(--text); }
.work-list { display: flex; flex-direction: column; gap: 8px; }
.work { display: flex; flex-direction: column; gap: 6px; width: 100%; padding: 11px 12px; border-radius: 14px; text-align: left;
  border: var(--hairline) solid var(--card-line); transition: background 0.15s; }
.work-top { display: flex; align-items: flex-start; gap: 10px; }
.work-tile { flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; color: #3d7fb3; background: color-mix(in srgb, #6aaee0 20%, transparent); }
.work-tile.working, .work-tile.waiting { color: var(--amber); background: var(--amber-bg); }
.work-tile.failed { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); }
.work-tile.quiet, .work-tile.stopped { color: var(--text-3); background: var(--hover); }
.work-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.work-title { font-size: 14.5px; line-height: 20px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.work-facts { display: flex; align-items: center; gap: 6px; font-size: 12.5px; line-height: 17px; color: var(--text-2); }
.work.failed .work-facts { color: var(--danger); }
.work-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--amber); animation: pulse 1.2s ease-in-out infinite; }
.work-when { flex: none; font-size: 12px; line-height: 20px; color: var(--text-3); white-space: nowrap; }
.work-where { display: flex; align-items: center; gap: 4px; padding-left: 40px; font-size: 12.5px; line-height: 17px; color: var(--text-2); }
.work-steps { margin: 0; padding: 0 0 0 58px; font-size: 12.5px; line-height: 18px; color: var(--text-2); }
.work-result { padding-left: 40px; font-size: 13.5px; line-height: 19px; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.work-files { display: flex; align-items: center; gap: 5px; padding-left: 40px; font-size: 12.5px; color: var(--text-2); }
.reviews { display: flex; flex-direction: column; }
.review { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 6px 0; border-bottom: var(--hairline) solid var(--line); }
.review:last-child { border-bottom: 0; }
.review-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.review-title { font-size: 14px; line-height: 19px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.review-meta { font-size: 12.5px; line-height: 17px; color: var(--text-2); }

/* ---------------------------------------------------------------- a bot's questions for David, with answers to click */
.item.question { display: flex; flex-direction: column; gap: 14px; width: min(76%, 560px); padding: 14px 14px 12px; border-radius: 22px;
  background: var(--panel); border: var(--hairline) solid var(--card-line); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04); }
.assistant + .question { margin-top: 6px; }
/* In a group the card lines up with the bot's bubbles, right of its face. */
.say > .question { margin: 6px 0 0 38px; }
.question-block { display: flex; flex-direction: column; }
.question-head { display: flex; align-items: center; gap: 8px; }
.question-header { font-size: 12px; line-height: 16px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-3); }
.question-hint { font-size: 12px; line-height: 16px; color: var(--text-3); }
.question-hint::before { content: "· "; }
.question-text { margin: 3px 0 10px; font-size: 15px; line-height: 21px; font-weight: 500; overflow-wrap: anywhere; }
.choices { display: flex; flex-direction: column; gap: 6px; }
.choice { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 9px 12px; border-radius: 14px; text-align: left;
  background: color-mix(in srgb, var(--text) 4%, transparent); border: var(--hairline) solid var(--card-line);
  transition: background 0.15s, border-color 0.15s, transform 0.1s; }
.choice:not(:disabled):active { transform: scale(0.99); }
.choice.on { background: color-mix(in srgb, var(--text) 9%, transparent); border-color: color-mix(in srgb, var(--text) 45%, transparent); }
.choice:disabled { cursor: default; }
.question.answered .choice:not(.on) { opacity: 0.45; }
.choice-mark { flex: none; display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; color: var(--main);
  border: 1.5px solid color-mix(in srgb, var(--text) 30%, transparent); }
.choice-mark.square { border-radius: 6px; }
.choice.on .choice-mark { background: var(--text); border-color: var(--text); }
.choice-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.choice-label { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 15px; line-height: 20px; color: var(--text); overflow-wrap: anywhere; }
.choice-pick { padding: 1px 7px; border-radius: 999px; font-size: 11px; line-height: 16px; font-weight: 500; color: #23a45f; background: rgba(35, 164, 95, 0.12); }
.choice-note { font-size: 13px; line-height: 18px; color: var(--text-2); overflow-wrap: anywhere; }
.choice-go { flex: none; color: var(--text-3); }
/* The answer buttons stay in view while a tall card scrolls, as on a phone with several questions. */
.question-foot { position: sticky; bottom: 0; display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  margin: -6px -4px -4px; padding: 6px 4px 4px; background: var(--panel); border-radius: 0 0 14px 14px; }
.question-own { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 4px; border-radius: 999px; font-size: 14px; color: var(--text-2);
  transition: color 0.15s; }
.question-foot .primary-btn.small { margin-left: auto; min-width: 88px; }
.question-note { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 13px; color: var(--text-3); }
@media (max-width: 759px) {
  .item.question { width: 100%; }
  .say > .question { width: calc(100% - 38px); }
}

/* ---------------------------------------------------------------- panel and question cards: mouse and touch */
@media (hover: hover) {
  .mind-card:hover { transform: translateY(-1px); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2), 0 10px 22px -10px rgba(0, 0, 0, 0.5); }
  .goal-row:hover, .idea-head:hover, .work:hover { background: var(--hover); }
  .milestone button.goal-box:hover { background: var(--hover); }
  .milestone.done button.goal-box:hover { background: var(--text-2); }
  .milestone:hover .milestone-work { opacity: 1; }
  .milestone-work:hover { background: var(--hover); color: var(--text); }
  .idea-started:hover { background: var(--hover); color: var(--text); }
  .filter:hover { color: var(--text); }
  .choice:not(:disabled):hover { background: color-mix(in srgb, var(--text) 8%, transparent); }
  .question-own:hover { color: var(--text); }
}
/* A press shows at once on a touch screen, where nothing hovers. */
.choice:not(:disabled):active, .goal-row:active, .idea-head:active, .work:active { background: color-mix(in srgb, var(--text) 10%, transparent); }
/* Fingers need room: controls at least 40 to 44 pixels tall, and a milestone's box answers a tap around it. */
@media (pointer: coarse) {
  .milestone-work { opacity: 1; height: 34px; padding: 0 12px; }
  .icon-tabs .tab { height: 40px; }
  .question-own { min-height: 44px; padding: 0 10px 0 2px; font-size: 15px; }
  .question-foot .primary-btn.small { height: 44px; padding: 0 20px; font-size: 15px; }
  .milestone .goal-box { position: relative; }
  .milestone button.goal-box::after { content: ""; position: absolute; inset: -12px; }
  .idea-actions .primary-btn.small, .idea-actions .soft-btn.small { height: 40px; padding: 0 16px; font-size: 14px; }
  .filter { height: 36px; padding: 0 14px; font-size: 14px; }
  .section-row .soft-btn.small, .goal-status .soft-btn.small { height: 36px; }
}
/* On a phone the file being edited fills what the keyboard leaves free, and the editor shrinks instead of the page scrolling. */
@media (max-width: 759px) {
  .mind-body.editing { overflow: hidden; }
  .mind-body.editing .mind-intro { display: none; }
  .mind-editor { min-height: 96px; }
}

/* ------------------------------------------------------------------ team: the org chart next to the chats */

.team-btn.active { background: var(--text); color: var(--main); border-color: transparent; }
.side-top .team-btn.active { background: var(--text); color: var(--main); }
.team { display: none; flex-direction: column; min-width: 0; min-height: 0; background: var(--main); }
.app[data-view="team"] .team { display: flex; }
.app[data-view="team"] .chat, .app[data-view="team"] .panel { display: none; }
.team-head { position: relative; display: flex; align-items: center; justify-content: center; height: 64px; padding: 0 14px; flex: none; border-bottom: var(--hairline) solid var(--line); }
.team-heading { display: flex; flex-direction: column; align-items: center; min-width: 0; }
.team-title { margin: 0; font-size: 15px; line-height: 20px; font-weight: 600; }
.team-count { font-size: 12px; line-height: 16px; color: var(--text-3); }
.team-close { position: absolute; right: 14px; }
.team-scroll { flex: 1; min-height: 0; overflow-y: auto; }
.org { position: relative; display: flex; flex-direction: column; align-items: center; max-width: 1040px; margin: 0 auto; padding: 32px 28px 64px; }
.org-empty { margin: 60px 0; color: var(--text-2); font-size: 14px; }

/* A card per bot: its face, name, job and what it is doing, then the group chats it is in. */
.org-card { position: relative; display: flex; flex-direction: column; gap: 10px; min-width: 0; padding: 12px; border-radius: 18px; background: var(--main); border: var(--hairline) solid var(--card-line); text-align: left; transition: opacity 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.15s; }
.org-open { display: flex; align-items: center; gap: 12px; min-width: 0; padding: 0; text-align: left; border-radius: 12px; }
.org-face { position: relative; flex: none; display: grid; place-items: center; }
.org-face .home-star { box-shadow: 0 0 0 2.5px var(--main); }
.org-text { display: flex; flex-direction: column; min-width: 0; }
.org-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; line-height: 20px; font-weight: 600; color: var(--text); }
.org-job { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; line-height: 18px; color: var(--text-2); }
.org-status { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; font-size: 12px; line-height: 16px; color: var(--text-3); }
.org-status.busy { color: var(--link); }
.org-status.waiting { color: var(--amber); }
.org-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.org-chip { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; height: 26px; padding: 0 10px; border-radius: 999px; background: var(--pill); border: var(--hairline) solid var(--pill-line); font-size: 12px; color: var(--text-2); }
.org-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.org-chip .icon { flex: none; opacity: 0.7; }
/* The model and thinking level: a quiet line that opens the model picker. Its icon lines up with the face above. */
.org-model { display: inline-flex; align-items: center; gap: 5px; align-self: flex-start; max-width: calc(100% + 8px); height: 26px; margin: -4px 0 0 -8px;
  padding: 0 8px; border-radius: 999px; font-size: 12px; line-height: 16px; color: var(--text-2); transition: background 0.15s, color 0.15s; }
.org-model .icon { flex: none; color: var(--text-3); transition: color 0.15s; }
.org-model-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.org-model-level { flex: none; margin-left: -1px; white-space: nowrap; }
.org-model-level:empty { display: none; }
.org-model.on { color: var(--text); background: var(--active); }
.org-model.on .icon { color: var(--text-2); }
.org-card.main .org-model { align-self: center; max-width: 100%; margin-left: 0; }

/* The model picker by its card, a sheet on a phone. */
.org-picker { position: absolute; z-index: 5; width: min(320px, calc(100% - 24px)); display: flex; flex-direction: column; }
.org-picker:focus-visible { outline: none; }
.org-picker .editor-card { min-height: 0; margin: 0; display: flex; flex-direction: column; box-shadow: var(--shadow); animation: pop 0.14s ease-out; }
.org-picker .editor-bar { flex: none; }
.org-picker .editor-tab { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.org-picker .editor-body { min-height: 0; }
.org-picker .editor-body > * { flex-shrink: 0; }
.org-picker .editor-body > .model-list { flex-shrink: 1; min-height: 96px; overscroll-behavior: contain; }

/* The main bot on top, a line down to the box of the bots that report to it. */
.org-top { display: flex; justify-content: center; width: 100%; }
.org-card.main { width: min(360px, 100%); align-items: center; padding: 18px 18px 16px; border-radius: 22px; background: var(--side); }
.org-card.main .org-open { flex-direction: column; gap: 10px; text-align: center; }
.org-card.main .org-text { align-items: center; }
.org-card.main .org-name { font-size: 17px; line-height: 22px; }
.org-card.main .org-chips { justify-content: center; }
.org-spine { width: 1px; height: 28px; background: var(--card-line); }
.org-team { position: relative; width: 100%; padding: 26px 16px 16px; border-radius: 24px; border: var(--hairline) solid var(--card-line); }
.org-legend { position: absolute; top: -9px; left: 50%; transform: translateX(-50%); padding: 0 10px; background: var(--main); font-size: 12px; line-height: 18px; color: var(--text-3); white-space: nowrap; }
.org-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }

/* Group chats, each with its bots. */
.org-group-section { width: 100%; margin-top: 34px; }
.org-heading { display: flex; align-items: center; gap: 8px; margin: 0 0 12px 4px; font-size: 13px; line-height: 18px; font-weight: 600; color: var(--text-2); }
.org-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.org-card.group { flex-direction: row; align-items: center; gap: 12px; }
.org-cluster { flex: none; display: grid; place-items: center; width: 48px; height: 48px; }
.org-card .org-job { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

/* Pointing at a bot lights its groups; pointing at a group lights its bots. The rest steps back. */
.org.focused .org-card:not(.lit) { opacity: 0.38; }
.org-card.lit { border-color: color-mix(in srgb, var(--link) 55%, transparent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--link) 14%, transparent); }
@media (hover: hover) {
  .org-card:not(.main):hover { transform: translateY(-1px); }
  .org-chip:hover { color: var(--text); background: var(--hover); }
  .org-model:hover { color: var(--text); background: var(--hover); }
  .org-model:hover .icon { color: var(--text-2); }
}
/* Without a pointer that hovers, the model line shows as a chip, so it reads as something to tap. */
@media (hover: none) {
  .org-model { margin-left: 0; max-width: 100%; padding: 0 10px; background: var(--pill); }
}
.org-card.group:active, .org-open:active { opacity: 0.8; }
.org-model:active { background: var(--active); }

@media (max-width: 759px) {
  .app[data-view="team"] .sidebar { display: none; }
  .team-head { height: 56px; padding-top: env(safe-area-inset-top); box-sizing: content-box; }
  .team-close { display: none; }
  .team .back-btn { display: grid; }
  .org { padding: 20px 14px 48px; }
  .org-team { padding: 24px 10px 10px; border-radius: 20px; }
  .org-grid, .org-groups { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .org-chip { height: 30px; }
  .org-model { height: 30px; }
  /* A sheet over the bottom of the screen, above the keyboard when it is open. */
  .org-picker { position: fixed; z-index: 40; left: 0; right: 0; top: var(--app-top, 0); width: auto; height: var(--app-height, 100dvh);
    justify-content: flex-end; padding: max(12px, env(safe-area-inset-top)) 8px max(8px, env(safe-area-inset-bottom)); background: rgba(0, 0, 0, 0.4);
    animation: fade 0.15s ease-out; }
  .org-picker .editor-card { border-radius: 22px; }
}
@media (max-width: 759px) and (pointer: coarse) {
  .org-chip { height: 34px; padding: 0 12px; font-size: 13px; }
  .org-model { height: 34px; padding: 0 12px; font-size: 13px; }
}
/* Fingers need room in the picker too. */
@media (pointer: coarse) {
  .model-editor .model-row { min-height: 42px; }
  .model-editor .model-all { min-height: 38px; }
  .model-editor input[type="search"] { height: 40px; }
}

/* ------------------------------------------------------------------ artifacts: the apps bots build */

.artifact-tile { flex: none; display: grid; place-items: center; width: var(--tile, 36px); height: var(--tile, 36px); border-radius: calc(var(--tile, 36px) * 0.26); color: var(--text-2); background: color-mix(in srgb, var(--text) 7%, transparent); }
.artifact-emoji { font-size: calc(var(--tile, 36px) * 0.55); line-height: 1; }

/* The Artifacts tab: one row per app, its tools on hover, and every bot's under its face in the main bot's tab. */
.artifact-groups { display: flex; flex-direction: column; gap: 18px; }
.artifact-owner { display: flex; align-items: center; gap: 7px; }
.artifact-list { display: flex; flex-direction: column; gap: 8px; }
.artifact-row { position: relative; display: flex; align-items: center; border-radius: 14px; border: var(--hairline) solid var(--card-line); transition: background 0.15s; }
.artifact-open { flex: 1; min-width: 0; display: flex; align-items: flex-start; gap: 12px; padding: 11px 12px; text-align: left; border-radius: 14px; }
.artifact-text { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.artifact-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; line-height: 20px; font-weight: 500; color: var(--text); }
.artifact-desc { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 13px; line-height: 18px; color: var(--text-2); }
.artifact-meta { font-size: 12px; line-height: 16px; color: var(--text-3); }
.artifact-tools { position: absolute; top: 6px; right: 6px; display: flex; gap: 2px; padding: 1px; border-radius: 999px; background: var(--panel); opacity: 0; transition: opacity 0.15s; }
.artifact-tools .icon-btn { width: 30px; height: 30px; }
.danger-icon:hover { color: var(--danger); }
@media (hover: hover) {
  .artifact-row:hover { background: var(--hover); }
  .artifact-row:hover .artifact-tools, .artifact-row:focus-within .artifact-tools { opacity: 1; }
}
@media (hover: none) {
  .artifact-tools { position: static; flex: none; opacity: 1; margin-right: 6px; background: none; }
  .artifact-tools .icon-btn { width: 40px; height: 40px; }
}

/* The card a publish makes in the chat. */
.item.artifact { display: flex; }
.artifact-card { display: flex; align-items: flex-start; gap: 12px; width: 100%; max-width: 380px; padding: 12px 12px 12px 12px; border-radius: 16px; text-align: left;
  background: color-mix(in srgb, var(--text) 6%, var(--main)); border: var(--hairline) solid var(--card-line); transition: background 0.15s; }
.artifact-card .artifact-text { flex: 1; }
.artifact-card .artifact-desc { display: block; margin-top: 3px; }
.artifact-go { flex: none; align-self: center; display: inline-flex; align-items: center; gap: 3px; height: 30px; padding: 0 9px 0 12px; border-radius: 999px; font-size: 13px; color: var(--text); background: var(--pill); border: var(--hairline) solid var(--pill-line); }
.artifact-card.gone { opacity: 0.55; }
@media (hover: hover) { button.artifact-card:hover { background: color-mix(in srgb, var(--text) 9%, var(--main)); } }

/* An open artifact: the panel grows to give the app room next to the chat, or takes the chat's place too. */
@media (min-width: 1100px) { .app[data-panel="artifact"] .panel { width: clamp(440px, 52vw, 1040px); } }
@media (min-width: 760px) {
  .app[data-panel="artifact"][data-wide] .chat { display: none; }
  .app[data-panel="artifact"][data-wide] .panel { grid-column: 2 / -1; width: auto; }
}
.artifact-panel { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.artifact-head { flex: none; display: flex; align-items: center; gap: 6px; height: 64px; padding: 0 10px 0 8px; border-bottom: var(--hairline) solid var(--line); }
.artifact-head-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; }
.artifact-head-tile { display: grid; }
.artifact-head-text { min-width: 0; display: flex; flex-direction: column; }
.artifact-head-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; line-height: 20px; font-weight: 600; }
.artifact-head-meta { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; line-height: 16px; color: var(--text-3); }
.artifact-head-tools { flex: none; display: flex; align-items: center; gap: 2px; }
.pill-btn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; margin-right: 4px; border-radius: 999px; font-size: 13px; color: var(--text);
  background: var(--pill); border: var(--hairline) solid var(--pill-line); transition: background 0.15s; }
.pill-btn:hover { background: var(--hover); }
.artifact-stage { flex: 1; min-height: 0; display: flex; background: var(--main); }
.artifact-frame { flex: 1; width: 100%; height: 100%; border: 0; background: var(--main); }
.artifact-loading { flex: 1; }

@media (max-width: 1099px) and (min-width: 760px) {
  .app[data-panel="artifact"] .panel { width: min(620px, 60vw); }
  .artifact-ask span { display: none; }
  .artifact-ask { width: 34px; padding: 0; justify-content: center; }
}
@media (max-width: 759px) {
  .artifact-head { height: 56px; padding: 0 8px; }
  .artifact-wide, .artifact-reload { display: none; }
  .artifact-ask span { display: none; }
  .artifact-ask { width: 36px; padding: 0; justify-content: center; margin-right: 2px; }
  .artifact-card { max-width: 86%; }
}
