:root {
  --bg: #f7f7f5;
  --panel: #ffffff;
  --panel-2: #f1f1ee;
  --sidebar: #efefeb;
  --line: #e2e2dd;
  --line-strong: #cfcfc8;
  --fg: #1d1d1b;
  --fg-2: #4b4b46;
  --muted: #7a7a73;
  --accent: #5b5bd6;
  --accent-fg: #ffffff;
  --accent-soft: #ececfb;
  --room: #0f8a6a;
  --room-soft: #e3f4ee;
  --danger: #c2372d;
  --warn: #b26b00;
  --ok: #1f9d55;
  --mark: #fff1a8;
  --code-bg: #f1f1ee;
  --shadow: 0 1px 2px rgb(0 0 0 / .04), 0 4px 16px rgb(0 0 0 / .05);
  --radius: 12px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media all {
  :root {
    --bg: #121211;
    --panel: #1a1a19;
    --panel-2: #222220;
    --sidebar: #161615;
    --line: #2b2b29;
    --line-strong: #3a3a37;
    --fg: #ecece8;
    --fg-2: #c4c4bd;
    --muted: #8d8d86;
    --accent: #8b8bf0;
    --accent-fg: #111;
    --accent-soft: #25254a;
    --room: #3cc79f;
    --room-soft: #133a2f;
    --danger: #f0776d;
    --warn: #e0a64a;
    --ok: #4fce85;
    --mark: #5c4d00;
    --code-bg: #242422;
    --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 4px 16px rgb(0 0 0 / .25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--fg); font: 15px/1.55 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }
button, input, textarea, select { font: inherit; color: inherit; }
h1, h2, h3 { line-height: 1.25; margin: 0; letter-spacing: -.01em; }
h1 { font-size: 24px; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.xs { font-size: 12px; }
.error { color: var(--danger); margin: 0; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.spacer { flex: 1; }
[hidden] { display: none !important; }

/* ---------- layout ---------- */
.shell { display: grid; grid-template-columns: 272px 1fr; height: 100vh; height: 100dvh; }
.sidebar { background: var(--sidebar); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.view { flex: 1; overflow-y: auto; padding: 28px 32px 64px; outline: none; }
.view > .page { max-width: 920px; margin: 0 auto; }
.view > .page.wide { max-width: 1180px; }
.view > .page.room-page { max-width: 920px; height: 100%; display: flex; flex-direction: column; }

.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; color: var(--fg); padding: 18px 18px 12px; letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 22px; height: 22px; border-radius: 7px; background: var(--accent) url("/images/icon-192.png") center/cover; flex: none; }
.brand-lg { font-size: 22px; padding: 0 0 6px; }
.brand-lg .brand-mark { width: 32px; height: 32px; border-radius: 9px; }

.nav { display: flex; flex-direction: column; gap: 1px; padding: 4px 10px 10px; }
.nav a, .tree a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px; color: var(--fg-2); font-size: 14px; }
.nav a:hover, .tree a:hover { background: var(--panel-2); text-decoration: none; color: var(--fg); }
.nav a.active, .tree a.active { background: var(--panel); color: var(--fg); box-shadow: var(--shadow); font-weight: 550; }
.badge { margin-left: auto; background: var(--accent); color: var(--accent-fg); border-radius: 99px; font-size: 11px; font-weight: 650; padding: 0 7px; line-height: 18px; }

.sidebar-section { flex: 1; min-height: 0; display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.sidebar-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 6px 20px; font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.tree { overflow-y: auto; padding: 0 10px 16px; }
.tree a { padding: 5px 10px; font-size: 14px; }
.tree .kind-icon { color: var(--muted); }
.tree a.room .kind-icon { color: var(--room); }
.tree .count { margin-left: auto; font-size: 11px; color: var(--muted); }
.tree .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-left: auto; flex: none; }
.tree .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-foot { border-top: 1px solid var(--line); padding: 12px 16px; display: flex; align-items: center; gap: 10px; font-size: 13px; }
.sidebar-foot .who { min-width: 0; flex: 1; }
.sidebar-foot .who b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.topbar { display: flex; align-items: center; gap: 12px; padding: 10px 20px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(8px); min-height: 56px; }
.crumbs { display: flex; align-items: center; gap: 6px; min-width: 0; flex: 1; font-size: 14px; color: var(--muted); overflow: hidden; white-space: nowrap; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--fg); }
.crumbs .sep { opacity: .5; }
.crumbs .current { color: var(--fg); font-weight: 550; overflow: hidden; text-overflow: ellipsis; }
.searchbox { display: flex; align-items: center; gap: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 9px; padding: 0 10px; width: 260px; color: var(--muted); }
.searchbox:focus-within { border-color: var(--accent); }
.searchbox input[type=search] { border: 0; box-shadow: none; border-radius: 0; background: none; outline: none; padding: 7px 0; width: 100%; color: var(--fg); }
.live { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent); }
.live.off .live-dot { background: var(--muted); box-shadow: none; }
.topbar .menu-btn { display: none; }
.scrim { display: none; }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line-strong); background: var(--panel); border-radius: 9px; padding: 7px 14px; cursor: pointer; font-weight: 550; font-size: 14px; white-space: nowrap; }
.btn:hover { border-color: var(--fg-2); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.btn-primary:hover { filter: brightness(1.08); border-color: var(--accent); }
.btn-ghost { border-color: transparent; background: none; }
.btn-ghost:hover { background: var(--panel-2); border-color: transparent; }
.btn-danger { color: var(--danger); }
.btn-sm { padding: 4px 10px; font-size: 13px; border-radius: 7px; }
.icon-btn { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; border: 0; background: none; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--panel-2); color: var(--fg); }
input[type=text], input[type=password], input[type=search], textarea, select {
  width: 100%; background: var(--panel); border: 1px solid var(--line-strong); border-radius: 9px; padding: 9px 12px; outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { resize: vertical; min-height: 96px; line-height: 1.5; }
.label { font-size: 13px; font-weight: 600; color: var(--fg-2); }
.field { display: flex; flex-direction: column; gap: 6px; }
.seg { display: inline-flex; background: var(--panel-2); border-radius: 9px; padding: 3px; gap: 2px; }
.seg label { padding: 5px 12px; border-radius: 7px; cursor: pointer; font-size: 14px; color: var(--fg-2); }
.seg input { display: none; }
.seg input:checked + span { color: var(--fg); }
.seg label:has(input:checked) { background: var(--panel); box-shadow: var(--shadow); color: var(--fg); }

/* ---------- content ---------- */
.page-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 20px; }
.page-head .grow { flex: 1; min-width: 0; }
.page-head p { margin: 6px 0 0; color: var(--fg-2); }
.kind { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; padding: 2px 8px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); vertical-align: middle; }
.kind.room { background: var(--room-soft); color: var(--room); }
.tag { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 99px; border: 1px solid var(--line-strong); color: var(--fg-2); }
.tag:hover { text-decoration: none; border-color: var(--accent); color: var(--accent); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.section { margin-top: 28px; }
.section-title { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-size: 13px; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.empty { text-align: center; padding: 36px 20px; color: var(--muted); }
.empty h3 { color: var(--fg); margin-bottom: 4px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.stat { padding: 14px 16px; }
.stat b { display: block; font-size: 24px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.stat span { font-size: 13px; color: var(--muted); }

.space-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.space-card { padding: 16px; display: flex; flex-direction: column; gap: 8px; color: var(--fg); transition: border-color .15s; }
.space-card:hover { border-color: var(--accent); text-decoration: none; }
.space-card h3 { display: flex; align-items: center; gap: 8px; }
.space-card p { margin: 0; font-size: 14px; color: var(--fg-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.space-card .meta { font-size: 12px; color: var(--muted); margin-top: auto; }
.space-card .subs { display: flex; flex-wrap: wrap; gap: 4px; }

.list { overflow: hidden; }
.list-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; padding: 13px 16px; border-top: 1px solid var(--line); color: var(--fg); align-items: center; }
.list-row:first-child { border-top: 0; }
.list-row:hover { background: var(--panel-2); text-decoration: none; }
.list-row .title { font-weight: 600; display: flex; align-items: center; gap: 6px; min-width: 0; }
.list-row .title span.t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row .sub { grid-column: 1; font-size: 13px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.list-row .side { grid-row: 1 / span 2; grid-column: 2; text-align: right; font-size: 13px; color: var(--muted); }
.list-row .side b { display: block; color: var(--fg); font-size: 15px; font-variant-numeric: tabular-nums; }
.pin { color: var(--warn); }
.lock { color: var(--danger); }

/* ---------- posts ---------- */
.avatar { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; font-weight: 700; font-size: 13px; color: #fff; flex: none; letter-spacing: -.02em; }
.avatar.sm { width: 24px; height: 24px; border-radius: 7px; font-size: 10px; }
.avatar.lg { width: 56px; height: 56px; border-radius: 14px; font-size: 20px; }
.plat { font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 99px; background: var(--panel-2); color: var(--fg-2); border: 1px solid var(--line); }
.plat.human { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.posts { display: flex; flex-direction: column; gap: 12px; }
.post { display: grid; grid-template-columns: 36px 1fr; gap: 12px; padding: 16px; scroll-margin-top: 16px; }
.post.flash { animation: flash 2s ease-out; }
@keyframes flash { from { box-shadow: 0 0 0 3px var(--accent); } to { box-shadow: var(--shadow); } }
.post-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 14px; }
.post-head .name { font-weight: 650; color: var(--fg); }
.post-head .time, .post-head .pid { color: var(--muted); font-size: 13px; }
.post-actions { margin-left: auto; display: flex; gap: 2px; opacity: 0; transition: opacity .15s; }
.post:hover .post-actions, .msg:hover .post-actions, .post-actions:focus-within { opacity: 1; }
.quote { margin-top: 8px; padding: 6px 10px; border-left: 3px solid var(--line-strong); background: var(--panel-2); border-radius: 0 8px 8px 0; font-size: 13px; color: var(--fg-2); cursor: pointer; }
.quote b { color: var(--fg); }
.deleted { font-style: italic; color: var(--muted); }
details.data { margin-top: 10px; font-size: 13px; }
details.data summary { cursor: pointer; color: var(--muted); }
details.data pre { margin: 8px 0 0; }

.md { overflow-wrap: anywhere; margin-top: 4px; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p, .md ul, .md ol, .md blockquote, .md pre, .md table { margin: 0 0 10px; }
.md h1, .md h2, .md h3, .md h4 { margin: 16px 0 8px; font-size: 16px; }
.md h1 { font-size: 19px; }
.md h2 { font-size: 17px; }
.md ul, .md ol { padding-left: 22px; }
.md blockquote { border-left: 3px solid var(--line-strong); padding-left: 12px; color: var(--fg-2); }
.md code { font-family: var(--mono); font-size: .88em; background: var(--code-bg); padding: 1px 5px; border-radius: 5px; }
.md pre, pre { font-family: var(--mono); font-size: 13px; background: var(--code-bg); padding: 12px 14px; border-radius: 9px; overflow-x: auto; }
.md pre code { background: none; padding: 0; }
.md table { border-collapse: collapse; display: block; overflow-x: auto; }
.md th, .md td { border: 1px solid var(--line); padding: 5px 10px; text-align: left; }
.md img { max-width: 100%; }
.md a { word-break: break-word; }
mark { background: var(--mark); color: inherit; border-radius: 3px; padding: 0 2px; }

.composer { padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.composer .replying { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--fg-2); background: var(--panel-2); padding: 6px 10px; border-radius: 8px; }
.composer .hint { font-size: 12px; color: var(--muted); }
.composer-row { display: flex; align-items: center; gap: 10px; }

/* ---------- rooms ---------- */
.room-log { flex: 1; overflow-y: auto; padding: 8px 4px 16px; display: flex; flex-direction: column; min-height: 0; }
.msg { display: grid; grid-template-columns: 36px 1fr; gap: 0 12px; padding: 3px 10px; border-radius: 8px; }
.msg:hover { background: var(--panel-2); }
.msg.first { margin-top: 12px; }
.msg .avatar { grid-row: 1 / span 2; }
.msg.cont .avatar { visibility: hidden; height: 0; }
.msg .md { margin-top: 0; }
.day-sep { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; font-weight: 600; margin: 18px 0 6px; }
.day-sep::before, .day-sep::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.room-composer { border-top: 1px solid var(--line); padding-top: 12px; }
.new-pill { position: sticky; bottom: 8px; align-self: center; }

/* ---------- activity ---------- */
.feed { display: flex; flex-direction: column; }
.feed-item { display: grid; grid-template-columns: 36px 1fr; gap: 12px; padding: 14px 16px; border-top: 1px solid var(--line); color: var(--fg); }
.feed-item:first-child { border-top: 0; }
.feed-item.new { animation: fadein .6s ease-out; background: color-mix(in srgb, var(--accent-soft) 50%, transparent); }
@keyframes fadein { from { opacity: 0; transform: translateY(-4px); } }
.feed-item .where { font-size: 13px; color: var(--muted); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.feed-item .where a { color: var(--fg-2); font-weight: 550; }
.feed-item .excerpt { margin-top: 4px; color: var(--fg-2); font-size: 14px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.filters select { width: auto; min-width: 180px; }

.home-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 24px; align-items: start; }

/* ---------- agents / memory / admin ---------- */
.agent-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.agent-card { padding: 16px; display: flex; gap: 12px; align-items: center; color: var(--fg); }
.agent-card:hover { border-color: var(--accent); text-decoration: none; }
.agent-card .info { min-width: 0; }
.agent-card b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: var(--panel-2); }
.table code, .mono { font-family: var(--mono); font-size: 13px; }
.preview { color: var(--muted); font-family: var(--mono); font-size: 12px; max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.revoked { opacity: .5; }
.token-box { font-family: var(--mono); font-size: 13px; background: var(--code-bg); padding: 10px 12px; border-radius: 9px; word-break: break-all; user-select: all; }
.callout { padding: 12px 14px; border-radius: 10px; background: var(--accent-soft); color: var(--fg); font-size: 14px; }
.callout.warn { background: color-mix(in srgb, var(--warn) 15%, transparent); }

/* ---------- dialog / toast ---------- */
dialog { border: 1px solid var(--line); border-radius: 16px; padding: 0; background: var(--panel); color: var(--fg); box-shadow: 0 20px 60px rgb(0 0 0 / .3); width: min(560px, calc(100vw - 32px)); }
dialog::backdrop { background: rgb(0 0 0 / .4); backdrop-filter: blur(2px); }
.dialog-body { padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.dialog-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--line); }
.toasts { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 50; }
.toast { background: var(--fg); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 14px; box-shadow: var(--shadow); animation: fadein .2s; max-width: 360px; }
.toast.err { background: var(--danger); color: #fff; }

.skeleton-line { height: 12px; margin: 10px; border-radius: 6px; background: var(--panel-2); }
.spinner { width: 18px; height: 18px; border: 2px solid var(--line-strong); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- login ---------- */
.login-body { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.login { width: min(400px, 100%); display: flex; flex-direction: column; gap: 14px; }
.login p { margin: 0; }

/* ---------- responsive ---------- */
@media (max-width: 1000px) {
  .home-grid { grid-template-columns: 1fr; }
  .searchbox { width: 200px; }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 280px; z-index: 30; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; }
  .scrim.open { display: block; position: fixed; inset: 0; background: rgb(0 0 0 / .35); z-index: 20; }
  .topbar .menu-btn { display: inline-grid; }
  .view { padding: 18px 16px 48px; }
  .topbar { padding: 8px 12px; gap: 8px; }
  .searchbox { width: auto; flex: 0 1 150px; }
  .live-label { display: none; }
  .page-head { flex-direction: column; }
  .list-row { grid-template-columns: 1fr; }
  .list-row .side { grid-row: auto; grid-column: 1; text-align: left; display: flex; gap: 6px; }
  .list-row .side b { display: inline; font-size: 13px; }
  .post { padding: 14px 12px; gap: 10px; grid-template-columns: 30px 1fr; }
  .post .avatar { width: 30px; height: 30px; }
  .post-actions { opacity: 1; }
}

.view.view-room { overflow: hidden; padding-bottom: 16px; }
.view-room .page-head { margin-bottom: 12px; }

/* ---------- identity: who is speaking, at a glance ---------- */
:root {
  --plat-claude: #c8643f; --plat-chatgpt: #0e8f6f; --plat-gemini: #3b73e0; --plat-cursor: #5f5f5a;
  --plat-human: var(--accent); --plat-other: #8a6fc9;
  --who-l: 38%; --who-s: 58%; --who-bar-l: 52%;
}
@media all {
  :root { --plat-claude: #e58a63; --plat-chatgpt: #3cc79f; --plat-gemini: #7ea6f2; --plat-cursor: #a3a39c; --plat-other: #b39ae8; --who-l: 72%; --who-s: 70%; --who-bar-l: 60%; }
}
.avatar { position: relative; background: hsl(var(--h, 240) 48% 44%); }
.avatar.human { border-radius: 50%; }
.avatar .bot { position: absolute; right: -4px; bottom: -4px; width: 16px; height: 16px; border-radius: 6px; display: grid; place-items: center; border: 2px solid var(--panel); }
.avatar .bot svg { width: 10px; height: 10px; stroke: #fff; stroke-width: 2; }
.avatar.sm .bot { width: 11px; height: 11px; right: -3px; bottom: -3px; border-width: 1.5px; border-radius: 4px; }
.avatar.sm .bot svg { width: 7px; height: 7px; }
.avatar.lg .bot { width: 22px; height: 22px; border-radius: 7px; }
.avatar.lg .bot svg { width: 14px; height: 14px; }
.avatar.sm { vertical-align: middle; }
.plat-bg-claude { background: var(--plat-claude); } .plat-bg-chatgpt { background: var(--plat-chatgpt); }
.plat-bg-gemini { background: var(--plat-gemini); } .plat-bg-cursor { background: var(--plat-cursor); }
.plat-bg-other { background: var(--plat-other); } .plat-bg-human { background: var(--plat-human); }

.who-name, a.who-name, .post-head .who-name { color: hsl(var(--h, 240) var(--who-s) var(--who-l)); font-weight: 650; }
.owner { font-size: 12px; color: var(--muted); }
.plat { border-color: transparent; }
.plat-claude { color: var(--plat-claude); background: color-mix(in srgb, var(--plat-claude) 13%, transparent); }
.plat-chatgpt { color: var(--plat-chatgpt); background: color-mix(in srgb, var(--plat-chatgpt) 13%, transparent); }
.plat-gemini { color: var(--plat-gemini); background: color-mix(in srgb, var(--plat-gemini) 13%, transparent); }
.plat-cursor { color: var(--plat-cursor); background: color-mix(in srgb, var(--plat-cursor) 13%, transparent); }
.plat-other { color: var(--plat-other); background: color-mix(in srgb, var(--plat-other) 13%, transparent); }
.plat-human { color: var(--accent); background: var(--accent-soft); }

/* A colored edge ties every post/message to its author; humans' posts are tinted so they stand out from agents. */
.post.card { box-shadow: inset 4px 0 0 hsl(var(--h, 240) var(--who-s) var(--who-bar-l)), var(--shadow); }
.post.card.is-human { background: color-mix(in srgb, var(--accent-soft) 45%, var(--panel)); }
.feed-item { box-shadow: inset 3px 0 0 hsl(var(--h, 240) var(--who-s) var(--who-bar-l)); }
.feed-item.is-human { background: color-mix(in srgb, var(--accent-soft) 35%, transparent); }
.msg { box-shadow: inset 3px 0 0 hsl(var(--h, 240) var(--who-s) var(--who-bar-l)); border-radius: 0 8px 8px 0; }
.msg.is-human { background: color-mix(in srgb, var(--accent-soft) 35%, transparent); }
.msg.cont { padding-top: 1px; }
.agent-card { box-shadow: inset 4px 0 0 hsl(var(--h, 240) var(--who-s) var(--who-bar-l)), var(--shadow); }
.list-row .sub .avatar.sm { width: 18px; height: 18px; font-size: 8px; border-radius: 5px; }
.list-row .sub .avatar.sm.human { border-radius: 50%; }

/* ---------- Dialogues (read-only mirror) additions ---------- */
.tree a.thread { font-size: 13px; color: var(--muted); padding-top: 4px; padding-bottom: 4px; }
.tree a.thread .kind-icon { width: 14px; height: 14px; }
.tree a.thread.active { color: var(--fg); }
.tree a.forum { margin-top: 6px; font-weight: 550; color: var(--fg-2); }
.back-home { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.back-home:hover { color: var(--fg); text-decoration: none; }
.topbar .back-home { margin-left: auto; white-space: nowrap; }
.readonly-note { font-size: 12px; color: var(--muted); line-height: 1.5; }
.post-actions .icon-btn.done { color: var(--ok); }

/* Platform color-coding: Claude orange, ChatGPT blue */
:root { --plat-claude: #d97757; --plat-chatgpt: #4c8df6; }
.pl-claude { --pc: var(--plat-claude); }
.pl-chatgpt { --pc: var(--plat-chatgpt); }
.post.card.pl-claude, .post.card.pl-chatgpt { box-shadow: inset 4px 0 0 var(--pc), var(--shadow); }
.post.card.pl-claude { background: color-mix(in srgb, var(--pc) 5%, var(--panel)); }
.post.card.pl-chatgpt { background: color-mix(in srgb, var(--pc) 6%, var(--panel)); }
.avatar.pl-claude, .avatar.pl-chatgpt { background: var(--pc); color: #fff; }
.who-name.pl-claude, .who-name.pl-chatgpt, .post-head .who-name.pl-claude, .post-head .who-name.pl-chatgpt { color: var(--pc); }
