/* Substrate. Pure black, Framer-style display type, solid rounded cards, the
   planet-horizon glow and the orb. No hairline rules, no translucent washes.
   Every text/background pair below clears WCAG AA. */
:root {
  --bg: #000;
  --card: #0E0F14;
  --card-2: #17181F;
  --btn-2: #1C1D22;
  --text: #F5F5F7;
  --text-2: #D4D4D8;
  --muted: #A1A1AA;
  --faint: #8B8B94;
  --blue: #3B5BFF;
  --amber: #FFB547;
  --amber-bg: #17110A;
  --amber-ring: #4A3611;
  --teal: #5BE3C4;
  --teal-bg: #0B1F1B;
  --red: #FF7A6B;
  --red-bg: #1F0E0C;
  --ring: #2A2F55;
  /* The electric gradient: what is selected or on. */
  --electric: linear-gradient(135deg, #3B5BFF, #7B2CFF 60%, #C04BFF);
  --electric-glow: 0 0 0 1px #8F7BFF55, 0 4px 18px #5B3BFF66;
  --display: "Inter Tight", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --r: 22px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
input[type=checkbox], input[type=radio] { accent-color: #7B2CFF; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font-family: var(--display); font-size: 15px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
a { color: var(--text); }
a:hover { color: #BFC8FF; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 2px solid #8FA8FF; outline-offset: 2px;
}
.mono { font-family: var(--mono); font-size: .9em; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.narrow { max-width: 760px; margin: 0 auto; padding: 0 24px; }

/* nav */
.top { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between; padding: 18px 0; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; text-decoration: none; }
.links { display: flex; flex-wrap: wrap; gap: 22px; font-size: 14px; }
.links a { color: var(--muted); text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.links a:hover { color: var(--text); }
.links a svg { width: 15px; height: 15px; }
/* The current page: the menu's electric gradient as an underline, a little below the word. */
.links a.on, .brand.on { color: var(--text); position: relative; }
.links a.on::after, .brand.on::after { content: ""; position: absolute; left: 0; right: 0; bottom: -9px; height: 2px; border-radius: 2px; background: linear-gradient(90deg, #3B5BFF, #7B2CFF, #C04BFF); box-shadow: 0 0 10px #7B2CFF88; }
.links a.on svg { color: #A98BFF; }
.crumbs { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.crumbs .sep { color: #52525B; }

/* type */
h1.hero { margin: 0; font-weight: 600; font-size: clamp(40px, 6vw, 64px); line-height: 1.04; letter-spacing: -.035em; max-width: 880px; }
h1 { font-weight: 600; font-size: clamp(30px, 4vw, 44px); line-height: 1.06; letter-spacing: -.03em; margin: 0; }
h2 { font-weight: 600; font-size: clamp(26px, 3vw, 40px); line-height: 1.08; letter-spacing: -.03em; margin: 0; }
h3 { font-weight: 500; font-size: 18px; margin: 0; }
.grad { background: linear-gradient(90deg, #8FF0E0, #8FA8FF 55%, #C79BFF); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lead { font-size: 18px; color: var(--muted); max-width: 640px; margin: 0; }

/* buttons: primary (bright), secondary (raised dark), tertiary (no fill), danger.
   Depth comes from a top highlight and a drop shadow; hover lifts, press sinks. */
.btn, button.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 18px;
  border: 0; border-radius: 12px; font: 500 14px var(--display); text-decoration: none; cursor: pointer; color: var(--text);
  background: linear-gradient(180deg, #2A2B33, #1C1D23);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.09), 0 1px 2px rgba(0,0,0,.7), 0 6px 16px -6px rgba(0,0,0,.8);
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease, filter .12s ease; }
.btn:hover { color: var(--text); transform: translateY(-1px); background: linear-gradient(180deg, #33343D, #23242B);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12), 0 2px 4px rgba(0,0,0,.7), 0 10px 22px -8px rgba(0,0,0,.9); }
.btn:active { transform: translateY(1px); box-shadow: inset 0 2px 4px rgba(0,0,0,.5), 0 0 0 rgba(0,0,0,0); }
.btn:focus-visible { outline: 2px solid #8FA8FF; outline-offset: 2px; }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn.primary { color: #09090B; font-weight: 600; background: linear-gradient(180deg, #FFFFFF, #D9D9E0);
  box-shadow: inset 0 1px 0 #fff, inset 0 -2px 0 rgba(0,0,0,.12), 0 1px 2px rgba(0,0,0,.6), 0 8px 24px -8px rgba(143,168,255,.55); }
.btn.primary:hover { color: #09090B; background: linear-gradient(180deg, #FFFFFF, #E6E6EC);
  box-shadow: inset 0 1px 0 #fff, inset 0 -2px 0 rgba(0,0,0,.1), 0 2px 4px rgba(0,0,0,.6), 0 12px 30px -8px rgba(143,168,255,.7); }
.btn.primary:active { box-shadow: inset 0 2px 4px rgba(0,0,0,.25); }
.btn.tertiary { background: none; box-shadow: none; color: var(--muted); }
.btn.tertiary:hover { background: #17181D; color: var(--text); box-shadow: none; transform: none; }
.btn.tertiary:active { background: #121317; }
.btn.amber { color: #000; font-weight: 600; background: linear-gradient(180deg, #FFC46B, var(--amber)); }
.btn.amber:hover { color: #000; background: linear-gradient(180deg, #FFD08A, #FFB547); }
.btn.danger { color: var(--red); background: linear-gradient(180deg, #3A1C22, #2A1418); }
.btn.danger:hover { color: #FF9AA6; background: linear-gradient(180deg, #47222A, #33181D); }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: 13px; border-radius: 10px; }
.btn.small svg { width: 14px; height: 14px; }
@media (prefers-reduced-motion: reduce) { .btn, .btn:hover, .btn:active { transform: none; transition: none; } }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.between { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
form.inline { display: inline; margin: 0; }

/* inputs */
input[type=email], input[type=text], input[type=search], input[type=number], select, textarea {
  background: var(--card-2); color: var(--text); border: 0; border-radius: 10px; padding: 12px 14px; font: 15px var(--display); min-height: 44px; width: 100%;
}
textarea { min-height: 96px; resize: vertical; }
label { display: block; font-size: 13px; color: var(--muted); margin: 0 0 6px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* cards */
.card { background: var(--card); border-radius: var(--r); padding: 20px 22px; display: flex; flex-direction: column; gap: 12px; }
.card.glow { box-shadow: 0 0 0 1px var(--ring), 0 0 40px #18238F; }
.card.attention { background: linear-gradient(180deg, color-mix(in srgb, var(--amber) 14%, var(--card)), var(--card)); box-shadow: inset 0 0 0 1px var(--amber-ring); }
.card.danger { background: var(--red-bg); }
.inset { background: var(--card-2); border-radius: 14px; padding: 12px 14px; }
.code { background: var(--card-2); border-radius: 12px; padding: 14px 16px; font-family: var(--mono); font-size: 13px; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; }
.envelope { background: #000; border-radius: 14px; padding: 16px; font-family: var(--mono); font-size: 12.5px; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--muted); }
.envelope .untrusted { color: var(--text); }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.grid.tight { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.stack { display: flex; flex-direction: column; gap: 12px; }
.split { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.split > .main { flex: 999 1 620px; min-width: 0; }
.split > .side { flex: 1 1 300px; min-width: 0; }
.stat .k { color: var(--muted); font-size: 13px; }
.stat .v { font-size: 22px; font-weight: 500; }
.stat .big { font-size: 40px; font-weight: 500; letter-spacing: -.03em; line-height: 1.1; }
dl.kv { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 6px 12px; margin: 0; font-size: 14px; }
dl.kv dt { color: var(--faint); }
dl.kv dd { margin: 0; overflow-wrap: anywhere; }

/* pills, badges, dots */
.pill { display: inline-flex; align-items: center; gap: 8px; background: var(--card); border-radius: 999px; padding: 6px 12px; font-size: 13px; }
.badge { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: var(--blue); color: #fff; font-size: 12px; }
/* Tags: a solid neutral chip; the state is a solid dot, never a tinted wash. */
.tag { display: inline-flex; align-items: center; gap: 6px; border-radius: 8px; padding: 3px 9px; font-size: 12px; font-weight: 500; background: var(--btn-2); color: var(--text); white-space: nowrap; }
.tag.ok::before, .tag.warn::before, .tag.bad::before, .tag.blue::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--dot); flex: none; }
.tag.ok { --dot: var(--teal); }
.tag.warn { --dot: var(--amber); }
.tag.bad { --dot: var(--red); }
.tag.blue { --dot: #8FA8FF; }
.tag.off { --dot: var(--faint); color: var(--muted); }
/* A chip holding free text (a client name): shrinks and ends in an ellipsis. */
.tag.clip { min-width: 0; max-width: 100%; }
.tag.clip > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag.off::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--dot); flex: none; }
.tag.blue::before { animation: tag-pulse 1.2s ease-in-out infinite; }
@keyframes tag-pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .tag.blue::before { animation: none; } }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #52525B; display: inline-block; flex: none; }
.dot.ok { background: var(--teal); } .dot.warn { background: var(--amber); } .dot.bad { background: var(--red); } .dot.blue { background: #8FA8FF; }
.logo { width: 18px; height: 18px; vertical-align: -3px; }
.logo.lg { width: 26px; height: 26px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: #2B2E45; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; flex: none; position: relative; }
.avatar .logo { position: absolute; right: -3px; bottom: -3px; width: 15px; height: 15px; background: #000; border-radius: 50%; padding: 2px; }

/* transcript */
.ev .head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; }
.ev .who { display: inline-flex; gap: 10px; align-items: center; }
.ev .role { color: var(--muted); font-size: 13px; }
.ev .time { font-family: var(--mono); font-size: 12px; color: var(--faint); }
.ev .body { white-space: pre-wrap; overflow-wrap: anywhere; }
.stages { display: flex; flex-wrap: wrap; gap: 6px; }
.deploy { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; font-size: 13px; }
.deploy > div { background: var(--card-2); border-radius: 14px; padding: 12px; }
.deploy > div.on { background: #fff; color: #000; }

/* list rows */
.list { background: var(--card); border-radius: var(--r); padding: 8px; display: flex; flex-direction: column; gap: 2px; }
.list a.item, .list div.item { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; padding: 12px; border-radius: 14px; text-decoration: none; }
.list a.item:hover { background: var(--card-2); color: var(--text); }
.list .item .l { display: flex; flex-wrap: nowrap; gap: 10px; align-items: center; min-width: 0; flex: 1 1 240px; }
.list .item .r { color: var(--muted); font-size: 13px; display: inline-flex; gap: 6px; align-items: center; }
.list .label { padding: 10px 12px 6px; font-size: 13px; color: var(--muted); }
.side-nav { background: var(--card); border-radius: var(--r); padding: 14px 10px; display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.side-nav a { padding: 9px 12px; border-radius: 12px; text-decoration: none; color: var(--text-2); display: flex; justify-content: space-between; align-items: center; }
.side-nav a.on, .side-nav a:hover { background: var(--btn-2); color: var(--text); }
.side-nav .label { padding: 12px 12px 4px; color: var(--faint); font-size: 12px; }

/* hero stage + horizon */
.stage { position: relative; overflow: hidden; border-radius: 24px; min-height: 600px; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse 60% 55% at 50% 42%, #0E1A6B 0%, #070A2A 45%, #000 80%); padding: 48px 20px 140px; }
.horizon { position: absolute; left: -10%; right: -10%; bottom: -1180px; height: 1400px; border-radius: 50%; background: #000; pointer-events: none;
  box-shadow: 0 -2px 0 #F2F4FF, 0 -10px 40px #6E8CFF, 0 -40px 120px #2D47FF, 120px -30px 160px #FF8A5B; }
.stage .inner { position: relative; display: flex; flex-direction: column; align-items: center; gap: 20px; width: 100%; max-width: 520px; }
.page-horizon { position: fixed; left: -20%; right: -20%; bottom: -1300px; height: 1400px; border-radius: 50%; background: #000; z-index: -1; pointer-events: none;
  box-shadow: 0 -2px 0 #F2F4FF, 0 -10px 40px #6E8CFF, 0 -40px 140px #2D47FF, 160px -30px 180px #FF8A5B; }

/* the orb */
@keyframes orbspin { to { transform: rotate(360deg); } }

@keyframes orbglow { 0%, 100% { filter: drop-shadow(0 0 28px #2E4BFF) drop-shadow(0 0 60px #3A1C8C); } 50% { filter: drop-shadow(0 0 40px #6A3BFF) drop-shadow(0 0 80px #1C3FAF); } }
.orb { position: relative; display: inline-block; flex: none; border-radius: 50%; overflow: hidden; isolation: isolate; -webkit-mask-image: radial-gradient(#fff, #000); width: 20px; height: 20px;
  background: conic-gradient(from 20deg, #1E3BFF, #7B2CFF, #FF5FCF, #FFB070, #5FE6FF, #1E3BFF); }
.orb::before { content: ""; position: absolute; inset: -20%; mix-blend-mode: screen; animation: orbspin 9s linear infinite;
  background: conic-gradient(from 180deg at 55% 60%, #05061A 0deg, #0B1BFF 60deg, #05061A 120deg, #C04BFF 200deg, #05061A 260deg, #7FF0FF 320deg, #05061A 360deg); }
.orb::after { content: ""; position: absolute; left: 18%; top: 14%; width: 34%; height: 22%; border-radius: 50%; background: radial-gradient(closest-side, #FFFFFF, #CFD8FF 40%, #5A6BFF00); }
.orb.xl { width: 120px; height: 120px; }
/* the glow sits on a wrapper so it follows the blob's outline (clip-path would cut a box-shadow) */
.orb-wrap { display: inline-flex; flex: none; animation: orbglow 5s ease-in-out infinite; }
.orb.thinking { animation-duration: 2.4s, 2s; }
@media (prefers-reduced-motion: reduce) { .orb::before, .orb-wrap { animation: none; } }

/* Notices: a solid card with a coloured icon chip. No tinted washes. */
.notice { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: 14px; background: var(--card-2); color: var(--text); font-size: 14px; }
.notice .nb { flex: 1; min-width: 0; }
.ni { flex: none; display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: var(--amber); color: #111; }
.ni svg { width: 15px; height: 15px; }
.ni.plain { background: var(--card-2); color: var(--text); box-shadow: 0 0 0 1px var(--ring); }
.notice.ok .ni { background: var(--teal); }
.notice.bad .ni { background: var(--red); }
.card.attention h3.row, .card.attention .row { gap: 10px; }
.secret { font-family: var(--mono); background: #000; border-radius: 10px; padding: 12px 14px; overflow-wrap: anywhere; }
footer.foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; padding: 32px 0 48px; font-size: 13px; color: var(--faint); }
details > summary { cursor: pointer; color: var(--muted); font-size: 13px; }
details.edit.card > summary { color: var(--text); font-size: 15px; font-weight: 500; list-style: none; display: flex; align-items: center; gap: 10px; }
details.edit.card > summary::-webkit-details-marker { display: none; }
details.edit.card > summary > svg { color: var(--teal); }
details.edit.card > summary .chev { margin-left: auto; display: flex; color: var(--faint); transition: transform .15s; }
details.edit.card[open] > summary .chev { transform: rotate(180deg); }
table.audit { width: 100%; border-collapse: collapse; font-size: 13px; }
table.audit td { padding: 10px 8px; vertical-align: top; }
table.audit tr:nth-child(odd) td { background: var(--card); }
table.audit td:first-child { border-radius: 10px 0 0 10px; } table.audit td:last-child { border-radius: 0 10px 10px 0; }
.scroll-x { overflow-x: auto; }
@media (max-width: 640px) {
  .wrap, .narrow { padding: 0 16px; } .card { padding: 16px; } .stage { min-height: 520px; }
  /* Header: wordmark and account on one row, the page links in a scrolling row below. */
  .top { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; padding: 12px 0 4px; }
  .top > .row:first-child { display: contents; }
  .top .brand { grid-row: 1; justify-self: start; }
  .top > .row:last-child { grid-row: 1; grid-column: 2; flex-wrap: nowrap; }
  .top .links { grid-row: 2; grid-column: 1 / -1; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; gap: 20px; padding: 6px 0 14px; white-space: nowrap; }
  .top .links::-webkit-scrollbar { display: none; }
  .links a.on::after { bottom: -7px; }
  details.acct summary > span { display: none; }
  details.acct .menu { max-width: calc(100vw - 32px); }
  /* 16px stops iOS Safari zooming in on focus. */
  input[type=email], input[type=text], input[type=search], input[type=number], select, textarea { font-size: 16px; }
  /* Audit log: each entry is a small card instead of a clipped six-column row. */
  table.audit, table.audit tbody, table.audit tr { display: block; }
  table.audit tr { display: flex; flex-wrap: wrap; gap: 2px 10px; padding: 10px 12px; border-radius: 12px; }
  table.audit tr:nth-child(odd) { background: var(--card); }
  table.audit td { display: block; padding: 0; background: none !important; border-radius: 0 !important; }
  table.audit td:empty { display: none; }
  table.audit td:nth-child(n+4) { flex-basis: 100%; overflow-wrap: anywhere; }
}

/* project icons: the project's own logo (found by the relay), or a lettered tile */
.picon { display: inline-flex; flex: none; border-radius: 22%; object-fit: cover; background: var(--card-2); }
.picon.tile { align-items: center; justify-content: center; font-weight: 600; color: #fff;
  background: linear-gradient(135deg, #3B5BFF, #7B2CFF 60%, #C04BFF); }
.row.pair > .btn { flex: 1 1 180px; }
.code.copyable { position: relative; padding-right: 76px; }
.code .ln { display: block; }
.code .ln::before { content: "$ "; color: var(--muted); user-select: none; }
.code .copy { position: absolute; top: 8px; right: 8px; }

/* Chat: the tester's web chat. Sidebar of projects and conversations, a log, a composer. */
.chat-body { height: 100dvh; overflow: hidden; overscroll-behavior: none; }
html:has(.chat-body) { overflow: hidden; height: 100%; }
.chat { display: grid; grid-template-columns: 280px 1fr; height: 100dvh; }
.chat-side { background: var(--card); padding: 18px 14px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; }
.chat-brand { padding: 2px 6px 10px; }
.chat-side .label { margin-top: 14px; padding: 0 6px; }
.chat-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 9px; border: 1px solid transparent; border-radius: 12px; background: transparent; color: var(--text-2); font: inherit; font-size: 14px; text-align: left; cursor: pointer; }
.chat-item:hover { background: var(--card-2); color: var(--text); }
/* Selected: a full electric border; the first time, a light runs round it once. */
.chat-item.on { color: var(--text); background: linear-gradient(var(--card-2), var(--card-2)) padding-box, linear-gradient(90deg, #3B5BFF, #7B2CFF, #C04BFF, #3B5BFF) border-box; background-size: 100% 100%, 300% 100%; box-shadow: 0 0 14px #5B3BFF33; }
.chat-item.on.pop { animation: sel-sweep .7s ease-out 1, sel-glow .7s ease-out 1; }
@keyframes sel-sweep { from { background-position: 0 0, 100% 0; } to { background-position: 0 0, 0 0; } }
@keyframes sel-glow { 0% { box-shadow: 0 0 0 0 #7B2CFFAA; } 60% { box-shadow: 0 0 0 5px #7B2CFF00, 0 0 22px #5B3BFF66; } 100% { box-shadow: 0 0 14px #5B3BFF33; } }
@media (prefers-reduced-motion: reduce) { .chat-item.on.pop { animation: none; } }
.chat-item .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-item .faint { font-size: 12px; }
.chat-who { margin-top: auto; padding: 10px 6px 0; font-size: 12px; overflow-wrap: anywhere; }
.chat-main { display: flex; flex-direction: column; min-width: 0; height: 100dvh; }
.chat-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 16px 28px; min-height: 60px; }
.chat-head { min-width: 0; }
.chat-head .row { gap: 10px; }
.chat-sum { font-size: 13px; margin-top: 4px; }
.chat-log { flex: 1; overflow-y: auto; padding: 8px 28px 24px; display: flex; flex-direction: column; gap: 12px; max-width: 860px; width: 100%; margin: 0 auto; }
.chat-empty { margin: auto; text-align: center; display: grid; justify-items: center; gap: 4px; padding: 40px 0; }
.chat-empty .about { max-width: 560px; margin: 4px auto 0; color: var(--text-2); white-space: pre-wrap; }
.chat-empty h2 { font-size: 26px; font-weight: 500; letter-spacing: -.02em; margin: 18px 0 0; }
.msg { max-width: 78%; padding: 12px 16px; border-radius: 18px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.me { align-self: flex-end; background: var(--blue); color: #fff; border-bottom-right-radius: 6px; }
.msg.agent { align-self: flex-start; background: var(--card-2); border-bottom-left-radius: 6px; }
.msg .who { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.note { align-self: center; font-size: 12px; color: var(--faint); text-align: center; max-width: 90%; }
.msg.me { position: relative; }
.singer { position: absolute; left: -54px; bottom: 0; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; overflow: hidden; background: #000; cursor: pointer; box-shadow: 0 0 0 1px #1E3A5F; transition: transform .15s, box-shadow .15s; }
.singer img { width: 100%; height: 100%; display: block; }
.singer:hover { transform: scale(1.08); box-shadow: 0 0 0 1px #4FC3F7, 0 0 14px #4FC3F766; }
.singer.loading { animation: singer-wait 1s ease-in-out infinite; }
.singer.singing { box-shadow: 0 0 0 2px #4FC3F7, 0 0 22px #4FC3F7AA; animation: singer-pulse .5s ease-in-out infinite alternate; }
@keyframes singer-wait { 50% { opacity: .45; } }
@keyframes singer-pulse { to { transform: scale(1.12); } }
@media (prefers-reduced-motion: reduce) { .singer.loading, .singer.singing { animation: none; } }
.chat-opts { flex: none; }
.chat-opts[hidden] { display: none; }
.seg { display: inline-flex; align-items: center; gap: 4px; padding: 3px; border-radius: 10px; background: var(--card-2); font-size: 13px; }
.seg-label { color: var(--faint); padding: 0 8px 0 6px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.seg-btn { border: 0; background: transparent; color: var(--faint); font: inherit; padding: 5px 11px; border-radius: 7px; cursor: pointer; transition: color .15s, background .15s; }
.seg-btn:hover { color: var(--text); background: #ffffff0a; }
.seg-btn.on { background: var(--electric); color: #fff; font-weight: 600; box-shadow: var(--electric-glow), inset 0 1px 0 #ffffff33; }
.seg-btn.prod.on { background: linear-gradient(135deg, #FF8A3D, #FF4F7B); box-shadow: 0 0 0 1px #FF8A5A66, 0 4px 18px #FF4F7B55, inset 0 1px 0 #ffffff33; }
.status-line { align-self: flex-start; display: flex; align-items: center; gap: 10px; font-family: var(--mono); font-size: 13px; color: var(--muted); padding: 2px 4px; }
.status-line[hidden] { display: none; }
.status-line .spin { width: 1ch; color: #D97757; }
.status-line .critter { color: var(--text-2); }
.status-line.done .spin { color: var(--faint); }
.chat-banner { width: fit-content; max-width: min(720px, calc(100% - 56px)); margin: 0 auto 10px; padding: 6px 8px 6px 6px; border-radius: 999px; background: var(--card); font-size: 13px; box-shadow: 0 6px 24px #0008; }
.chat-banner .ni { width: 22px; height: 22px; border-radius: 50%; }
.chat-banner .ni svg { width: 13px; height: 13px; }
.chat-banner .x { border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 2px; display: inline-grid; }
.chat-banner .x svg { width: 14px; height: 14px; }
.chat-banner .x[hidden] { display: none; }
.chat-banner[hidden] { display: none; }
.chat-compose { display: flex; gap: 10px; align-items: flex-end; max-width: 860px; width: calc(100% - 56px); margin: 0 auto 22px; padding: 10px; border-radius: 22px; background: var(--card-2); }
.chat-compose textarea { flex: 1; resize: none; border: 0; background: transparent; color: var(--text); font: inherit; padding: 8px 10px; min-height: 0; height: auto; max-height: 220px; box-shadow: none; }
.chat-compose { align-items: center; }
.chat-compose textarea:focus-visible { outline: none; }
.rich > div { white-space: pre-wrap; }
.rich code { font-family: var(--mono); font-size: .88em; background: rgba(0,0,0,.28); padding: 1px 5px; border-radius: 6px; }
.rich pre { margin: 8px 0; padding: 12px 14px; background: #07080B; border-radius: 12px; overflow-x: auto; white-space: pre; }
.rich pre code { background: none; padding: 0; font-size: 13px; }
.msg a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.msg.agent a { color: #BFC8FF; }
.files { display: flex; flex-wrap: wrap; gap: 8px; }
.files:not(:empty) { margin-top: 8px; }
.files .thumb img { display: block; max-width: 260px; max-height: 200px; border-radius: 10px; }
.files .file { display: inline-flex; padding: 6px 10px; border-radius: 10px; background: rgba(0,0,0,.28); font-size: 13px; }
.chat-files { display: flex; flex-wrap: wrap; gap: 6px; max-width: 860px; width: calc(100% - 56px); margin: 0 auto 8px; }
.chat-files[hidden] { display: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 12px; border-radius: 999px; background: var(--card-2); font-size: 13px; }
.chip button { border: 0; background: transparent; color: var(--muted); font-size: 16px; cursor: pointer; padding: 0 4px; }
.btn.icon { padding: 10px; }
button.chat-menu { display: none; }
/* Phones: the sidebar becomes a drawer over the chat, opened by the menu button. */
@media (max-width: 760px) {
  .chat-files { width: calc(100% - 24px); }
  .chat { grid-template-columns: minmax(0, 1fr); }
  .chat-side { position: fixed; inset: 0 auto 0 0; z-index: 30; width: min(300px, 86vw); transform: translateX(-100%); transition: transform .2s ease; padding-top: max(18px, env(safe-area-inset-top)); }
  .chat.side-open .chat-side { transform: none; box-shadow: 0 0 60px #000; }
  .chat.side-open::after { content: ""; position: fixed; inset: 0; z-index: 25; background: #000a; }
  button.chat-menu { display: inline-flex; flex: none; margin: -6px 0 0 -10px; }
  .chat-top { flex-wrap: wrap; gap: 8px 10px; padding: 12px 12px 8px; padding-top: max(12px, env(safe-area-inset-top)); }
  .chat-head { flex: 1 1 calc(100% - 56px); }
  .chat-opts { flex: 1 1 100%; overflow-x: auto; scrollbar-width: none; }
  /* Send is the icon alone here; the label stays for screen readers. */
  #chat-send { padding: 10px 14px; }
  #chat-send span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .chat-head .row { gap: 6px; font-size: 14px; }
  .chat-log { padding-left: 12px; padding-right: 12px; }
  .chat-compose { width: calc(100% - 24px); margin-bottom: max(12px, env(safe-area-inset-bottom)); }
  /* 16px stops iOS Safari zooming in on focus. */
  .chat-compose textarea { font-size: 16px; }
  .msg { max-width: 88%; }
  .msg.me { margin-left: 52px; }
  .singer { left: -48px; width: 40px; height: 40px; }
  .files .thumb img { max-width: 100%; }
}
@media (max-width: 760px) and (prefers-reduced-motion: reduce) { .chat-side { transition: none; } }

/* Avatars and the agent mark: the agent's own logo moves while it works. */
.avatar-img { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; flex: none; background: var(--card-2); }
a.me { text-decoration: none; gap: 8px; }
.agent-mark { display: inline-grid; place-items: center; width: 18px; height: 18px; flex: none; }
.agent-mark img { width: 18px; height: 18px; display: block; }
.agent-mark.working.claude img { animation: claude-spin 1.6s cubic-bezier(.5,.1,.5,.9) infinite; }
.agent-mark.working:not(.claude) img { animation: agent-breathe 1.2s ease-in-out infinite; }
.agent-mark.blocked img { animation: agent-breathe .8s ease-in-out infinite; filter: drop-shadow(0 0 4px var(--amber)); }
.agent-mark.offline img { filter: grayscale(1); opacity: .45; }
@keyframes claude-spin { 0% { transform: rotate(0) scale(1); } 50% { transform: rotate(180deg) scale(.82); } 100% { transform: rotate(360deg) scale(1); } }
@keyframes agent-breathe { 50% { transform: scale(.8); opacity: .6; } }
@media (prefers-reduced-motion: reduce) { .agent-mark img { animation: none !important; } }
.crumb-sep { color: var(--faint); }

/* On/off toggles (deploy rights on the project page): on is electric. */
.btn.small .tag.ok { background: var(--electric); color: #fff; box-shadow: var(--electric-glow); }
.btn.small .tag.ok::before { background: #fff; }

/* Timeline faces: the tester, the developer deciding, the agent, CI, the relay. */
.ev-av { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; flex: none; }
.ev-av.mark { display: inline-grid; place-items: center; background: var(--card-2); }
.ev-av.mark img, .ev-av.mark svg { width: 16px; height: 16px; }
.ev-av.mark .orb { width: 18px; height: 18px; }
.av-wrap { position: relative; display: inline-flex; flex: none; }
.av-badge { position: absolute; right: -4px; bottom: -4px; display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; background: var(--bg); }
.av-badge img { width: 12px; height: 12px; }
.av-badge:empty { display: none; }

.link-row { text-decoration: none; color: inherit; }
.link-row .chev { color: var(--faint); display: inline-grid; transition: transform .15s, color .15s; }
.link-row .chev svg { width: 16px; height: 16px; }
.link-row:hover .chev { color: var(--text); transform: translateX(2px); }

/* Card titles carry an icon, tinted like the active nav item. */
.label { display: flex; align-items: center; gap: 8px; }
.label > svg { width: 15px; height: 15px; flex: none; color: #A98BFF; }
.list > .label:has(> svg) { font-size: 14px; font-weight: 500; color: var(--text); padding-top: 12px; }
.stat .k { display: inline-flex; align-items: center; gap: 7px; }
.stat .k svg { width: 14px; height: 14px; color: #A98BFF; }

/* Timeline: chat messages are cards; Substrate, relay and CI updates are one compact line. */
.ev-line { padding: 4px 12px; font-size: 13px; color: var(--text-2); }
.ev-line .head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.ev-line .who { display: flex; align-items: center; gap: 8px; min-width: 0; flex-wrap: wrap; }
.ev-line .who:has(> .ev-text) { flex-wrap: nowrap; }
.ev-line .ev-text { min-width: 0; }
.ev-line .ev-av { width: 22px; height: 22px; }
.ev-line .ev-av.mark img, .ev-line .ev-av.mark svg { width: 13px; height: 13px; }
.ev-line .time { color: var(--faint); font-size: 12px; flex: none; }
.ev-line .body { margin: 2px 0 0 30px; color: var(--muted); font-size: 13px; }
.ev-line .row { margin-left: 30px; }
.ev-line .deploy { margin-left: 30px; }
.timeline { gap: 8px; }

/* Machines list: one icon per agent, the agent's mark on its corner, a tip on hover. */
.agents-strip { display: inline-flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; max-width: 520px; }
.agents-strip .mini { position: relative; display: inline-flex; }
.agents-strip .mini .agent-mark { position: absolute; right: -5px; bottom: -5px; width: 15px; height: 15px; border-radius: 50%; background: var(--card); }
.agents-strip .mini .agent-mark img { width: 11px; height: 11px; }
.agents-strip .mini[data-tip]:hover::after { content: attr(data-tip); position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%); white-space: nowrap;
  padding: 5px 9px; border-radius: 8px; background: #1C1D22; color: var(--text); font-size: 12px; box-shadow: 0 6px 20px #000a, 0 0 0 1px #8F7BFF44; z-index: 5; pointer-events: none; }

/* Deploy track: a row of steps; each has its own icon until it is done, then a check. */
.deploy-track { align-self: flex-start; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; color: var(--faint); padding: 4px 2px; }
.deploy-track .step { display: inline-flex; align-items: center; gap: 6px; }
.deploy-track .mark { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--card-2); }
.deploy-track .mark svg { width: 13px; height: 13px; }
.deploy-track .step.done { color: var(--teal); }
.deploy-track .step.done .mark { background: var(--teal-bg); }
.deploy-track .step.run { color: var(--text); }
.deploy-track .step.run .mark { background: var(--electric); color: #fff; box-shadow: var(--electric-glow); animation: tag-pulse 1.2s ease-in-out infinite; }
.deploy-track .step.wait { color: var(--text-2); }
.deploy-track .step.fail { color: var(--red); }
.deploy-track .step.fail .mark { background: var(--red-bg); }
.deploy-track .sep { display: inline-grid; color: var(--faint); }
.deploy-track .sep svg { width: 14px; height: 14px; }
.deploy-track .dt-note { color: var(--muted); margin-left: 6px; }
/* Active now stands apart from history. */
.list.active-now { background: linear-gradient(180deg, #11163A, #0E0F1C); box-shadow: inset 0 0 0 1px #3B5BFF33; }
.list.active-now .item:hover { background: #1A2050; }

/* Profile: the picture on the left, the fields beside it at reading width. */
.card.profile { display: grid; grid-template-columns: 180px minmax(0, 420px); gap: 40px; align-items: start; padding: 28px 30px; }
.card.profile .pic { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.card.profile .pic .avatar-img { width: 120px; height: 120px; box-shadow: 0 0 0 3px var(--card), 0 0 0 4px #7B2CFF66, 0 10px 30px #5B3BFF33; }
.card.profile .field input { width: 100%; }
.card.profile .readonly { padding: 11px 14px; border-radius: 12px; background: var(--card-2); color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
@media (max-width: 640px) { .card.profile { grid-template-columns: 1fr; gap: 24px; } }

/* Any icon without its own size stays small. */
svg.ic { flex: none; }
/* Account menu, top right. */
details.acct { position: relative; }
details.acct summary { list-style: none; display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 4px 8px 4px 4px; border-radius: 999px; font-size: 14px; color: var(--text-2); }
details.acct summary::-webkit-details-marker { display: none; }
details.acct summary:hover, details.acct[open] summary { background: var(--card-2); color: var(--text); }
details.acct summary svg { width: 14px; height: 14px; color: var(--faint); transition: transform .15s; }
details.acct[open] summary svg { transform: rotate(180deg); }
details.acct .menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 230px; padding: 6px; border-radius: 14px; background: #14151B; box-shadow: 0 18px 50px #000c, 0 0 0 1px #ffffff12; z-index: 20; display: flex; flex-direction: column; }
details.acct .menu .who { display: flex; flex-direction: column; padding: 8px 10px 10px; font-size: 14px; border-bottom: 1px solid #ffffff0f; margin-bottom: 4px; overflow-wrap: anywhere; }
details.acct .menu .who .faint { font-size: 12px; }
details.acct .menu a, details.acct .menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; border-radius: 9px; background: none; color: var(--text-2); font: inherit; font-size: 14px; text-decoration: none; cursor: pointer; text-align: left; }
details.acct .menu a:hover, details.acct .menu button:hover { background: var(--card-2); color: var(--text); }
details.acct .menu svg { width: 15px; height: 15px; }
details.acct .menu form button:hover { color: var(--red); }

/* Agents gone: each row links to the project, the trash deletes it. */
.gone-row { display: flex; align-items: center; gap: 4px; }
.gone-row > a.item { flex: 1; min-width: 0; }
.card.attention .list a.item:hover { background: var(--amber-ring); }
.btn.trash { color: var(--muted); background: transparent; }
.btn.trash:hover { color: var(--red); background: var(--red-bg); }

/* The confirm popup data-confirm forms open, in place of the browser's confirm(). */
dialog.confirm { border: 0; padding: 24px; width: min(420px, calc(100vw - 32px)); border-radius: var(--r); background: var(--card); color: var(--text); box-shadow: inset 0 0 0 1px #FFFFFF14, 0 24px 60px #000A; }
dialog.confirm::backdrop { background: #0008; backdrop-filter: blur(4px); }
dialog.confirm p { margin: 0 0 20px; line-height: 1.5; }
dialog.confirm .row { justify-content: flex-end; gap: 8px; }

/* Work log: token bars, diffs, search hits */
.bars { display: flex; align-items: flex-end; gap: 4px; height: 140px; }
.bars .bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; min-width: 0; }
.bars .col { flex: 1; width: 100%; max-width: 28px; display: flex; flex-direction: column; justify-content: flex-end; border-radius: 6px; overflow: hidden; background: var(--card-2); }
.bars .bar > span { font-size: 11px; white-space: nowrap; }
.bars .claude, .swatch.claude { background: #A98BFF; }
.bars .codex, .swatch.codex { background: var(--teal); }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
pre.diff { margin: 10px 0 0; background: var(--card-2); border-radius: 12px; padding: 12px 14px; font-family: var(--mono); font-size: 12px; line-height: 1.55; overflow-x: auto; max-height: 520px; }
pre.diff .add { color: var(--teal); }
pre.diff .del { color: var(--red); }
pre.diff .hunk { color: var(--muted); }
details.diff-item { display: block; padding: 12px; border-radius: 14px; }
details.diff-item:hover { background: var(--card-2); }
mark { background: #A98BFF33; color: var(--text); border-radius: 3px; padding: 0 2px; }
