/* Vibes: one stylesheet, phone first, RTL-safe by construction (logical
   properties only), safe-area aware, a sidebar that is a drawer on phones.
   Mono: black, white and greys; --bad is a hue for errors and destructive
   actions, and --read the blue of two read ticks, nothing else. The rules
   behind it are in constitution.md. */
:root {
  --bg: #000000; --panel: #0e0e0e; --panel-2: #1b1b1b; --line: #2a2a2a; --text: #f4f4f4; --muted: #8c8c8c; --bad: #ff5f57;
  --accent: var(--text); --accent-ink: var(--bg);
  /* read ticks sit on the ink of your own bubble: a deep blue on light ink, a light blue on dark */
  --read: #1d7fe0;
  --radius: 8px; --tabbar: 0px; --sidebar: 260px; --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px);
  --font: "Outfit", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root { --bg: #ffffff; --panel: #ffffff; --panel-2: #f2f2f2; --line: #e4e4e4; --text: #0a0a0a; --muted: #6e6e6e; --bad: #d92d20; --read: #53bdeb; color-scheme: light; }
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font: 300 15px/1.5 var(--font); -webkit-text-size-adjust: 100%; -webkit-font-smoothing: antialiased; }
body { min-height: 100dvh; }
a { color: inherit; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; border-radius: 6px; }

/* controls. A submit is the one filled button; every other action is an
   icon and a label styled as a link (action() in dom.js). */
button { cursor: pointer; font: inherit; font-weight: 500; color: var(--muted); background: none; border: 0; border-radius: var(--radius); padding: 4px 2px; min-height: 34px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
button:hover { color: var(--text); }
button.primary { background: var(--accent); color: var(--accent-ink); padding: 0 16px; min-height: 36px; font-weight: 500; }
button.primary:hover { color: var(--accent-ink); opacity: .86; }
.row > button.primary { flex: none; white-space: nowrap; }
button.danger { color: var(--bad); }
button:disabled { opacity: .45; cursor: default; }
.act { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 4px 2px; color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 500; white-space: nowrap; }
.act:hover { color: var(--text); }
.act:hover > span { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.act.danger, .act.danger:hover { color: var(--bad); }
.act.icon-only { width: 32px; padding: 0; justify-content: center; }
.icon { flex: none; display: block; }
.actions { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-block-start: 16px; }
.row-acts { display: flex; align-items: center; gap: 2px; flex: none; }

input, select, textarea { font: inherit; color: inherit; background: transparent; border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 11px; width: 100%; min-height: 38px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: color-mix(in srgb, var(--text) 35%, var(--line)); }
input:disabled { color: var(--muted); border-style: dashed; }
input[type="checkbox"] { width: auto; min-height: 0; accent-color: var(--text); }
textarea { min-height: 80px; resize: vertical; }
/* iOS zooms the page into any field under 16px when it takes focus, and the
   zoom pushes the chrome off screen; on touch screens fields are 16px */
@media (pointer: coarse) { input, select, textarea { font-size: 16px; } }
label { display: block; font-size: 13px; color: var(--muted); margin-block: 14px 6px; }
h1, h2, h3 { margin: 0 0 8px; line-height: 1.25; letter-spacing: -0.01em; font-weight: 500; }
h1 { font-size: 22px; } h2 { font-size: 17px; } h3 { font-size: 15px; margin-block-end: 12px; }
p { margin-block: 0 10px; }
.muted { color: var(--muted); } .small { font-size: 13px; } .center { text-align: center; } .row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; } .grow { flex: 1; } .hidden { display: none !important; }
/* small type stays legible: the body is 300, meta text 400 */
.small, label, th, .msg .who, .req .st, .badge, .tb-head .sub { font-weight: 400; }
.page { padding: calc(12px + var(--sat)) 16px calc(var(--tabbar) + var(--sab) + 16px); max-width: 720px; margin-inline: auto; }
.page.no-tabs { padding-block-end: calc(16px + var(--sab)); }
.page.narrow { max-width: 520px; }
/* sections, not cards: a heading and its content, a hairline between them */
.section { padding-block: 20px; border-block-start: 1px solid var(--line); }
.section:first-child { border-block-start: 0; padding-block-start: 8px; }
.section > p:last-child { margin-block-end: 0; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; min-height: 28px; border-radius: 999px; border: 1px solid var(--line); font-size: 13px; color: var(--text); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.err { color: var(--bad); font-size: 14px; margin-block: 8px; } .err:empty { display: none; } .ok { color: var(--text); }
.bad { color: var(--bad); }
.toast { position: fixed; inset-inline: 16px; inset-block-end: calc(var(--tabbar) + var(--sab) + 12px); background: var(--text); color: var(--bg); padding: 10px 14px; border-radius: 10px; z-index: 70; font-size: 14px; }
.toast button { color: inherit; text-decoration: underline; }

/* top bar: translucent, the page blurred behind it; the space as an
   avatar, its name and a line under it; the page's actions as icons in
   one translucent pill at the end */
.topbar { position: sticky; inset-block-start: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 62%, transparent); -webkit-backdrop-filter: saturate(180%) blur(18px); backdrop-filter: saturate(180%) blur(18px); padding: calc(8px + var(--sat)) 12px 8px; min-height: calc(60px + var(--sat)); display: flex; align-items: center; gap: 10px; }
.topbar .title { font-weight: 600; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar > .title { flex: 1; }
.topbar .title .wordmark { height: 20px; }
.tb-avatar { width: 40px; height: 40px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--panel-2); font-size: 20px; text-decoration: none; overflow: hidden; }
.tb-head { flex: 1; min-width: 0; line-height: 1.3; }
.tb-head .sub { display: block; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-head .sub:empty { display: none; }
.tb-actions { display: flex; align-items: center; gap: 2px; flex: none; padding: 3px; border-radius: 999px; background: color-mix(in srgb, var(--panel) 70%, transparent); border: 1px solid color-mix(in srgb, var(--line) 80%, transparent); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.tb-actions:not(:has(> :not(.hidden))) { display: none; }
.tb-actions .act { width: 32px; height: 32px; min-height: 32px; border-radius: 50%; color: var(--text); }
.tb-actions .act:hover { background: var(--panel-2); }
.tb-back { color: var(--text); }
/* in a space the name is a button with a chevron: it shows the page bar,
   every page of the space in one row under the header, hidden until asked
   for */
.topbar.tb-space { flex-wrap: wrap; align-content: center; row-gap: 6px; }
button.tb-switch { display: block; max-width: 100%; min-height: 0; padding: 0; text-align: start; color: var(--text); font-weight: 400; }
.tb-name { display: flex; align-items: center; min-width: 0; }
.tb-name .title { min-width: 0; }
.tb-switch .caret { margin-inline: 8px 0; }
.tb-switch:hover .caret { border-color: var(--text); }
.tb-switch[aria-expanded="true"] .caret { transform: translateY(1px) rotate(-135deg); }
.tb-pages { flex: 0 0 100%; display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain; }
.tb-pages::-webkit-scrollbar { display: none; }
.tb-page { flex: none; display: inline-flex; align-items: center; gap: 8px; min-height: 34px; padding: 6px 12px; border-radius: 999px; color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 500; white-space: nowrap; }
.tb-page .ico { width: 18px; display: grid; place-items: center; flex: none; }
.tb-page:hover { color: var(--text); }
.tb-page.on { background: var(--panel-2); color: var(--text); font-weight: 600; }
/* the brand */
.wordmark { display: block; height: 22px; width: auto; color: var(--text); }
/* the loading screen of / and a space (boot.js): the wordmark alone, centred.
   It fades in 0.4s after the navigation began, so a quick load never flashes
   it, then breathes like Vibes' "Thinking…" line; --boot-at keeps its clock
   from / on to the space. */
.boot { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: var(--bg); transition: opacity .24s ease; }
.boot.out { opacity: 0; pointer-events: none; }
.boot .wordmark { height: 32px; animation: boot-in .7s cubic-bezier(.2, .7, .2, 1) calc(var(--boot-at, 0ms) + .4s) both, working 2.4s ease-in-out calc(var(--boot-at, 0ms) + 1.1s) infinite; }
@keyframes boot-in { from { opacity: 0; transform: scale(.96); } }
@keyframes boot-fade { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .boot .wordmark { animation: boot-fade .7s ease-out calc(var(--boot-at, 0ms) + .4s) both; } }
/* sidebar: every space as a collapsible group, the account pinned below a
   divider. A drawer on phones, a rail from 900px. */
.sidebar { position: fixed; inset-block: 0; inset-inline-start: 0; width: min(var(--sidebar), 86vw); z-index: 45; display: flex; flex-direction: column; background: var(--panel); border-inline-end: 1px solid var(--line); padding-block-start: var(--sat); transform: translateX(-100%); visibility: hidden; transition: transform .2s ease, visibility 0s linear .2s; }
[dir="rtl"] .sidebar { transform: translateX(100%); }
body.sb-open .sidebar { transform: none; visibility: visible; transition: transform .2s ease, visibility 0s; }
.sb-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 44; display: none; }
body.sb-open .sb-backdrop { display: block; }
.sb-menu { color: var(--text); }
.sb-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 10px 14px; }
/* the header: the wordmark, and the round + (create or join) */
.sb-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 60px; padding: 8px 12px 8px 20px; }
.sb-brand { display: inline-flex; color: var(--text); text-decoration: none; }
.sb-brand .wordmark { height: 22px; }
.sb-add { width: 28px; height: 28px; min-height: 28px; padding: 0; flex: none; border-radius: 50%; color: var(--muted); }
.sb-add:hover { color: var(--text); background: var(--panel-2); }
.sb-label { font-size: 13px; color: var(--muted); padding: 4px 10px 6px; }
/* search: a field under the header, a magnifier at its start and, while it
   holds text, an x at its end; from two letters the list below is the
   messages that match, across your spaces */
.sb-find { position: relative; padding: 0 10px 8px; }
.sb-find input { -webkit-appearance: none; appearance: none; padding-inline: 34px 38px; }
.sb-find input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.sb-find-ico { position: absolute; inset-inline-start: 21px; inset-block-start: 11px; display: flex; color: var(--muted); pointer-events: none; }
.sb-find-clear { position: absolute; inset-inline-end: 13px; inset-block-start: 3px; }
.sb-note { font-size: 13px; color: var(--muted); padding: 4px 10px; margin: 0; }
.sb-hits { display: flex; flex-direction: column; gap: 1px; }
.sb-hit { display: flex; align-items: flex-start; gap: 10px; padding: 8px 10px; border-radius: var(--radius); text-decoration: none; color: var(--text); font-size: 14px; }
.sb-hit:hover { background: var(--panel-2); }
.sb-hit .sb-emoji { line-height: 20px; }
.sb-hit-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.sb-hit-head { display: flex; align-items: baseline; gap: 8px; font-weight: 500; }
.sb-hit-space { flex: 1; min-width: 0; }
.sb-hit-when { flex: none; font-size: 13px; font-weight: 400; color: var(--muted); }
.sb-hit-text { font-size: 13px; color: var(--muted); display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; }
.sb-hit mark { background: none; color: var(--text); font-weight: 600; }
.sb-group { width: 100%; justify-content: flex-start; gap: 10px; color: var(--text); border-radius: var(--radius); padding: 6px 10px; min-height: 36px; text-align: start; font-size: 14px; }
.sb-group:hover, .sb-item:hover, .sb-user:hover { background: var(--panel-2); }
.sb-group.cur .sb-name { font-weight: 600; }
.sb-emoji { width: 20px; text-align: center; flex: none; }
.sb-emoji .space-pic { width: 20px; height: 20px; }
.sb-name { flex: 1; min-width: 0; }
/* a chevron: down when open, right when closed */
.caret { flex: none; width: 6px; height: 6px; margin-inline: 4px 6px; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: translateY(-2px) rotate(45deg); transition: transform .15s ease; }
[aria-expanded="false"] > .caret { transform: rotate(-45deg); }
.sb-items { display: flex; flex-direction: column; gap: 1px; padding-block: 2px 8px; padding-inline-start: 20px; }
.sb-item { display: flex; align-items: center; justify-content: flex-start; gap: 10px; width: 100%; min-height: 34px; padding: 6px 10px; border-radius: var(--radius); text-decoration: none; font-size: 14px; color: var(--muted); }
.sb-item .ico { width: 18px; display: grid; place-items: center; flex: none; }
.sb-item:hover { color: var(--text); }
.sb-item.on { background: var(--panel-2); color: var(--text); font-weight: 600; }
.sb-foot { display: flex; align-items: center; gap: 4px; border-block-start: 1px solid var(--line); padding: 8px 10px calc(8px + var(--sab)); }
.sb-user { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: var(--radius); text-decoration: none; font-size: 14px; }
.sb-gear { color: var(--muted); }

@media (min-width: 900px) {
  .sidebar { width: var(--sidebar); transform: none !important; visibility: visible !important; transition: none; }
  .sb-backdrop, .sb-menu { display: none !important; }
  /* Only pages that mount a sidebar make room for the rail; standalone pages (login, account, admin, owner) stay centered. */
  .page { padding-block-end: 24px; }
  body:has(.sidebar) .page { margin-inline-start: var(--sidebar); max-width: none; }
  .page .inner { max-width: 720px; margin-inline: auto; }
  body:has(.sidebar) .topbar { margin-inline-start: var(--sidebar); }
  body:has(.sidebar) .topbar .title .wordmark { display: none; }
  body:has(.sidebar) .toast { inset-inline-start: calc(var(--sidebar) + 16px); inset-inline-end: auto; inset-block-end: 16px; }
  /* sheets centre over the content, not under the rail */
  body:has(.sidebar) .backdrop { inset-inline-start: var(--sidebar); }
}

/* chat widgets: slim bars pinned under the top bar, content on a tap */
.widgets { position: sticky; inset-block-start: var(--topbar-h, 60px); z-index: 15; display: flex; flex-direction: column; padding-block: 4px; margin-block-start: -6px; background: var(--bg); border-block-end: 1px solid var(--line); }
.w-bar { overflow: hidden; }
.w-bar + .w-bar { border-block-start: 1px solid var(--line); }
.w-head { width: 100%; justify-content: flex-start; gap: 10px; min-height: 38px; padding: 6px 2px; border-radius: 0; color: var(--text); font-size: 14px; font-weight: 600; text-align: start; }
.w-head .ico { font-size: 16px; }
.w-body { padding: 2px 0 12px; max-height: 55dvh; overflow-y: auto; }
.note-line { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 0; border-block-end: 1px solid var(--line); font-size: 13px; color: var(--muted); }

/* chat */
.thread { display: flex; flex-direction: column; gap: 8px; padding-block: 10px; }
.msg { max-width: 86%; padding: 8px 12px; border-radius: 16px; background: var(--panel-2); align-self: flex-start; white-space: pre-wrap; word-break: break-word; }
.msg.me { align-self: flex-end; background: var(--accent); color: var(--accent-ink); }
.msg.assistant { background: transparent; border: 1px solid var(--line); }
.msg .who { font-size: 12px; color: var(--muted); margin-block-end: 2px; }
.msg .who .name { font-weight: 600; color: var(--text); }
.msg .working { font-size: 13px; color: var(--muted); animation: working 1.6s ease-in-out infinite; }
.msg .text:not([hidden]) + .working { margin-block-start: 4px; }
.msg .err { margin-block: 0; font-size: inherit; }
@keyframes working { 50% { opacity: .4; } }
/* links in chat text and an answer's sources (spec 003): ink, underlined, never blue; they ask before opening */
a.link { color: inherit; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; overflow-wrap: anywhere; cursor: pointer; }
a.link:hover { text-decoration-thickness: 2px; }
.msg .sources { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; margin-block-start: 6px; font-size: 13px; font-weight: 400; white-space: normal; }
.msg .sources-label { color: var(--muted); }
.msg .sources a.link { color: var(--text); }
@media (prefers-reduced-motion: reduce) { .msg .working { animation: none; } }
/* a message with its sender: avatar then bubble; yours on the right, bare.
   The bubble and its reactions stack in .msg-body; the smiley and the
   reaction bar hang off the row */
.msg-row { display: flex; gap: 8px; align-items: flex-start; max-width: 86%; align-self: flex-start; position: relative; }
.msg-row.me { align-self: flex-end; }
.msg-body { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; max-width: 100%; }
.msg-row.me .msg-body { align-items: flex-end; }
.msg-row .msg { max-width: 100%; min-width: 0; }
/* your message's time and ticks at its end, as in WhatsApp: on the text's
   last line when there is room, else under it; under the files when there
   are files. A clock on the way, one tick saved, two delivered, two in
   --read read, "Not sent" in --bad */
.msg.me .text { display: flow-root; }
.stamp { float: inline-end; display: inline-flex; align-items: center; gap: 3px; margin-block: 6px -4px; margin-inline-start: 10px; font-size: 12px; line-height: 16px; font-weight: 400; white-space: nowrap; color: color-mix(in srgb, var(--accent-ink) 60%, transparent); }
.msg > .stamp { float: none; display: flex; justify-content: flex-end; margin-block: 4px 0; }
.tick { display: inline-flex; }
.tick.read { color: var(--read); }
.tick.failed { color: color-mix(in srgb, var(--bad) 75%, var(--accent-ink)); }
/* reactions: the smiley beside the bubble (hover, keyboard focus, or a tap
   on the bubble), the bar it opens, the pill under the bubble */
.react-btn { position: absolute; inset-block-start: 50%; inset-inline-start: 100%; width: 34px; height: 30px; min-height: 30px; margin-block-start: -15px; padding: 0; opacity: 0; pointer-events: none; transition: opacity .12s ease; }
.msg-row.me .react-btn { inset-inline-start: auto; inset-inline-end: 100%; }
.msg-row:focus-within > .react-btn, .msg-row.active > .react-btn, .msg-row.reacting > .react-btn { opacity: 1; pointer-events: auto; }
@media (hover: hover) { .msg-row:hover > .react-btn { opacity: 1; pointer-events: auto; } }
.react-bar { position: absolute; z-index: 30; inset-block-end: calc(100% + 4px); inset-inline-start: 38px; display: flex; flex-direction: column; gap: 4px; padding: 3px; background: var(--panel); border: 1px solid var(--line); border-radius: 22px; }
.react-bar.end { inset-inline-start: auto; inset-inline-end: 0; }
.react-bar.below { inset-block-end: auto; inset-block-start: calc(100% + 4px); }
.react-bar.wide { width: min(320px, calc(100vw - 32px)); border-radius: var(--radius); }
.react-quick { display: flex; align-items: center; gap: 2px; }
.react-bar.wide .react-quick { justify-content: space-between; }
.react-opt { width: 38px; height: 36px; min-height: 36px; padding: 0; border-radius: 50%; font-size: 22px; font-weight: 400; color: var(--text); }
.react-opt:hover, .react-opt.on { background: var(--panel-2); }
.react-more { width: 34px; height: 34px; min-height: 34px; border-radius: 50%; }
.react-all { padding: 0 6px 4px; }
.reacts { align-self: flex-start; position: relative; z-index: 1; height: 24px; min-height: 24px; margin-block-start: -6px; margin-inline: 10px; padding: 0 7px; gap: 3px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); color: var(--text); font-size: 13px; font-weight: 400; line-height: 1; }
.reacts:hover { color: var(--text); border-color: color-mix(in srgb, var(--text) 35%, var(--line)); }
.reacts.mine { border-color: color-mix(in srgb, var(--text) 45%, var(--line)); }
.reacts-emoji { font-size: 14px; letter-spacing: 1px; }
.reacts-n { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.reactors .react-emoji { font-size: 20px; line-height: 1; }
.msg-row.cont { margin-block-start: -5px; }
.msg-row.cont .avatar { visibility: hidden; height: 0; }
.avatar { width: 30px; height: 30px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--panel-2); color: var(--text); font-size: 12px; font-weight: 600; letter-spacing: .02em; user-select: none; overflow: hidden; object-fit: cover; }
.avatar.lg { width: 64px; height: 64px; font-size: 22px; }
.avatar.emoji { background: transparent; border: 1px solid var(--line); font-size: 15px; }
.msg.system { align-self: center; max-width: 100%; background: transparent; color: var(--muted); font-size: 12px; padding: 2px 8px; border: 0; }
/* the composer: attach, a field that grows to six lines and then scrolls,
   send; above them, the files on their way up. On a phone it reaches the
   bottom edge and its own padding clears the home indicator, room it gives
   back while the keyboard is up. The thread keeps clear of its height
   (--composer-h, set by chat.js). */
.composer { position: fixed; inset-inline: 0; inset-block-end: var(--tabbar); background: color-mix(in srgb, var(--bg) 80%, transparent); -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px); border-block-start: 1px solid var(--line); padding: 8px 12px calc(8px + var(--sab)); display: flex; flex-direction: column; gap: 8px; z-index: 25; }
body.kb-open .composer { padding-block-end: 8px; }
.composer-row { display: flex; gap: 8px; align-items: flex-end; }
.composer textarea { display: block; height: 36px; min-height: 36px; max-height: 138px; line-height: 20px; border-radius: 18px; padding: 7px 14px; resize: none; overflow-y: auto; }
/* the @ menu: who you can mention, Vibes first, in a panel over the
   composer bordered like an input */
.mention-menu { position: absolute; inset-inline-start: 12px; inset-block-end: calc(100% + 6px); width: min(320px, calc(100% - 24px)); max-height: 264px; overflow-y: auto; overscroll-behavior: contain; padding: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.mention-opt { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 5px 8px; border-radius: 6px; font-size: 14px; cursor: pointer; }
.mention-opt:hover, .mention-opt.on { background: var(--panel-2); }
.mention-opt .avatar { width: 28px; height: 28px; }
.mention-opt .grow { min-width: 0; }
.mention-opt .hint { flex: none; max-width: 55%; font-size: 13px; color: var(--muted); }
/* a message opened from search: a ring that fades */
.msg.found { animation: found 2.6s ease-out; }
@keyframes found { 0%, 45% { outline: 2px solid var(--text); outline-offset: 3px; } 100% { outline: 2px solid transparent; outline-offset: 3px; } }
.composer button.primary { width: 30px; height: 30px; min-height: 30px; margin-block-end: 3px; padding: 0; border-radius: 50%; flex: none; }
.composer .attach { width: 30px; height: 30px; min-height: 30px; margin-block-end: 3px; flex: none; }
@media (min-width: 900px) { .composer { inset-inline-start: var(--sidebar); inset-block-end: 0; } }
.page.chat { padding-block-end: calc(var(--tabbar) + var(--composer-h, 55px) + 24px); }
@media (min-width: 900px) { .page.chat { padding-block-end: calc(var(--composer-h, 55px) + 34px); } }
/* a file on its way up: a thumbnail or the file icon, its name, its state */
.tray { display: flex; gap: 8px; overflow-x: auto; }
.att-chip { flex: none; display: flex; align-items: center; gap: 8px; max-width: 220px; height: 52px; padding-inline: 6px 2px; border: 1px solid var(--line); border-radius: var(--radius); font-size: 13px; }
.att-chip img, .att-chip .ico { width: 38px; height: 38px; flex: none; border-radius: 6px; object-fit: cover; }
.att-chip .ico { display: grid; place-items: center; background: var(--panel-2); color: var(--muted); }
.att-chip .meta { min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.att-chip .st { font-size: 12px; color: var(--muted); }
.att-chip.failed .st { color: var(--bad); }
/* files on a message: a photo opens full size, any other file is a row */
.atts { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.msg .text + .atts, .msg .who + .atts { margin-block-start: 6px; }
.att-img { display: block; }
.att-img img { display: block; max-width: min(260px, 100%); max-height: 320px; width: auto; height: auto; border-radius: 10px; }
.att-file { display: flex; align-items: center; gap: 8px; max-width: min(280px, 100%); padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; color: inherit; text-decoration: none; font-size: 14px; white-space: nowrap; }
.att-file .grow { min-width: 0; }
.att-file:hover .grow { text-decoration: underline; text-underline-offset: 3px; }
.att-size { flex: none; font-size: 12px; color: var(--muted); }
.msg.me .att-file { border-color: color-mix(in srgb, var(--accent-ink) 25%, transparent); }
.msg.me .att-size { color: color-mix(in srgb, var(--accent-ink) 60%, transparent); }

/* the card under an answer */
.ccard { margin-block-start: 8px; border-block-start: 1px solid var(--line); }
.msg.me .ccard { border-color: color-mix(in srgb, var(--accent-ink) 25%, transparent); }
.msg.me .act { color: inherit; opacity: .7; }
.msg.me .act:hover { opacity: 1; }
.ccard .item { display: flex; gap: 8px; align-items: center; padding: 8px 0; border-block-end: 1px solid var(--line); font-size: 14px; }
.ccard .item:last-child { border-block-end: 0; }
.ccard .item .sum { flex: 1; min-width: 0; }
.ccard .item .st { font-size: 12px; color: var(--muted); }
.ccard .item .st.failed { color: var(--bad); }

/* tables */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: start; padding: 8px 6px; border-block-end: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 500; font-size: 12px; }
td.num, th.num { text-align: end; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* sheet: the one raised surface */
.backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--panel); border: 1px solid var(--line); border-block-end: 0; width: 100%; max-width: 520px; border-radius: 16px 16px 0 0; padding: 18px 18px calc(18px + var(--sab)); max-height: 88dvh; overflow: auto; }
.sheet > h2:first-child, .sheet .sheet-head h2 { margin-block-end: 4px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-block-end: 6px; }
@media (min-width: 900px) { .backdrop { align-items: center; } .sheet { border-radius: 16px; border-block-end: 1px solid var(--line); } }
/* a join link's landing: the space it opens, and Join */
.invite { text-align: center; padding-block: 48px 24px; }
.invite .actions { justify-content: center; }
.invite-icon { width: 72px; height: 72px; margin: 0 auto 16px; display: grid; place-items: center; border-radius: 50%; background: var(--panel-2); font-size: 34px; overflow: hidden; }
/* the Share sheet's link and the Add members sheet's outcomes */
.share-code { margin-block: 10px 0; }
.add-results { margin-block-start: 8px; }
.add-results:empty { display: none; }
.or { display: flex; align-items: center; gap: 12px; margin-block: 20px 4px; color: var(--muted); font-size: 13px; }
.or::before, .or::after { content: ''; flex: 1; border-block-start: 1px solid var(--line); }
/* a space's icon: its picture, round, else its emoji. The picker is a
   button shaped like an input, and a panel under its row: upload an image,
   then the emoji in groups, scrolling inside the panel */
.space-pic { display: block; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.space-ico { display: inline-grid; place-items: center; width: 20px; height: 20px; vertical-align: middle; }
.icon-pick { width: 56px; height: 38px; min-height: 38px; flex: none; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); font-size: 20px; font-weight: 400; color: var(--text); }
.icon-pick:hover, .icon-pick[aria-expanded="true"] { border-color: var(--text); }
.icon-pick .space-pic { width: 26px; height: 26px; }
.icon-panel { margin-block-start: 8px; border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 10px 8px; }
.emoji-groups { max-height: 232px; overflow-y: auto; overscroll-behavior: contain; }
.emoji-group { font-size: 13px; color: var(--muted); padding-block: 10px 4px; }
.emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); }
.emoji-opt { min-height: 40px; padding: 0; font-size: 22px; font-weight: 400; color: var(--text); }
.emoji-opt:hover { background: var(--panel-2); }
.emoji-opt.on { box-shadow: inset 0 0 0 1px var(--text); }
.btn-google { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 38px; padding: 8px 14px; border: 1px solid var(--line); border-radius: var(--radius); color: var(--text); text-decoration: none; font-weight: 500; }
.btn-google:hover { background: var(--panel-2); }
.seg { display: flex; gap: 2px; padding: 2px; border: 1px solid var(--line); border-radius: 10px; }
.seg button { flex: 1; min-height: 30px; border-radius: 7px; font-size: 14px; }
.seg button.on { background: var(--panel-2); color: var(--text); }

/* the frames: a page fills the view, a widget is a bar, a card sits under
   an answer. A frame is transparent: the resource is in the app's theme
   (the bridge sets it) and paints its own background, or shows the page's */
.frame { display: block; width: 100%; border: 1px solid var(--line); border-radius: 12px; background: transparent; }
.frame-page { min-height: 60vh; }
.frame-widget { min-height: 80px; border: 0; border-radius: 0; }
.frame-inline { min-height: 120px; margin-block-start: 8px; }
.frame.fullscreen { position: fixed; inset: 0; z-index: 60; width: 100vw; height: 100dvh !important; border: 0; border-radius: 0; }
body.has-fullscreen-app { overflow: hidden; }
/* the customize sheet: tall, the thread inside it */
.sheet.customize { height: 88dvh; display: flex; flex-direction: column; }
.sheet.customize .thread-host { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.sheet.customize .thread-box { flex: 1; min-height: 0; overflow-y: auto; }
.sheet.customize .my-requests { max-height: 30dvh; overflow-y: auto; }
.sheet.customize .composer { position: static; padding: 8px 0 0; border: 0; background: transparent; }
.req { padding: 12px 0; border-block-end: 1px solid var(--line); }
.req:last-child { border-block-end: 0; }
.req .st { font-size: 12px; color: var(--muted); white-space: nowrap; }
.req .st.built { color: var(--text); font-weight: 600; } .req .st.failed, .req .st.declined { color: var(--bad); }
.req .note { font-size: 13px; color: var(--muted); margin-block-start: 4px; }
/* a feature's row opens it in full: the title and summary are one button,
   plain text, the title underlined on hover */
.req-open { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; width: 100%; min-height: 0; padding: 0; text-align: start; color: var(--text); font-weight: 300; }
.req-open.req-title { display: inline-flex; width: auto; }
.req-open .grow { flex: 1 1 auto; min-width: 0; }
.req-open .grow > b, .req-open .grow > .small { display: block; }
/* a feature's row in Settings: its title and status on one line, its
   summary under both, two lines at most; the rest is in the feature in full */
.req-open > .req-line { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; width: 100%; }
.req-open > .req-line > b { flex: 1 1 0; min-width: 0; }
.req-open > .clamp { width: 100%; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; }
.req-more { padding-block-start: 8px; }
/* a feature's card (spec 005): the same as its row, with its actions under
   it; in the chat it is framed, bordered like an input, where the line
   that announced it was, as wide as a bubble at most */
.req-acts { gap: 16px; margin-block-start: 6px; }
.fcard .working { font-size: 13px; color: var(--muted); margin-block-start: 6px; animation: working 1.6s ease-in-out infinite; }
.fcard .stale, .fcard .err { margin: 6px 0 0; }
.fcard.framed { padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); }
.fcard.framed:last-child { border-block-end: 1px solid var(--line); }
.msg-card { align-self: center; width: min(100%, 440px); }
.msg-cards { margin-block-start: 8px; white-space: normal; }
.msg-cards + .msg-cards { margin-block-start: 6px; }
@media (prefers-reduced-motion: reduce) { .fcard .working { animation: none; } }
/* a new space's first question (spec 005): the quick answers are pills
   like the website's ideas, Skip a plain link after them; the offer to
   bring people in is a muted line and two actions */
.start-answers { display: flex; flex-wrap: wrap; gap: 8px; margin-block-start: 10px; white-space: normal; }
.start-chip { min-height: 32px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 13px; font-weight: 400; background: transparent; }
.start-chip:hover { color: var(--text); border-color: color-mix(in srgb, var(--text) 30%, var(--line)); }
.start-skip { min-height: 32px; padding: 0 6px; color: var(--muted); font-size: 13px; font-weight: 400; background: transparent; border: 0; }
.start-skip:hover { color: var(--text); }
.start-offer { margin-block-start: 10px; white-space: normal; }
.start-offer .req-acts { margin-block-start: 4px; }
.fcard.suggestion .st { color: var(--muted); }
button.req-open:hover { color: var(--text); }
button.req-open:hover b { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.req-open .st { padding-block-start: 3px; }
/* the feature's sheet: its details as Vibes wrote them, nested lists and fields */
.sheet.feature .st { color: var(--muted); } .sheet.feature .st.built { color: var(--text); font-weight: 600; } .sheet.feature .st.failed, .sheet.feature .st.declined { color: var(--bad); }
.sheet.feature .section > p:last-child { margin-block-end: 0; }
.spec-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.spec-list { margin: 0; padding-inline-start: 18px; }
.spec-list > li + li { margin-block-start: 4px; }
.spec-fields { display: grid; gap: 12px; }
.spec-list .spec-fields { gap: 6px; }
.spec-key { font-size: 13px; font-weight: 400; color: var(--muted); margin-block-end: 2px; }
.spec-name { font-weight: 500; }
/* a feature's sheet: tall, two tabs (Details, Build), the tab's body
   scrolling between them and the foot. Build is a session with Vibes:
   the chat's bubbles, each build's steps in words as muted lines (an x in
   --bad for a step it had to redo), the composer pinned at the foot */
.sheet.feature { height: 88dvh; display: flex; flex-direction: column; }
.sheet.feature .fmeta { margin-block-end: 12px; }
.ftabs { flex: none; max-width: 280px; }
.fbody { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding-block-start: 14px; }
.fbody > .section:first-of-type { margin-block-start: 8px; }
.ffoot { flex: none; }
.ffoot:empty { display: none; }
.ffoot .actions { margin-block-start: 8px; }
.sheet.feature .composer { position: static; padding: 10px 0 0; border: 0; background: transparent; }
.fbody .thread { padding-block: 0 8px; }
.msg.system.err { color: var(--bad); }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 13px; font-weight: 400; color: var(--muted); white-space: normal; }
.steps li { display: flex; gap: 6px; align-items: flex-start; }
.steps li .icon { margin-block-start: 2px; }
.steps li.again .icon { color: var(--bad); }
.steps + .text, .steps + .working { margin-block-start: 8px; }
/* a package said in lines: what it ships, what reverting it does */
.ships { margin: 4px 0 0; padding-inline-start: 18px; display: grid; gap: 2px; white-space: normal; }
.msg .ships { font-size: 14px; }
.msg .text + .ships { margin-block-start: 8px; }
.pkg .spec-key { margin-block-start: 14px; }
.pkg > p.small { margin-block-end: 0; }
.pkg .ships + p.small { margin-block-start: 12px; }
/* the control plane */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 16px 12px; margin-block: 8px 4px; }
.kpi { border-inline-start: 1px solid var(--line); padding-inline-start: 12px; }
.kpi b { display: block; font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; } .kpi span { font-size: 12px; color: var(--muted); }
.hbar { display: grid; grid-template-columns: 110px 1fr auto; gap: 8px; align-items: center; margin: 4px 0; font-size: 13px; }
.hbar i { display: block; height: 6px; background: var(--text); border-radius: 3px; }
.toggle { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 14px; }
.list-item { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-block-end: 1px solid var(--line); }
.list-item:last-child { border-block-end: 0; }
.list-item .grow { min-width: 0; }
.ellip { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge { display: inline-flex; align-items: center; font-size: 11px; padding: 1px 8px; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); text-decoration: none; vertical-align: middle; }
/* the account page's profile head */
.profile-head { display: flex; align-items: center; gap: 14px; margin-block-end: 4px; }
.profile-head .who { min-width: 0; }
.profile-head .who b { display: block; font-size: 17px; font-weight: 600; }
/* the start page and the sign-in page */
/* The website's top bar, and the sign-in page's: the wordmark (a link to /)
   at the start, the way in at the end; 60px and translucent like the app's
   top bar, its content on the website's 1080px column. */
.site-bar { position: sticky; inset-block-start: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: calc(60px + var(--sat)); padding: var(--sat) max(16px, calc((100% - 1080px) / 2)) 0; background: color-mix(in srgb, var(--bg) 62%, transparent); -webkit-backdrop-filter: saturate(180%) blur(18px); backdrop-filter: saturate(180%) blur(18px); }
.site-brand { display: inline-flex; color: var(--text); text-decoration: none; font-weight: 500; font-size: 20px; border-radius: 6px; }
.site-brand .wordmark { height: 22px; }
/* the sign-in page under that bar: a heading, a muted line, the form */
.auth { padding-block-start: 28px; }
.auth-head { margin-block-end: 20px; }
.auth-head p { margin-block: 4px 0; }
.brand-head { padding-block: 28px 8px; }
.brand-head .wordmark { height: 30px; }
.brand-head p { margin-block: 12px 0; }
