:root {
  /* Palette: "Midnight". Every color in the app comes from here. */
  --bg: #000000;              /* page behind everything */
  --sidebar: #0b0b0c;
  --card: #1c1c1e;            /* agent cards, dialogs, composer */
  --surface-2: #2c2c2e;       /* people's bubbles, inputs, chips */
  --surface-3: #3a3a3c;       /* your bubbles, highlights */
  --hover: #2c2c2e;
  --border: #2c2c2e;
  --border-strong: #48484a;
  --field-border: #5a5a5e;    /* text fields: 3:1 against cards */
  --text: #f2f2f7;
  --muted: #a1a1a8;
  --accent: #8b5a34;          /* warm brown: scroll chevron, primary buttons */
  --accent-hover: #9e6a40;
  --accent-soft: #3a2a1d;
  --accent-text: #f0b07a;     /* links and accent text on dark */
  --on-accent: #ffffff;
  --mine: var(--surface-3);
  --live: #4cd27a;            /* "typing…" */
  --success: #4cd27a;
  --success-bg: #12301d;
  --success-border: #1f5a34;
  --warning-text: #f5b562;
  --warning-line: #6a4a1c;
  --warning-bg: #2a1f0e;
  --danger: #ff6b5e;
  --danger-text: #ffb4ab;
  --danger-bg: #3a1714;
  --danger-border: #6e2a24;
  --overlay: rgb(0 0 0 / 0.55);
  --backdrop: rgb(0 0 0 / 0.65);
  --shadow: rgb(0 0 0 / 0.6);
  --avatar-you: #8b5a34;      /* agents' avatar colors come from their config */
  --avatar-fallback: #5a5a60;
  --radius: 22px;
  --content-w: 760px;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Inter, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

[hidden] { display: none !important; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 2px; }

.icon {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon.dots { stroke-width: 3.2; }

.boot { display: grid; place-items: center; height: 100dvh; color: var(--muted); }

/* --- Signed in: conversation list beside the open conversation --- */
.shell {
  position: relative;
  display: flex;
  height: 100dvh;
  background: var(--bg);
}
.sidebar {
  flex: none;
  display: flex;
  flex-direction: column;
  width: 300px;
  min-height: 0;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
}
.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 64px;
  padding: 14px 14px 10px 20px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.site-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-logo { flex: none; height: 30px; max-width: 120px; object-fit: contain; }
.brand-edit {
  flex: none;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: var(--card);
  color: var(--muted);
  font-size: 15px;
  cursor: pointer;
}
.brand-edit:hover { background: var(--surface-2); color: var(--text); }
.new-conv {
  margin: 6px 14px 8px;
  padding: 12px 16px;
  border: 0;
  border-radius: 999px;
  background: var(--card);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
}
.new-conv:hover { background: var(--surface-2); }
.sidebar-actions { display: flex; gap: 8px; margin: 6px 14px 8px; }
.sidebar-actions .new-conv { flex: 1; margin: 0; }
.sidebar-actions .agents-btn { flex: none; }
.new-conv:disabled { opacity: 0.45; cursor: default; }
.new-conv:disabled:hover { background: var(--card); }
.drawer-backdrop { display: none; }
.conv-list { flex: 1; overflow-y: auto; padding: 4px 10px; display: flex; flex-direction: column; gap: 4px; }
.conv-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 14px;
  border-radius: 18px;
  color: inherit;
  text-decoration: none;
}
.conv-item:hover { background: var(--card); }
.conv-item.active { background: var(--surface-2); }
.conv-top { display: flex; align-items: baseline; gap: 8px; }
.conv-title { flex: 1; min-width: 0; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-time { flex: none; font-size: 12px; color: var(--muted); }
.conv-preview { font-size: 14px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-empty { display: flex; flex-direction: column; gap: 4px; margin: 16px 10px; color: var(--muted); font-size: 14px; }
.conv-empty strong { color: var(--text); }
.sidebar-settings {
  margin: 8px 14px 14px;
  padding: 11px 16px;
  border: 0;
  border-radius: 999px;
  background: var(--card);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
}
.sidebar-settings:hover { background: var(--surface-2); }

.me {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 18px;
  background: var(--surface-2);
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.me:hover { background: var(--surface-3); }
.me-name { min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-tag, .chip-owner, .chip-off {
  flex: none;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}
.signout { color: var(--danger-text); }

.app {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}
.empty-pane { display: grid; place-items: center; }

/* --- Top bar: menu, the agent's face, more --- */
.topbar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 16px 8px;
}
.topbar-row {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: start;
  gap: 8px;
  width: 100%;
  max-width: var(--content-w);
  margin: 0 auto;
}
.circle-btn {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s;
}
.circle-btn:hover, .circle-btn[aria-expanded="true"] { background: var(--surface-2); }
.hero {
  justify-self: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
  max-width: 100%;
  padding: 0 4px;
}
.hero-avatar { display: grid; place-items: center; min-height: 72px; }
.hero-name {
  position: relative;
  max-width: 100%;
  margin-top: -12px;
  padding: 3px 12px;
  border: 2px solid var(--bg);
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 14px;
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hero-name:empty { display: none; }

.participants { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 8px; }
.participants:empty { display: none; }
.chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 6px 4px 4px;
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 13px;
  transition: box-shadow 0.2s, background 0.2s;
}
.chip.speaking { box-shadow: inset 0 0 0 2px var(--agent-color); background: color-mix(in srgb, var(--agent-color) 18%, var(--card)); }
.chip.speaking .avatar { animation: pulse 1.4s infinite ease-in-out; }
@keyframes pulse { 50% { transform: scale(1.12); } }
.chip-name { font-weight: 600; }

.avatar {
  position: relative;
  overflow: hidden;
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: var(--on-accent);
  font-weight: 700;
  font-size: 15px;
  user-select: none;
}
.avatar.sm { width: 24px; height: 24px; font-size: 12px; }
.avatar.lg { width: 60px; height: 60px; font-size: 24px; }
.avatar.xl { width: 72px; height: 72px; font-size: 30px; }
.avatar-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: var(--card);
}

.chip-avatar {
  position: relative;
  display: inline-grid;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}
.chip-avatar::after {
  content: "✎";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--overlay);
  color: var(--on-accent);
  font-size: 11px;
  opacity: 0;
  transition: opacity 0.15s;
}
.chip-avatar:hover::after, .chip-avatar:focus-visible::after { opacity: 1; }

/* Grok Bot avatar shapes; circle is the default. */
.shape-squircle { border-radius: 32%; }
.shape-blob { border-radius: 58% 42% 55% 45% / 45% 55% 45% 55%; }
.shape-pebble { border-radius: 55% 45% 50% 50% / 62% 62% 38% 38%; }
.shape-cloud { border-radius: 45% 55% 40% 60% / 55% 45% 60% 40%; }
.shape-teardrop { border-radius: 50% 0 50% 50%; }

.chip-remove {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}
.chip-remove:hover { background: var(--surface-2); color: var(--text); }
.chip-connect {
  padding: 1px 9px;
  border: 0;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.chip-connect:hover { background: var(--accent); color: var(--on-accent); }
.chip-connect.on { color: var(--success); background: var(--success-bg); }

/* --- Thread --- */
.thread-wrap { position: relative; flex: 1; min-height: 0; display: flex; }
.thread {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  mask-image: linear-gradient(to bottom, transparent 0, #000 18px);
}
.thread > * { width: 100%; max-width: var(--content-w); margin-inline: auto; }
.thread > .note, .thread > .state { width: auto; }

.state {
  margin: auto;
  max-width: 420px;
  padding: 24px;
  text-align: center;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.state strong { color: var(--text); font-weight: 650; font-size: 17px; }
.state.load-error strong { color: var(--danger); }
.state .look-btn, .state .retry { margin-top: 8px; }

.msg { display: flex; flex-direction: column; gap: 8px; }
.msg-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.meta { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; min-width: 0; font-size: 13px; }
.speaker { font-weight: 650; }
.time { color: var(--muted); font-size: 12px; }

.bubble {
  max-width: 100%;
  overflow-wrap: anywhere;
}
/* Agents: wide dark cards with rich text. */
.msg.agent .bubble {
  padding: 16px 18px;
  border-radius: var(--radius);
  background: var(--card);
}
/* Other people: rounded bubbles. */
.msg.person { align-items: flex-start; }
.msg.person .bubble {
  max-width: 85%;
  padding: 10px 16px;
  border-radius: 22px;
  border-top-left-radius: 8px;
  background: var(--surface-2);
}
/* You: lighter bubble on the right. */
.msg.mine { align-items: flex-end; }
.msg.mine .bubble {
  max-width: 85%;
  padding: 10px 16px;
  border-radius: 22px;
  border-bottom-right-radius: 8px;
  background: var(--mine);
}
.msg.mine .meta { padding-right: 6px; }
.msg.error .bubble { background: var(--danger-bg); color: var(--danger-text); white-space: pre-wrap; }
.mine-meta { display: flex; justify-content: flex-end; }

/* Photos: a rounded thumbnail in the card or bubble; tap to open. */
.msg-photo { display: block; width: fit-content; max-width: 100%; border-radius: 16px; overflow: hidden; }
.msg-photo img { display: block; max-width: 100%; max-height: 320px; object-fit: cover; border-radius: 16px; }
.msg-photo + .rich { margin-top: 10px; }
.msg-photo-fallback { display: block; padding: 12px 14px; border-radius: 14px; background: var(--surface-3); color: var(--text); }
.bubble:has(> .msg-photo:only-child) { padding: 6px; }

/* Rich text inside messages */
.rich > * { margin: 0; }
.rich > * + * { margin-top: 10px; }
.rich p { white-space: normal; }
.rich ul, .rich ol { padding-left: 1.3em; }
.rich li + li { margin-top: 4px; }
.rich li::marker { color: var(--muted); }
.rich strong { font-weight: 700; }
.rich a { color: var(--accent-text); text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 1px; }
.rich-h { font-weight: 700; font-size: 17px; }
.rich-h1 { font-size: 20px; }
.rich-code {
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--surface-3);
  font: 0.88em/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.rich-pre {
  padding: 12px 14px;
  border-radius: 14px;
  background: #0e0e10;
  overflow-x: auto;
  font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre;
}
.rich blockquote { padding-left: 12px; border-left: 3px solid var(--surface-3); color: var(--muted); }
.rich hr { border: 0; border-top: 1px solid var(--surface-3); }

/* Link preview cards: cover on top, then a title row. */
.link-cards { display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 560px; }
.msg.mine .link-cards, .msg.person .link-cards { max-width: 420px; }
.link-card { display: block; border-radius: var(--radius); background: var(--card); color: inherit; text-decoration: none; overflow: hidden; }
.link-cover {
  display: block;
  height: 150px;
  background:
    radial-gradient(120% 90% at 85% 10%, hsl(var(--hue) 70% 55% / 0.85), transparent 60%),
    linear-gradient(135deg, hsl(calc(var(--hue) + 40) 45% 22%), hsl(var(--hue) 35% 12%));
}
.link-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px 12px 14px; }
.link-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: hsl(var(--hue) 40% 30%);
  color: #fff;
  font-weight: 700;
}
.link-title { flex: 1; min-width: 0; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-row .icon { flex: none; color: var(--muted); }
.link-card:hover .link-title { text-decoration: underline; }

.synced-tag, .manual-tag {
  font-size: 11px;
  font-weight: 500;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
}

.note {
  align-self: center;
  max-width: 85%;
  padding: 5px 14px;
  border-radius: 999px;
  background: var(--card);
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.status-word { font-size: 12px; color: var(--muted); }
.status-word::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: 1px;
  background: currentColor;
}
.status-typing { color: var(--live); }
.status-error { color: var(--danger); }

.retry {
  align-self: flex-start;
  padding: 8px 18px;
  border: 0;
  border-radius: 999px;
  background: var(--danger-bg);
  color: var(--danger-text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.retry:hover { background: var(--danger-border); }
.retry:disabled { opacity: 0.5; cursor: default; }
.state .retry { align-self: center; }

.typing {
  display: flex;
  align-items: center;
  gap: 12px;
  width: fit-content;
  padding: 6px 4px;
  color: var(--muted);
  font-size: 15px;
}
.thread > .typing { width: fit-content; margin-left: max(0px, calc((100% - var(--content-w)) / 2)); }
.typing-faces { display: flex; }
.typing-faces .avatar + .avatar { margin-left: -8px; box-shadow: 0 0 0 2px var(--bg, #111); }
.typing-text {
  background: linear-gradient(90deg, var(--muted) 0%, var(--muted) 40%, #d0d0d0 50%, var(--muted) 60%, var(--muted) 100%);
  background-size: 250% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: working-shimmer 2.2s linear infinite;
}
@keyframes working-shimmer { from { background-position: 100% 0; } to { background-position: -150% 0; } }

/* Floating "jump to latest" chevron */
.scroll-down {
  position: absolute;
  left: 50%;
  bottom: 14px;
  z-index: 4;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: 0 8px 22px var(--shadow);
  transform: translateX(-50%);
  cursor: pointer;
  animation: rise 0.18s ease-out;
}
.scroll-down:hover { background: var(--accent-hover); }
@keyframes rise { from { opacity: 0; transform: translate(-50%, 8px); } }

/* --- Composer pill --- */
.composer { padding: 6px 16px 14px; }
.composer-pill {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  max-width: var(--content-w);
  min-height: 54px;
  margin: 0 auto;
  padding: 5px 6px;
  border-radius: 28px;
  background: var(--card);
}
.composer-pill:focus-within { box-shadow: inset 0 0 0 1px var(--border-strong); }
.composer textarea {
  flex: 1;
  min-width: 0;
  resize: none;
  padding: 10px 6px;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  line-height: 24px;
  min-height: 44px;
  max-height: 200px;
  overflow-y: hidden;
  outline: none;
}
.composer textarea::placeholder { color: var(--muted); opacity: 1; }
.composer-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}
.composer-icon:hover { background: var(--surface-2); }
#mic-btn.recording { color: #fff; background: #d93025; animation: mic-pulse 1.2s ease-in-out infinite; }
#mic-btn.recording:hover { background: #c5221f; }
@keyframes mic-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(217, 48, 37, 0.45); } 50% { box-shadow: 0 0 0 8px rgba(217, 48, 37, 0); } }
.voice-note { margin: 4px 14px 0; font-size: 13px; color: var(--muted); }

/* --- Bottom navigation --- */


@media (prefers-reduced-motion: reduce) {
  .typing-text { animation: none; background: none; color: var(--muted); }
  .scroll-down, .chip.speaking .avatar { animation: none; }
  #mic-btn.recording { animation: none; }
}

/* --- Dialogs --- */
.picker {
  width: min(520px, calc(100vw - 24px));
  max-height: min(680px, calc(100dvh - 48px));
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 26px;
  background: var(--card);
  box-shadow: 0 24px 60px var(--shadow);
  color: var(--text);
}
.picker[open] { display: flex; flex-direction: column; }
.picker::backdrop { background: var(--backdrop); }
.picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 18px 10px 22px;
}
.picker-head h2 { margin: 0; font-size: 19px; font-weight: 700; }
.picker-close {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: var(--surface-2);
  font-size: 22px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
}
.picker-close:hover { color: var(--text); background: var(--surface-3); }
.picker-body { padding: 4px 14px 18px; overflow-y: auto; }
.picker-section h3 {
  margin: 12px 8px 6px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.picker-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px;
  border: 0;
  border-radius: 18px;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.picker-row:hover:not(:disabled) { background: var(--surface-2); }
.picker-row:disabled { cursor: default; }
.picker-text { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.picker-name { font-weight: 650; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.picker-desc { color: var(--muted); font-size: 14px; }
.picker-note { font-size: 13px; color: var(--warning-text); }
.picker-action {
  flex: none;
  padding: 6px 16px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 14px;
  font-weight: 600;
}
.picker-row.added .picker-action { background: var(--success-bg); color: var(--success); }

.connect { width: min(600px, calc(100vw - 24px)); }
.connect-body { display: flex; flex-direction: column; gap: 12px; padding: 8px 22px 22px; }
.connect-body p { margin: 0; }
.connect-intro { line-height: 1.55; }
.connect-status {
  padding: 10px 14px;
  border-radius: 14px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 14px;
}
.connect-status.on { background: var(--success-bg); color: var(--success); }
.connect-warn { font-size: 13px; color: var(--warning-text); }
.connect-muted { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.connect-key {
  align-self: flex-start;
  padding: 9px 18px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.connect-key:hover { background: var(--accent-hover); }
.connect-key:disabled { opacity: 0.6; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field-label { font-size: 13px; font-weight: 600; }
.field-row { display: flex; gap: 8px; align-items: flex-start; }
.field-value {
  flex: 1;
  min-width: 0;
  margin: 0;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #0e0e10;
  font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  overflow-x: auto;
  white-space: pre;
}
.field-value.secret { background: var(--warning-bg); border-color: var(--warning-line); }
.copy {
  flex: none;
  padding: 8px 14px;
  border: 0;
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.copy:hover { background: var(--surface-3); }

.look { width: min(520px, calc(100vw - 24px)); }
.look-body { display: flex; flex-direction: column; gap: 6px; padding: 4px 22px 22px; }
.look-body p { margin: 0; }
.look-section { display: flex; flex-direction: column; gap: 10px; padding: 10px 0 14px; border-bottom: 1px solid var(--border); }
.look-section:last-child { border-bottom: 0; }
.look-section h3 {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.look-error {
  padding: 10px 14px;
  border: 1px solid var(--danger-border);
  border-radius: 14px;
  background: var(--danger-bg);
  color: var(--danger-text);
  font-size: 14px;
}
.look-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.look-btn {
  padding: 9px 16px;
  border: 0;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.look-btn:hover { background: var(--surface-3); }
.look-btn.primary { background: var(--accent); color: var(--on-accent); }
.look-btn.primary:hover { background: var(--accent-hover); }
.look-btn:disabled { opacity: 0.6; cursor: default; }
.look-btn.signout { color: var(--danger-text); }
.look-link {
  align-self: flex-start;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent-text);
  font-size: 13px;
  cursor: pointer;
}
.look-link:hover { text-decoration: underline; }
.logo-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.logo-preview {
  display: grid;
  place-items: center;
  width: 140px;
  height: 64px;
  padding: 8px;
  border: 1px dashed var(--border-strong);
  border-radius: 14px;
  background: #0e0e10;
}
.logo-preview img { display: block; max-width: 124px; max-height: 48px; object-fit: contain; }
.name-form { display: flex; gap: 8px; }
.name-form input, .auth-form input:not([type=checkbox]), .create-form input, .invite-days {
  flex: 1;
  min-width: 0;
  padding: 11px 14px;
  border: 1px solid var(--field-border);
  border-radius: 14px;
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
}
.name-form input::placeholder, .create-form input::placeholder, .auth-form input::placeholder { color: var(--muted); opacity: 1; }
.name-form input:focus, .auth-form input:focus, .create-form input:focus, .invite-days:focus {
  outline: 2px solid var(--accent-text);
  outline-offset: -1px;
}
.avatar-editor { display: flex; align-items: center; gap: 14px; }
.avatar-editor-side { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.avatar-editor-name { font-weight: 650; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* --- Sign in, create account, invites --- */
.auth { display: grid; place-items: center; min-height: 100dvh; padding: 24px 16px; }
.auth-card {
  width: min(420px, 100%);
  padding: 28px 26px 24px;
  border-radius: 28px;
  background: var(--card);
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.auth-card > div:last-child { display: flex; flex-direction: column; gap: 14px; }
.auth-brand { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 700; }
.auth-title { margin: 0; font-size: 26px; font-weight: 750; letter-spacing: -0.01em; }
.auth-intro { margin: 0; color: var(--muted); }
.auth-form { display: flex; flex-direction: column; gap: 6px; }
.form-label { margin-top: 6px; font-size: 14px; font-weight: 600; }
.form-hint { margin: 0; font-size: 13px; color: var(--muted); }
.show-pass { display: flex; align-items: center; gap: 6px; margin-top: 4px; font-size: 14px; color: var(--muted); cursor: pointer; }
.show-pass input { accent-color: var(--accent); }
.auth-form .look-error { margin: 6px 0 0; }
.auth-submit, .auth-secondary {
  margin-top: 10px;
  padding: 14px 16px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 650;
  cursor: pointer;
}
.auth-submit:hover { background: var(--accent-hover); }
.auth-submit:disabled { opacity: 0.6; cursor: default; }
.auth-secondary { margin-top: 0; background: var(--surface-2); color: var(--text); }
.auth-secondary:hover { background: var(--surface-3); }
.auth-switch { margin: 0; font-size: 14px; color: var(--muted); text-align: center; }
.link-btn { padding: 0; border: 0; background: none; color: var(--accent-text); font-weight: 600; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.invite-box {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 16px;
  border-radius: 18px;
  background: var(--accent-soft);
}
.invite-from { font-size: 13px; color: var(--accent-text); }
.invite-title { font-size: 17px; overflow-wrap: anywhere; }

/* --- People dialog --- */
.member { display: flex; align-items: center; gap: 12px; }
.member-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.member-name { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-weight: 650; }
.member-agents { font-size: 13px; color: var(--muted); }
.invite-row { display: flex; gap: 8px; flex-wrap: wrap; }
.invite-days { min-width: 180px; padding: 9px 12px; }
.invite-list { display: flex; flex-direction: column; gap: 6px; }
.invite-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 16px; background: var(--surface-2); }
.invite-meta { flex: 1; min-width: 0; font-size: 13px; color: var(--muted); }

/* --- Create your own agent (Add Agent dialog) --- */
.create-agent { padding: 0 8px; }
.create-agent h3 { margin-inline: 0; }
.create-hint, .picker-intro { margin: 0 0 8px; font-size: 13px; color: var(--muted); }
.picker-intro { margin: 12px 8px 4px; font-size: 14px; }
.create-form { display: flex; flex-direction: column; gap: 8px; }
.create-form .look-btn { align-self: flex-start; }
.create-agent .look-error { margin: 0 0 8px; }
.form-label + .name-form { margin-top: -2px; }

/* --- Phones: one screen at a time --- */
/* On a computer the list is always beside the conversation. */
@media (min-width: 721px) {
  #menu-btn { visibility: hidden; }
}

@media (max-width: 720px) {
  .shell { height: 100dvh; }
  .sidebar { width: 100%; border-right: 0; background: var(--bg); }
  .shell.has-conv .sidebar { display: none; }
  .shell.has-conv.drawer-open .sidebar {
    display: flex;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 30;
    width: min(86vw, 340px);
    border-right: 1px solid var(--border);
    background: var(--sidebar);
  }
  .shell.has-conv.drawer-open .drawer-backdrop { display: block; position: fixed; inset: 0; z-index: 29; background: var(--backdrop); }
  .shell:not(.has-conv) .app { display: none; }
  .app, .sidebar { padding-bottom: env(safe-area-inset-bottom); }
  .topbar { padding: 10px 14px 6px; gap: 8px; }
  .thread { padding: 10px 14px 20px; gap: 18px; }
  .msg.agent .bubble { padding: 15px 16px; }
  .composer { padding: 4px 12px 8px; }
  .composer textarea, .auth-form input, .name-form input, .create-form input { font-size: 16px; }
  .picker-row { padding: 10px 6px; }
  .picker {
    width: 100vw;
    max-width: 100vw;
    max-height: 88dvh;
    margin: auto 0 0;
    border-radius: 28px 28px 0 0;
    border-bottom: 0;
    padding-bottom: env(safe-area-inset-bottom);
  }
}

/* 1019-delagent */
.look-btn.danger-btn { background: var(--danger-bg); color: var(--danger-text); border-color: var(--danger-border); align-self: flex-start; }
.look-btn.danger-btn:hover { background: var(--danger-border); }

/* 1019-pickdel */
.picker-row-wrap { display: flex; align-items: center; gap: 6px; }
.picker-row-wrap .picker-row { flex: 1; min-width: 0; }
.picker-del { flex: none; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--danger-border); background: var(--danger-bg); color: var(--danger-text); font: inherit; font-size: 14px; cursor: pointer; }
.picker-del:hover { background: var(--danger-border); }
.picker-del:disabled { opacity: .6; cursor: default; }

/* 1019-trash */
.trash-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.trash-btn:not(.armed) { padding: 6px 9px; }
.trash-btn svg { display: block; }

/* 1019-convtrash */
.conv-row { display: flex; align-items: center; gap: 4px; }
.conv-row .conv-item { flex: 1; min-width: 0; }
.conv-del { flex: none; border: 1px solid var(--danger-border); background: var(--danger-bg); color: var(--danger-text); border-radius: 999px; font: inherit; font-size: 13px; cursor: pointer; }
.conv-del:not(.armed) { padding: 5px 7px; background: transparent; border-color: transparent; color: var(--muted); }
.conv-del:not(.armed):hover { color: var(--danger-text); }
.conv-del.armed { padding: 5px 10px; }
.conv-del svg { width: 16px; height: 16px; }

/* 1019-swipe */
.conv-row { position: relative; overflow: hidden; border-radius: 14px; display: block; }
.conv-row .conv-item { position: relative; z-index: 1; display: flex; touch-action: pan-y; transition: transform .2s ease; background: var(--sidebar, var(--bg)); }
.conv-row .conv-item.active { background: var(--surface-2); }
.conv-swipe-del { position: absolute; top: 0; right: 0; bottom: 0; width: 84px; z-index: 0; border: 0; background: #d93025; color: #fff; font: inherit; font-weight: 600; cursor: pointer; }
.conv-swipe-del:disabled { opacity: .6; }
.conv-row:not(.open) .conv-swipe-del { visibility: hidden; }
.conv-row.open .conv-swipe-del, .conv-row:has(.conv-item[style*="translateX"]) .conv-swipe-del { visibility: visible; }
