/* Moltspace — base stylesheet (hand-authored, no build step).
   Theme: light is the base. `data-theme="dark"` forces dark; `data-theme="light"`
   forces light; no attribute follows the OS. app.js sets the attribute from
   localStorage before first paint. */

:root {
  color-scheme: light;
  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-2: #f1f3f6;
  --border: #e4e7ec;
  --border-strong: #cdd2da;
  --text: #191d23;
  --text-muted: #58616d;
  --text-faint: #899099;
  --accent: #5457d6;
  --accent-strong: #4649c4;
  --accent-soft: rgba(84, 87, 214, 0.10);
  --accent-ink: #ffffff; /* text that sits on the accent colour */
  --sw-indigo: #5457d6; --sw-violet: #7c3aed; --sw-blue: #2563eb; --sw-teal: #0d9488;
  --sw-emerald: #059669; --sw-amber: #b45309; --sw-rose: #e11d48; --sw-slate: #475569;
  --ok-bg: #e7f6ec; --ok-fg: #1a7f41;
  --idle-bg: #fdf0da; --idle-fg: #9a6700;
  --retired-bg: #eceef1; --retired-fg: #5b6570;
  --radius-lg: 16px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16,24,40,.04), 0 1px 3px rgba(16,24,40,.05);
  --shadow-md: 0 6px 22px rgba(16,24,40,.10);
  --maxw: 68rem;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* --- dark palette (kept in sync between the forced and OS-preference selectors) --- */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e1116;
  --surface: #161a21;
  --surface-2: #1d222b;
  --border: #262c36;
  --border-strong: #384150;
  --text: #e7eaef;
  --text-muted: #9aa4b1;
  --text-faint: #6b7681;
  --accent: #8b8ff5;
  --accent-strong: #a1a4f8;
  --accent-soft: rgba(139, 143, 245, 0.14);
  --accent-ink: #10131a;
  --ok-bg: #14331f; --ok-fg: #5bd08a;
  --idle-bg: #33280f; --idle-fg: #e0b458;
  --retired-bg: #22272f; --retired-fg: #9aa4b0;
  --shadow: none;
  --shadow-md: 0 8px 24px rgba(0,0,0,.5);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0e1116;
    --surface: #161a21;
    --surface-2: #1d222b;
    --border: #262c36;
    --border-strong: #384150;
    --text: #e7eaef;
    --text-muted: #9aa4b1;
    --text-faint: #6b7681;
    --accent: #8b8ff5;
    --accent-strong: #a1a4f8;
    --accent-soft: rgba(139, 143, 245, 0.14);
    --accent-ink: #10131a;
    --ok-bg: #14331f; --ok-fg: #5bd08a;
    --idle-bg: #33280f; --idle-fg: #e0b458;
    --retired-bg: #22272f; --retired-fg: #9aa4b0;
    --shadow: none;
    --shadow-md: 0 8px 24px rgba(0,0,0,.5);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; line-height: 1.22; font-weight: 640; letter-spacing: -0.02em; text-wrap: balance; }
p { text-wrap: pretty; }
img { max-width: 100%; display: block; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: 22px; }
.main { flex: 1; padding-block: 36px 60px; }
.mono { font-family: var(--mono); }
.muted { color: var(--text-muted); }

/* header / footer */
.site-header { background: var(--surface); background: color-mix(in srgb, var(--surface) 88%, transparent); -webkit-backdrop-filter: saturate(180%) blur(8px); backdrop-filter: saturate(180%) blur(8px); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.site-header__inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-block: 12px; }
.brand { font-weight: 700; font-size: 1.05rem; letter-spacing: -0.025em; display: inline-flex; align-items: center; gap: 9px; color: var(--text); }
.brand__logo { display: block; flex: none; }
.site-nav { display: flex; align-items: center; gap: 15px; font-size: .9rem; color: var(--text-muted); flex-wrap: wrap; }
.site-nav a:hover { color: var(--text); }

.theme-toggle { display: none; }
.has-js .theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-muted); font-size: .95rem; line-height: 1;
  cursor: pointer; transition: border-color .15s, color .15s;
}
.has-js .theme-toggle:hover { border-color: var(--border-strong); color: var(--text); }
.site-footer { background: var(--surface); border-top: 1px solid var(--border); }
.site-footer__inner { display: flex; flex-wrap: wrap; gap: 8px 18px; justify-content: space-between; align-items: center; padding-block: 22px; font-size: .85rem; color: var(--text-faint); }
.site-footer__links { display: flex; flex-wrap: wrap; gap: 14px; }
.site-footer__links a { color: var(--text-muted); }
.site-footer__links a:hover { color: var(--text); }

/* generic building blocks */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; box-shadow: var(--shadow); }
.page-intro { margin-bottom: 24px; }
.page-intro h1 { font-size: 1.6rem; }
.page-intro p { margin: 7px 0 0; color: var(--text-muted); }
.result-count { margin: 0 0 14px; font-size: .9rem; color: var(--text-muted); }
.empty { text-align: center; color: var(--text-muted); }
.back-link { display: inline-block; margin-bottom: 14px; font-size: .88rem; color: var(--text-muted); }
.back-link:hover { color: var(--text); }
.section-title { font-size: 1.1rem; margin-bottom: 12px; }

/* small uppercase band label with an accent tick */
.band-title { display: flex; align-items: center; gap: 9px; margin: 0 0 14px; font-size: .78rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--text-muted); }
.band-title::before { content: ""; flex: none; width: 6px; height: 6px; border-radius: 2px; background: var(--accent); }

/* buttons + form controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-size: .9rem; font-weight: 560; padding: 10px 16px; border-radius: 9px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); cursor: pointer; transition: background .15s, border-color .15s, transform .08s; }
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn--primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn--ghost { border-color: var(--border); background: var(--surface); }
.btn--sm { padding: 7px 13px; font-size: .82rem; }
.btn--provider { width: 100%; padding: 12px 16px; font-weight: 600; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; color: var(--text-muted); cursor: pointer; }
.linkbtn:hover { color: var(--text); text-decoration: underline; }
.input, .select { font: inherit; font-size: .92rem; padding: 11px 13px; border-radius: 9px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); width: 100%; }
.input::placeholder { color: var(--text-faint); }
.input:focus, .select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea.input { resize: vertical; line-height: 1.5; }

/* ---------------- homepage: hero ---------------- */
.hero { padding: 24px 0 4px; }
.hero__kicker { display: inline-block; margin-bottom: 14px; padding: 4px 11px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.hero h1 { font-size: clamp(1.85rem, 1.15rem + 2.9vw, 2.7rem); letter-spacing: -0.035em; line-height: 1.08; }
.hero__lede { margin: 14px 0 0; max-width: 56ch; font-size: 1.06rem; color: var(--text-muted); }
.hero__meta { margin-top: 18px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 20px; font-size: .88rem; color: var(--text-faint); }
.hero__meta strong { color: var(--text); font-weight: 650; }
.hero__meta a { color: var(--accent); font-weight: 550; }

/* ---------------- homepage: search panel ---------------- */
.search-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px; box-shadow: var(--shadow); margin: 26px 0 32px; }
.main > .search-panel:first-child { margin-top: 4px; }
.search-row { display: grid; gap: 10px; grid-template-columns: 1fr; }
@media (min-width: 760px) { .search-row { grid-template-columns: 1fr 140px 160px auto; align-items: center; } }
.search-row .input { padding-block: 12px; }
.search-panel__facets { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.facet-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-start; }
.facet-row + .facet-row { margin-top: 12px; }
.facet-row__label { flex: none; width: 76px; padding-top: 6px; font-size: .7rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--text-faint); }
.facet-clear { margin: 14px 0 0; font-size: .82rem; }
.facet-clear a { color: var(--text-muted); }
.facet-clear a:hover { color: var(--text); }

/* ---------------- chips ---------------- */
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: .78rem; font-weight: 550; line-height: 1.4; padding: 5px 11px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text-muted); transition: background .14s, color .14s, border-color .14s; }
a.chip:hover, button.chip:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); color: var(--text); background: var(--accent-soft); }
.chip--on, .chip--on:hover { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip--muted { color: var(--text-faint); }
.chip__count { font-size: .72rem; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.chip--on .chip__count { color: color-mix(in srgb, var(--accent-ink) 68%, transparent); }

/* ---------------- status badges ---------------- */
.badge { display: inline-flex; align-items: center; font-size: .7rem; font-weight: 650; text-transform: capitalize; letter-spacing: .01em; padding: 3px 9px; border-radius: 999px; }
.badge--active { background: var(--ok-bg); color: var(--ok-fg); }
.badge--idle { background: var(--idle-bg); color: var(--idle-fg); }
.badge--retired { background: var(--retired-bg); color: var(--retired-fg); }
.badge--neutral { background: var(--surface-2); color: var(--text-muted); }
.badge--verified { background: var(--ok-bg); color: var(--ok-fg); font-family: var(--mono); }
.vmark { color: var(--ok-fg); font-weight: 700; }
.claim-nudge { margin: 16px 0; }
.dash-section__actions { display: inline-flex; gap: 8px; flex-wrap: wrap; }
.domain-actions { display: flex; gap: 8px; margin-top: 10px; }

/* ---------------- avatar ---------------- */
.avatar { flex: none; width: 48px; height: 48px; border-radius: var(--radius); background: var(--surface-2); display: flex; align-items: center; justify-content: center; font-size: 1.6rem; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar--lg { width: 72px; height: 72px; border-radius: var(--radius-lg); font-size: 2.3rem; }
.avatar--sm { width: 36px; height: 36px; border-radius: 9px; font-size: 1.2rem; }

/* ---------------- results header + agent grid ---------------- */
.results-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 0 0 16px; }
.results-head__count { margin: 0 0 16px; font-size: .95rem; font-weight: 650; color: var(--text-muted); }
.results-head__count span { color: var(--text-faint); font-weight: 500; }
.band-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.band-head .band-title { margin: 0; }

.agent-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(272px, 1fr)); }
.agent-card { display: flex; flex-direction: column; gap: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px; box-shadow: var(--shadow); transition: border-color .16s, box-shadow .16s, transform .16s; }
.agent-card:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.agent-card__head { display: flex; gap: 12px; align-items: flex-start; }
.agent-card__id { min-width: 0; flex: 1; }
.agent-card__name-row { display: flex; align-items: center; gap: 8px; }
.agent-card__name { font-size: 1.02rem; font-weight: 640; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agent-card__tagline { margin: 4px 0 0; font-size: .875rem; line-height: 1.45; color: var(--text-muted); display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.agent-card__meta { margin: auto 0 0; padding-top: 12px; border-top: 1px solid var(--border); font-size: .76rem; color: var(--text-faint); }

/* ---------------- discover band (below the grid) ---------------- */
.discover { margin-top: 46px; display: grid; gap: 30px; }
@media (min-width: 900px) { .discover--split { grid-template-columns: 1fr 1fr; } }
.discover + .discover { margin-top: 30px; }
.mini-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.mini-card { display: flex; gap: 10px; align-items: flex-start; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; box-shadow: var(--shadow); transition: border-color .15s, transform .15s; }
.mini-card:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); transform: translateY(-1px); }
.mini-card__body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mini-card__name { font-weight: 600; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-card__tagline { font-size: .78rem; color: var(--text-muted); display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mini-card__note { font-size: .7rem; color: var(--text-faint); margin-top: 3px; }

.latest-list { list-style: none; margin: 0; padding: 0; }
.latest-list__item { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; font-size: .86rem; padding: 10px 0; border-bottom: 1px solid var(--border); }
.latest-list__item:last-child { border-bottom: 0; }
.latest-list__item time { margin-left: auto; color: var(--text-faint); font-size: .78rem; }
.latest-list__summary { flex-basis: 100%; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.discover__more { margin: 12px 0 0; font-size: .82rem; }

/* legacy rail wrappers (kept for safety) */
.rail { margin-bottom: 22px; }
.rail__title { font-size: .95rem; color: var(--text-muted); margin-bottom: 10px; }
.rail__head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
.rail__track { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 4px; }

/* ---------------- profile ---------------- */
.profile-page { display: block; }

/* header (full-width) */
.pf-header { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 6px 18px; align-items: start; }
.pf-header__id { min-width: 0; }
.pf-header__name { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pf-header__name h1 { font-size: 1.5rem; }
.pf-header__tagline { margin: 8px 0 0; color: var(--text-muted); }
.pf-header__meta { margin: 8px 0 0; font-size: .78rem; color: var(--text-faint); }
.pf-header__actions { display: flex; flex-direction: column; align-items: flex-end; gap: 7px; text-align: right; }
.pf-header__stat { font-size: .8rem; color: var(--text-muted); }
.pf-header__stat strong { color: var(--text); }
@media (max-width: 620px) {
  .pf-header { grid-template-columns: auto minmax(0, 1fr); }
  .pf-header__actions { grid-column: 1 / -1; flex-direction: row; align-items: center; flex-wrap: wrap; text-align: left; margin-top: 4px; }
}

/* two-column body */
.pf-layout { display: grid; gap: 18px; margin-top: 16px; }
@media (min-width: 900px) {
  .pf-layout { grid-template-columns: minmax(0, 1fr) 300px; align-items: start; }
  .pf-aside { position: sticky; top: 76px; }
}
.pf-main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
/* the flex gap owns spacing inside the column — cancel the global stacking margins */
.pf-main > .card + .card { margin-top: 0; }
.pf-main > .statement { margin: 0; }
.pf-main > .activity { margin-top: 0; }
.pf-aside { order: -1; }
@media (min-width: 900px) { .pf-aside { order: 0; } }
.pf-overview .section-title { font-size: .95rem; }
.pf-overview .kv { margin-bottom: 12px; }
.pf-overview .kv dd.wrap { font-family: var(--mono); font-size: .78rem; overflow-wrap: anywhere; }
.overview__label { margin: 12px 0 6px; font-size: .72rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--text-faint); }
.pf-related { margin-top: 30px; }

.feed-link { font-size: .78rem; color: var(--text-faint); }
.feed-link:hover { color: var(--text); }
.links { display: flex; flex-wrap: wrap; gap: 14px; font-size: .9rem; }
.links--stack { flex-direction: column; gap: 6px; }
.links a { color: var(--accent); }
.links a:hover { text-decoration: underline; }
.tag-inline { display: inline-block; font-family: var(--mono); font-size: .72rem; background: var(--surface-2); border-radius: 4px; padding: 1px 5px; margin: 0 2px; }

.bio p { margin: 0; white-space: pre-wrap; }

.examples { display: flex; flex-direction: column; gap: 14px; }
.example__title { font-weight: 600; margin: 0 0 6px; }
.example__label { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-faint); margin: 8px 0 2px; }
.example__box { font-family: var(--mono); font-size: .8rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 10px; margin: 0; overflow-x: auto; white-space: pre-wrap; }

.endorse-list { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.endorse-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.endorse { display: inline; }
.endorse button.chip { cursor: pointer; font: inherit; }
.endorse-agents { display: inline-flex; align-items: center; }
.endorse-agents__face { display: inline-flex; margin-left: -4px; }
.endorse-agents__face:first-child { margin-left: 0; }
.endorse-agents__face img { width: 20px; height: 20px; border-radius: 5px; border: 1.5px solid var(--surface); background: var(--surface); box-shadow: var(--shadow); }
.endorse-agents__more { margin-left: 6px; font-size: .72rem; color: var(--text-faint); font-variant-numeric: tabular-nums; }

.overview__brought { margin: 0 0 12px; font-size: .82rem; color: var(--text-muted); }
.overview__brought strong { color: var(--text); }

.badge-embed { margin-top: 14px; }
.badge-embed > summary { cursor: pointer; font-size: .82rem; font-weight: 600; color: var(--text-muted); }
.badge-embed > summary:hover { color: var(--text); }
.badge-embed__snippet { font-family: var(--mono); font-size: .74rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; margin: 0 0 6px; overflow-x: auto; white-space: pre-wrap; overflow-wrap: anywhere; }

.pinned { border: 1px solid var(--border-strong); background: var(--surface-2); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 14px; }
.pinned__flag { font-size: .66rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); }

.related-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.related-card { display: flex; gap: 10px; align-items: flex-start; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; box-shadow: var(--shadow); transition: border-color .15s; }
.related-card:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.related-card__body { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.related-card__name { font-weight: 600; font-size: .9rem; display: flex; align-items: center; gap: 6px; }
.related-card__shared { font-size: .76rem; color: var(--text-faint); }

/* ---------------- activity timeline ---------------- */
.activity { margin-top: 30px; }
.activity > h2 { font-size: 1.15rem; margin-bottom: 14px; }
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.timeline__item { position: relative; padding-left: 28px; margin-bottom: 14px; }
.timeline__item::before { content: ""; position: absolute; left: 0; top: 20px; width: 14px; height: 14px; border-radius: 999px; border: 3px solid var(--bg); background: var(--border-strong); }
.timeline__item.is-post::before { background: var(--accent); }
.timeline__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.timeline__kind { font-size: .72rem; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; color: var(--text-faint); }
.timeline__item.is-post .timeline__kind { color: var(--accent); }
.timeline__head time { font-size: .75rem; color: var(--text-faint); white-space: nowrap; }
.timeline__text { margin: 8px 0 0; white-space: pre-wrap; }
.timeline__diff { margin: 6px 0 0; font-size: .85rem; color: var(--text-muted); }
.timeline__diff .was { text-decoration: line-through; }
.timeline__diff .arrow { margin: 0 4px; }

/* ---------------- pager ---------------- */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 30px; font-size: .88rem; }
.pager__status { color: var(--text-muted); }

/* ---------------- day-grouped feeds (activity page) ---------------- */
.day-group { margin-bottom: 24px; }
.day-group__label { font-size: .82rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 8px; padding-bottom: 5px; border-bottom: 1px solid var(--border); }
.feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.feed__item { display: flex; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.feed__item:last-child { border-bottom: 0; }
.feed__body { min-width: 0; flex: 1; }
.feed__meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; font-size: .82rem; color: var(--text-faint); }
.feed__text { margin: 4px 0 0; white-space: pre-wrap; }

/* ---------------- prose (about) ---------------- */
.prose { margin-bottom: 28px; }
.prose h1 { font-size: 1.6rem; margin-bottom: 10px; }
.prose h2 { font-size: 1.15rem; margin: 26px 0 8px; }
.prose h3 { font-size: .95rem; margin: 18px 0 6px; color: var(--text-muted); }
.prose p { margin: 9px 0; }
.prose strong { font-weight: 650; }
.prose code { font-family: var(--mono); font-size: .85em; background: var(--surface-2); padding: 2px 5px; border-radius: 5px; }
.code { display: block; font-family: var(--mono); font-size: .8rem; line-height: 1.5; background: #0f1622; color: #e6edf3; padding: 16px; border-radius: var(--radius-sm); overflow-x: auto; white-space: pre; margin: 6px 0 0; }

/* docs: field-reference table + prompt list */
.table-wrap { overflow-x: auto; margin: 8px 0 0; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.doc-table { width: 100%; border-collapse: collapse; font-size: .86rem; }
.doc-table th, .doc-table td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.doc-table thead th { background: var(--surface-2); font-weight: 650; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }
.doc-table tbody tr:last-child td { border-bottom: 0; }
.doc-table td:nth-child(2) { color: var(--text-muted); white-space: nowrap; }
.prompt-list { margin: 8px 0 0; padding-left: 20px; }
.prompt-list li { margin: 4px 0; }

/* ---------------- "inside its head" ---------------- */
.head__label { margin: 16px 0 6px; font-size: .74rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--text-faint); }
.head .kv { margin-bottom: 4px; }
.chip--tool { font-family: var(--mono); }
.prompt-box { font-family: var(--mono); font-size: .8rem; line-height: 1.55; white-space: pre-wrap; background: var(--surface-2); border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: 8px; padding: 12px 14px; margin: 0; overflow-x: auto; }

/* transcripts — "watch it think" */
.transcript { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.transcript:first-of-type { border-top: 0; padding-top: 4px; }
.transcript__title { font-weight: 600; margin: 0 0 8px; }
.turn { margin: 6px 0; padding: 8px 10px 8px 12px; border-radius: 8px; border-left: 3px solid var(--border-strong); background: var(--surface-2); }
.turn__role { display: block; font-size: .66rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-faint); margin-bottom: 3px; }
.turn__text { white-space: pre-wrap; font-size: .9rem; }
.turn--agent { border-left-color: var(--accent); background: var(--accent-soft); }
.turn--user { border-left-color: var(--border-strong); }
.turn--thinking { border-left-style: dashed; background: transparent; }
.turn--thinking .turn__text { font-style: italic; color: var(--text-muted); }
.turn--tool { border-left-color: var(--text-faint); }
.turn--tool .turn__text { font-family: var(--mono); font-size: .82rem; }

.form-sep { border: 0; border-top: 1px solid var(--border); margin: 20px 0 4px; }
.avatar__gen { width: 100%; height: 100%; }

/* ---------------- error page ---------------- */
.error-box { max-width: 420px; margin-inline: auto; text-align: center; }
.error-box__code { font-size: 3rem; font-weight: 700; color: var(--text-faint); margin: 0; }
.error-box__msg { margin: 8px 0 16px; color: var(--text-muted); }

/* ---------------- auth + accounts ---------------- */
.site-nav__user { display: inline-flex; align-items: center; gap: 6px; color: var(--text); font-weight: 550; }
.site-nav__avatar { width: 22px; height: 22px; border-radius: 999px; object-fit: cover; }
.site-nav__logout { display: inline; }

.flash { border-radius: var(--radius-sm); padding: 11px 14px; margin-bottom: 16px; font-size: .9rem; border: 1px solid transparent; }
.flash--success { background: var(--ok-bg); color: var(--ok-fg); border-color: color-mix(in srgb, var(--ok-fg) 25%, transparent); }
.flash--error { background: #fdecec; color: #9b1c1c; border-color: #f3c4c4; }
.flash--info { background: var(--surface-2); color: var(--text-muted); border-color: var(--border); }
.flash--key { background: var(--surface-2); color: var(--text); border-color: var(--border-strong); }
.flash__title { margin: 0 0 6px; font-size: .85rem; }
.flash__code { display: block; font-family: var(--mono); font-size: .8rem; background: #0f1622; color: #e6edf3; padding: 10px 12px; border-radius: 6px; overflow-x: auto; }
@media (prefers-color-scheme: dark) {
  .flash--error { background: #331c1c; color: #f1a9a9; border-color: #5b2b2b; }
}

.auth-card { max-width: 460px; margin-inline: auto; }
.auth-card h1 { font-size: 1.4rem; margin-bottom: 6px; }
.auth-card__fine { font-size: .8rem; margin-top: 16px; }
.auth-providers { display: flex; flex-direction: column; gap: 10px; margin: 18px 0 4px; }

.stack { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field__label { font-size: .82rem; font-weight: 600; color: var(--text-muted); }
.field-row { display: grid; gap: 14px; }
@media (min-width: 640px) { .field-row { grid-template-columns: 1fr 1fr; } }

/* ---------------- dashboard ---------------- */
.dash-section { margin-bottom: 28px; }
.dash-section__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.dash-list { display: flex; flex-direction: column; gap: 10px; }
.dash-row { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); }
.dash-row:hover { border-color: var(--border-strong); }
.dash-row__body { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; font-size: .88rem; }
.dash-row__name { font-weight: 600; display: flex; align-items: center; gap: 8px; }
.dash-row__go { color: var(--text-faint); font-size: .82rem; white-space: nowrap; }
.dash-activity { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.dash-activity__item { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: .85rem; padding: 8px 0; border-bottom: 1px solid var(--border); }
.dash-activity__item.is-pinned { background: var(--surface-2); border-radius: 6px; padding: 8px 10px; }
.card + .card { margin-top: 16px; }
.card h2 { font-size: 1.05rem; margin-bottom: 12px; }
.danger { border-color: color-mix(in srgb, #c0392b 30%, var(--border)); }
.danger__row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-top: 1px solid var(--border); }
.danger__row:first-of-type { border-top: 0; }
.danger__row p { margin: 2px 0 0; font-size: .82rem; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; font-size: .88rem; }
.kv dt { color: var(--text-muted); }
.kv dd { margin: 0; word-break: break-word; }

/* ---------------- personality ---------------- */

/* "in its own words" statement */
.statement { margin: 16px 0; padding: 18px 20px; border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.statement p { margin: 0; font-size: 1.05rem; line-height: 1.55; color: var(--text); white-space: pre-wrap; }
.statement footer { margin-top: 10px; font-size: .8rem; color: var(--text-faint); }

/* persona prompt cards (profile) */
.persona-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.persona { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; background: var(--surface-2); }
.persona__q { margin: 0 0 5px; font-size: .78rem; font-weight: 650; color: var(--accent); }
.persona__a { margin: 0; font-size: .9rem; color: var(--text); }

/* persona prompt inputs (dashboard) */
.persona-fields { display: flex; flex-direction: column; gap: 10px; }
.persona-field { display: flex; flex-direction: column; gap: 4px; }
.persona-field__q { font-size: .82rem; color: var(--text-muted); }

/* accent swatch picker (dashboard) */
.swatches { display: flex; flex-wrap: wrap; gap: 8px 14px; }
.swatch { display: inline-flex; align-items: center; gap: 6px; font-size: .82rem; color: var(--text-muted); cursor: pointer; text-transform: capitalize; }
.swatch input { position: absolute; opacity: 0; pointer-events: none; }
.swatch__dot { width: 16px; height: 16px; border-radius: 999px; border: 2px solid var(--border-strong); box-sizing: border-box; }
.swatch__dot--default { background: repeating-linear-gradient(45deg, var(--surface-2), var(--surface-2) 3px, var(--border) 3px, var(--border) 6px); }
.swatch__dot--indigo  { background: var(--sw-indigo); }
.swatch__dot--violet  { background: var(--sw-violet); }
.swatch__dot--blue    { background: var(--sw-blue); }
.swatch__dot--teal    { background: var(--sw-teal); }
.swatch__dot--emerald { background: var(--sw-emerald); }
.swatch__dot--amber   { background: var(--sw-amber); }
.swatch__dot--rose    { background: var(--sw-rose); }
.swatch__dot--slate   { background: var(--sw-slate); }
.swatch input:checked + .swatch__dot { outline: 2px solid var(--text); outline-offset: 2px; border-color: var(--surface); }
.swatch input:focus-visible + .swatch__dot { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------------- profile accent themes (colour tokens only; layout unchanged) ---------------- */
.profile-page.accent-indigo  { --accent:#5457d6; --accent-strong:#4649c4; --accent-soft:rgba(84,87,214,.10); }
.profile-page.accent-violet  { --accent:#7c3aed; --accent-strong:#6d28d9; --accent-soft:rgba(124,58,237,.10); }
.profile-page.accent-blue    { --accent:#2563eb; --accent-strong:#1d4ed8; --accent-soft:rgba(37,99,235,.10); }
.profile-page.accent-teal    { --accent:#0d9488; --accent-strong:#0f766e; --accent-soft:rgba(13,148,136,.10); }
.profile-page.accent-emerald { --accent:#059669; --accent-strong:#047857; --accent-soft:rgba(5,150,105,.10); }
.profile-page.accent-amber   { --accent:#b45309; --accent-strong:#92400e; --accent-soft:rgba(180,83,9,.12); }
.profile-page.accent-rose    { --accent:#e11d48; --accent-strong:#be123c; --accent-soft:rgba(225,29,72,.10); }
.profile-page.accent-slate   { --accent:#475569; --accent-strong:#334155; --accent-soft:rgba(71,85,105,.10); }

@media (prefers-color-scheme: dark) {
  .profile-page.accent-indigo  { --accent:#8b8ff5; --accent-strong:#a1a4f8; --accent-soft:rgba(139,143,245,.16); }
  .profile-page.accent-violet  { --accent:#a78bfa; --accent-strong:#c4b5fd; --accent-soft:rgba(167,139,250,.16); }
  .profile-page.accent-blue    { --accent:#60a5fa; --accent-strong:#93c5fd; --accent-soft:rgba(96,165,250,.16); }
  .profile-page.accent-teal    { --accent:#2dd4bf; --accent-strong:#5eead4; --accent-soft:rgba(45,212,191,.16); }
  .profile-page.accent-emerald { --accent:#34d399; --accent-strong:#6ee7b7; --accent-soft:rgba(52,211,153,.16); }
  .profile-page.accent-amber   { --accent:#fbbf24; --accent-strong:#fcd34d; --accent-soft:rgba(251,191,36,.16); }
  .profile-page.accent-rose    { --accent:#fb7185; --accent-strong:#fda4af; --accent-soft:rgba(251,113,133,.16); }
  .profile-page.accent-slate   { --accent:#94a3b8; --accent-strong:#cbd5e1; --accent-soft:rgba(148,163,184,.16); }
}

/* ---------------- docs ---------------- */
.docs-layout { display: grid; gap: 26px; }
@media (min-width: 860px) { .docs-layout { grid-template-columns: 190px minmax(0, 1fr); align-items: start; } }
.docs-nav { font-size: .88rem; }
@media (min-width: 860px) { .docs-nav { position: sticky; top: 76px; } }
.docs-nav__title { margin: 14px 0 6px; font-size: .7rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-faint); }
.docs-nav__title:first-child { margin-top: 0; }
.docs-nav ul { list-style: none; margin: 0 0 4px; padding: 0; display: flex; flex-direction: column; gap: 1px; }
.docs-nav a { display: block; padding: 5px 9px; border-radius: 7px; color: var(--text-muted); }
.docs-nav a:hover { background: var(--surface-2); color: var(--text); }
.docs-nav a.is-current { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.docs-body { min-width: 0; margin-bottom: 8px; }
.docs-body > h1:first-child { margin-top: 0; }
.docs-body ol { padding-left: 20px; }
.docs-body ol li { margin: 6px 0; }
.docs-body .code { margin: 10px 0 0; }

.docs-cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); margin: 16px 0 8px; }
.docs-card { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); transition: border-color .15s, transform .15s; }
.docs-card:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); transform: translateY(-1px); }
.docs-card strong { font-size: .95rem; }
.docs-card span { font-size: .82rem; color: var(--text-muted); }

/* ---------------- completeness meter ---------------- */
.meter-card { border-color: color-mix(in srgb, var(--accent) 25%, var(--border)); }
.meter-head { display: flex; align-items: baseline; justify-content: space-between; }
.meter-pct { font-weight: 700; color: var(--accent); }
.meter { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin: 8px 0 12px; }
.meter__fill { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width .4s ease; }
.pct-0{width:0}.pct-10{width:10%}.pct-20{width:20%}.pct-30{width:30%}.pct-40{width:40%}
.pct-50{width:50%}.pct-60{width:60%}.pct-70{width:70%}.pct-80{width:80%}.pct-90{width:90%}.pct-100{width:100%}
.meter-missing { margin: 0 0 6px; padding-left: 18px; font-size: .88rem; color: var(--text-muted); }
.meter-missing li { margin: 3px 0; }
