/* © 2026 [OWNER] — all rights reserved; prototype only, no licence granted.
   HIVE × SWARM prototype styles — uses Milestone 01 brand tokens */

/* Self-hosted latin subsets served from minkforge.dev/assets/fonts. The CSP on the
   published prototype allows style-src/font-src 'self' only, so the previous
   Google Fonts @import was blocked and its text silently fell back. Inter is not
   self-hosted; --font-sans below resolves to the system UI face instead. */
@font-face{font-family:'Space Grotesk';font-style:normal;font-weight:400;font-display:swap;src:url(/assets/fonts/space-grotesk-latin.woff2) format('woff2');}
@font-face{font-family:'Space Grotesk';font-style:normal;font-weight:500;font-display:swap;src:url(/assets/fonts/space-grotesk-latin.woff2) format('woff2');}
@font-face{font-family:'Space Grotesk';font-style:normal;font-weight:600;font-display:swap;src:url(/assets/fonts/space-grotesk-latin.woff2) format('woff2');}
@font-face{font-family:'Space Grotesk';font-style:normal;font-weight:700;font-display:swap;src:url(/assets/fonts/space-grotesk-latin.woff2) format('woff2');}
@font-face{font-family:'JetBrains Mono';font-style:normal;font-weight:400;font-display:swap;src:url(/assets/fonts/jetbrains-mono-latin.woff2) format('woff2');}
@font-face{font-family:'JetBrains Mono';font-style:normal;font-weight:500;font-display:swap;src:url(/assets/fonts/jetbrains-mono-latin.woff2) format('woff2');}
@font-face{font-family:'JetBrains Mono';font-style:normal;font-weight:700;font-display:swap;src:url(/assets/fonts/jetbrains-mono-latin.woff2) format('woff2');}

:root {
  --hive-night: #101b24;
  --hive-forest: #1b302b;
  --hive-lime: #b8f58a;
  --hive-mist: #e5f0e9;
  --swarm-void: #111426;
  --swarm-core: #25345a;
  --swarm-signal: #8ce7f4;
  --swarm-neural: #a98bff;

  --font-display: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;

  --bg: #0b141b;
  --surface: #101b24;
  --surface-2: #16232e;
  --surface-3: #1c2d3a;
  --line: #22394a;
  --line-soft: #1a2a37;
  --text: #e5f0e9;
  --muted: #8fa6b3;
  --muted-2: #7d94a1;

  --ok: #7ee08a;
  --warn: #f2c46d;
  --danger: #f2926d;
  --busy: #8ce7f4;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 10px 40px -12px rgba(0,0,0,.7);

  /* ── bee / tech hive layer (docs/design/SPEC-01) ────────────────────
     Additive only: every value is a lighten of a brand colour. */
  --hex-cell: 64px;
  --hex-line: rgba(184,245,138,.05);
  --hex-line-tech: rgba(140,231,244,.05);
  --lime-bright: #cfffa8;
  --signal-bright: #a9f0fa;
}

/* Honeycomb texture. Decoration only — never behind unbacked text. */
.hive-hex {
  background-image:
    linear-gradient(30deg, var(--hex-line) 12%, transparent 12.5%, transparent 87%, var(--hex-line) 87.5%),
    linear-gradient(150deg, var(--hex-line) 12%, transparent 12.5%, transparent 87%, var(--hex-line) 87.5%),
    linear-gradient(30deg, var(--hex-line) 12%, transparent 12.5%, transparent 87%, var(--hex-line) 87.5%),
    linear-gradient(150deg, var(--hex-line) 12%, transparent 12.5%, transparent 87%, var(--hex-line) 87.5%),
    linear-gradient(60deg, var(--hex-line) 25%, transparent 25.5%, transparent 75%, var(--hex-line) 75%),
    linear-gradient(60deg, var(--hex-line) 25%, transparent 25.5%, transparent 75%, var(--hex-line) 75%);
  background-position: 0 0, 0 0, calc(var(--hex-cell)/2) 46px, calc(var(--hex-cell)/2) 46px, 0 0, calc(var(--hex-cell)/2) 46px;
  background-size: var(--hex-cell) 92px;
}
.hive-hex-tech { --hex-line: var(--hex-line-tech); }

/* Hexagon clip — icons, avatars and status only, never text or cards. */
.hex-clip { clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%); }

/* Tiny filled hex for online / busy / review status. */
.hex-dot {
  display: inline-block; width: 8px; height: 8px; flex: 0 0 auto;
  background: var(--muted-2);
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
}
.hex-dot.online { background: var(--hive-lime); }
.hex-dot.busy { background: var(--busy); animation: hex-breathe 1.8s ease-in-out infinite; }
.hex-dot.review { background: var(--warn); animation: hex-breathe 1.8s ease-in-out infinite; }

/* Bee-charge: earned accent glow on an active surface. */
.bee-charge { border-color: rgba(184,245,138,.45); box-shadow: 0 0 0 1px rgba(184,245,138,.12), 0 0 22px -8px rgba(184,245,138,.55); }
.bee-charge-signal { border-color: rgba(140,231,244,.45); box-shadow: 0 0 0 1px rgba(140,231,244,.12), 0 0 22px -8px rgba(140,231,244,.55); }

@keyframes hex-breathe { 0%,100% { opacity: 1; } 50% { opacity: .45; } }
@keyframes node-drift { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@keyframes path-flow { to { stroke-dashoffset: -16; } }
.node-drift { animation: node-drift 3.2s ease-in-out infinite; }
.path-flow { stroke-dasharray: 3 5; animation: path-flow 1.6s linear infinite; }

* { box-sizing: border-box; }
html { color-scheme: dark; }
body {
  margin: 0;
  background:
    radial-gradient(1200px 600px at 15% -10%, rgba(140,231,244,.06), transparent 60%),
    radial-gradient(900px 500px at 90% 0%, rgba(169,139,255,.06), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
/* App-wide honeycomb texture layer, behind everything. */
body::before {
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: .55;
  background-image:
    linear-gradient(30deg, rgba(184,245,138,.045) 12%, transparent 12.5%, transparent 87%, rgba(184,245,138,.045) 87.5%),
    linear-gradient(150deg, rgba(184,245,138,.045) 12%, transparent 12.5%, transparent 87%, rgba(184,245,138,.045) 87.5%),
    linear-gradient(60deg, rgba(140,231,244,.03) 25%, transparent 25.5%, transparent 75%, rgba(140,231,244,.03) 75%);
  background-position: 0 0, 32px 46px, 0 0;
  background-size: 64px 92px;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
h1,h2,h3,h4 { font-family: var(--font-display); margin: 0; font-weight: 600; letter-spacing: -.01em; }
.mono { font-family: var(--font-mono); }

.skip {
  position: absolute; left: -999px; top: 8px; z-index: 100;
  background: var(--hive-lime); color: var(--hive-night);
  padding: 8px 14px; border-radius: 8px; font-weight: 600;
}
.skip:focus { left: 8px; }
:focus-visible { outline: 2px solid var(--swarm-signal); outline-offset: 2px; }

/* ── layout shell ─────────────────────────────── */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; position: relative; z-index: 1; }

.rail {
  border-right: 1px solid var(--line-soft);
  padding: 16px 12px 24px;
  display: flex; flex-direction: column; gap: 20px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: linear-gradient(180deg, rgba(16,27,36,.9), rgba(11,20,27,.6));
}
.brand {
  display: flex; align-items: center; gap: 10px; padding: 4px 8px 4px 6px;
}
.brand-mark { width: 34px; height: 34px; flex: 0 0 auto; }
.brand-name { font-family: var(--font-display); font-size: 15px; font-weight: 700; letter-spacing: .01em; line-height: 1.1; }
.brand-name em { color: var(--muted); font-style: normal; }
.brand-name span { color: var(--swarm-signal); display: block; font-size: 12px; letter-spacing: .16em; text-transform: uppercase; font-weight: 600; margin-top: 1px; }

.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-label {
  font-size: 10px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase;
  color: var(--muted-2); padding: 4px 10px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border-radius: 9px; color: var(--muted); border: 1px solid transparent;
  transition: background .12s, color .12s, border-color .12s;
  width: 100%; background: none; text-align: left;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--surface-3); color: var(--text); border-color: var(--line); }
.nav-item.active .nav-ic { color: var(--swarm-signal); }
.nav-ic { width: 20px; text-align: center; font-size: 15px; color: var(--muted-2); }
/* Nav group identity: HIVE items charge lime, SWARM items charge cyan. */
.nav-group[data-brand="hive"] .nav-item.active { border-color: rgba(184,245,138,.3); }
.nav-group[data-brand="hive"] .nav-item.active .nav-ic { color: var(--hive-lime); }
.nav-group[data-brand="swarm"] .nav-item.active { border-color: rgba(140,231,244,.3); }
.nav-item .badge {
  margin-left: auto; font-size: 10px; font-weight: 700; font-family: var(--font-mono);
  background: var(--hive-lime); color: var(--hive-night); padding: 1px 6px; border-radius: 999px;
}

.rail-foot { margin-top: auto; display: grid; gap: 8px; }
.rail-card {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 12px;
  background: linear-gradient(180deg, rgba(27,48,43,.6), rgba(22,35,46,.5));
}
.rail-card .rc-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 11px; color: var(--muted); font-weight: 600; letter-spacing: .04em; }
.rail-card .rc-val { font-family: var(--font-mono); font-size: 18px; color: var(--hive-lime); font-weight: 600; margin-top: 4px; }
.rail-card .rc-val small { font-size: 11px; color: var(--muted-2); font-weight: 500; }

/* ── main ─────────────────────────────────────── */
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 24px; border-bottom: 1px solid var(--line-soft);
  position: sticky; top: 0; z-index: 20;
  background: rgba(11,20,27,.82); backdrop-filter: blur(10px);
}
.crumbs { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted-2); }
.crumbs b { color: var(--text); font-weight: 600; font-size: 13px; }
.crumbs .sep { opacity: .4; }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
/* Phone: the topbar becomes a two-row grid — toggle, crumb, notifications and the
   avatar on top; the search on its own row. Nothing depends on horizontal panning. */
@media (max-width: 700px) {
  .topbar {
    display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto;
    grid-template-areas: "toggle crumbs bell me" "search search search search";
    gap: 8px; padding: 10px 12px;
  }
  .crumbs { grid-area: crumbs; min-width: 0; flex-wrap: nowrap; }
  .crumbs b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar-right { display: contents; }
  .search { grid-area: search; width: auto; min-width: 0; }
  .search kbd { display: none; }
  .create-btn { display: none; }
  .nav-toggle { grid-area: toggle; }
  .notif-btn { grid-area: bell; }
  .me-btn { grid-area: me; padding: 3px; }
  .me-btn > div { display: none; }
  .icon-btn { width: 40px; height: 40px; }
}
.search {
  display: flex; align-items: center; gap: 8px; width: 260px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px;
  padding: 0 10px; color: var(--muted);
}
.search input { border: 0; background: none; outline: none; color: var(--text); font: inherit; width: 100%; min-width: 0; height: 44px; }
.search kbd { font-family: var(--font-mono); font-size: 10px; color: var(--muted-2); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; }

.icon-btn {
  width: 44px; height: 44px; flex: none; display: grid; place-items: center; border-radius: 9px;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--muted);
  position: relative; transition: border-color .12s, color .12s;
}
.icon-btn:hover { color: var(--text); border-color: var(--swarm-signal); }
.icon-btn .dot { position: absolute; top: 6px; right: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--hive-lime); box-shadow: 0 0 0 2px var(--surface-2); }

.avatar {
  display: grid; place-items: center; font-weight: 700; font-size: 12px;
  color: var(--hive-night); flex: 0 0 auto; font-family: var(--font-display); letter-spacing: .01em;
  /* a bee in a cell */
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
}
.avatar.sm { width: 26px; height: 26px; font-size: 10px; }
.avatar.md { width: 34px; height: 34px; }
.avatar.lg { width: 48px; height: 48px; font-size: 15px; }

.me-btn { display: flex; align-items: center; gap: 8px; padding: 4px 8px 4px 4px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2); }
.me-btn:hover { border-color: var(--swarm-signal); }
.me-btn .nm { font-size: 12px; font-weight: 600; }
.me-btn .hd { font-family: var(--font-mono); font-size: 10px; color: var(--muted-2); }

.content { padding: 22px 24px 60px; }
.content-grid { display: grid; grid-template-columns: 1fr 300px; gap: 20px; align-items: start; }

/* ── primitives ───────────────────────────────── */
.card {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(22,35,46,.92), rgba(16,27,36,.92));
  padding: 16px;
}
.card.flat { background: var(--surface-2); }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.card-head h2 { font-size: 13px; letter-spacing: .02em; }
.card-head .sub { font-size: 11px; color: var(--muted-2); }
.card-head .right { margin-left: auto; display: flex; gap: 6px; align-items: center; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 7px 12px; border-radius: 8px; font-size: 12.5px; font-weight: 600;
  border: 1px solid transparent; transition: filter .12s, border-color .12s, background .12s;
  background: var(--surface-3); color: var(--text);
}
.btn:hover { filter: brightness(1.12); }
.btn.primary { background: var(--hive-lime); color: #0d1710; }
.btn.signal { background: var(--swarm-signal); color: #06202a; }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--muted); }
.btn.ghost:hover { border-color: var(--swarm-signal); color: var(--text); }
.btn.sm { padding: 4px 9px; font-size: 11px; }
.btn.block { width: 100%; }
.btn.create-btn { flex: 0 0 auto; }

.pill {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px;
  border-radius: 999px; font-size: 10.5px; font-weight: 600; letter-spacing: .02em;
  border: 1px solid var(--line); color: var(--muted); background: var(--surface-2);
}
.pill.lime { color: var(--hive-lime); border-color: rgba(184,245,138,.28); background: rgba(184,245,138,.08); }
.pill.signal { color: var(--swarm-signal); border-color: rgba(140,231,244,.28); background: rgba(140,231,244,.08); }
.pill.neural { color: var(--swarm-neural); border-color: rgba(169,139,255,.28); background: rgba(169,139,255,.08); }
.pill.warn { color: var(--warn); border-color: rgba(242,196,109,.28); background: rgba(242,196,109,.08); }
.pill.danger { color: var(--danger); border-color: rgba(242,150,109,.28); background: rgba(242,150,109,.08); }
.pill.muted { color: var(--muted-2); }

.status-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.s-running { background: var(--busy); box-shadow: 0 0 0 3px rgba(140,231,244,.15); }
.s-busy { background: var(--busy); box-shadow: 0 0 0 3px rgba(140,231,244,.15); }
.s-done { background: var(--ok); }
.s-waiting { background: var(--warn); box-shadow: 0 0 0 3px rgba(242,196,109,.12); }
.s-idle { background: var(--muted-2); }
.s-offline { background: #4b5c67; }
.s-degraded { background: var(--warn); }
.s-healthy { background: var(--ok); }

.page-head { display: flex; align-items: flex-end; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; }
.page-head p { margin: 4px 0 0; color: var(--muted); font-size: 13px; max-width: 60ch; }
.page-head .right { margin-left: auto; display: flex; gap: 8px; }

.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, minmax(0,1fr)); } .content-grid { grid-template-columns: 1fr; } }
@media (max-width: 820px) { .g3, .g2 { grid-template-columns: 1fr; } .shell { grid-template-columns: 1fr; } }

/* A grid item defaults to min-width:auto, so one nowrap line ("61 online - 931
   members") pinned the whole page to 508 px on a 390 px phone. Let the tracks and
   rows shrink, and let that line wrap instead of widening the document. */
@media (max-width: 820px) {
  .g2, .g3, .g4, .content-grid, .plan-grid { grid-template-columns: minmax(0, 1fr); }
  .g2 > *, .g3 > *, .g4 > *, .content-grid > *, .plan-grid > * { min-width: 0; }
  .guild-row { min-width: 0; }
  .guild-row .gmeta span { white-space: normal; overflow-wrap: anywhere; }
}

.muted { color: var(--muted); }
.muted-2 { color: var(--muted-2); }
.tiny { font-size: 11px; }
.row { display: flex; align-items: center; gap: 10px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.divider { height: 1px; background: var(--line-soft); margin: 12px 0; }

.bar { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--swarm-signal), var(--swarm-neural)); }
.bar.lime > span { background: linear-gradient(90deg, var(--hive-lime), #7ee08a); }

/* ── feed ─────────────────────────────────────── */
.composer { display: flex; gap: 10px; }
.composer textarea {
  flex: 1; min-height: 62px; resize: vertical; background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; color: var(--text);
  font: inherit; outline: none;
}
.composer textarea:focus { border-color: var(--swarm-signal); }

.post { padding: 14px 16px; }
.post + .post { border-top: 1px solid var(--line-soft); }
.post-head { display: flex; gap: 10px; align-items: center; }
.post-head .who { display: flex; flex-direction: column; line-height: 1.25; }
.post-head .who b { font-size: 13px; }
.post-head .who span { font-size: 11px; color: var(--muted-2); font-family: var(--font-mono); }
.post-body { margin: 10px 0 12px; font-size: 13.5px; color: #d7e6df; line-height: 1.6; }
.post-actions { display: flex; gap: 4px; }
.act { display: inline-flex; align-items: center; gap: 6px; padding: 5px 9px; border-radius: 7px; background: none; border: 1px solid transparent; color: var(--muted); font-size: 12px; font-weight: 600; }
.act:hover { background: var(--surface-2); color: var(--text); border-color: var(--line); }
.act.liked { color: var(--hive-lime); }

/* guild list */
.guild-row { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 10px; border: 1px solid transparent; transition: background .12s, border-color .12s; text-align: left; width: 100%; background: none; }
.guild-row:hover { background: var(--surface-2); border-color: var(--line-soft); }
.guild-row.active { background: var(--surface-3); border-color: var(--line); }
/* Guild / project monogram: hex-clipped cell (SPEC-01 §2 rule 2). */
.gicon { width: 34px; height: 34px; display: grid; place-items: center; font-weight: 700; font-family: var(--font-display); font-size: 14px; color: #0b141b; flex: 0 0 auto; clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%); }
.guild-row .gmeta { min-width: 0; flex: 1; }
.guild-row .gmeta b { display: block; font-size: 13px; }
.guild-row .gmeta span { font-size: 11px; color: var(--muted-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }

/* chat */
.chat { display: flex; flex-direction: column; height: min(calc(100vh - 300px), 520px); min-height: 340px; }
.chat-log { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; padding: 4px 2px; }
.msg { display: flex; gap: 10px; }
.msg .body { font-size: 13px; color: #d7e6df; }
.msg .body .meta { font-size: 11px; color: var(--muted-2); margin-bottom: 2px; font-family: var(--font-mono); }
.msg .body .meta b { color: var(--text); font-family: var(--font-sans); font-size: 12px; }
.chat-input { display: flex; gap: 8px; margin-top: 10px; }
.chat-input input { flex: 1; background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; color: var(--text); outline: none; font: inherit; }
.chat-input input:focus { border-color: var(--swarm-signal); }

/* ── workshop / agent viz ─────────────────────── */
.swarm-stage {
  position: relative; border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--line);
  background:
    radial-gradient(600px 300px at 30% 20%, rgba(140,231,244,.08), transparent 70%),
    radial-gradient(500px 260px at 80% 80%, rgba(169,139,255,.08), transparent 70%),
    #0a1220;
  min-height: 260px;
}
.swarm-stage .grid-lines {
  position: absolute; inset: 0; opacity: .35;
  background-image: linear-gradient(rgba(140,231,244,.05) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(140,231,244,.05) 1px, transparent 1px);
  background-size: 26px 26px;
}
.stage-head { position: relative; display: flex; align-items: center; gap: 10px; padding: 12px 14px; z-index: 2; }
.stage-head .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }

.nodes { position: relative; z-index: 2; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; padding: 4px 14px 16px; }
.node {
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 11px;
  background: rgba(16,27,36,.8); backdrop-filter: blur(4px);
  display: flex; gap: 9px; align-items: center; position: relative;
}
.node::before {
  content: ""; position: absolute; left: -1px; top: 10px; bottom: 10px; width: 3px; border-radius: 3px;
  background: var(--ncol, var(--swarm-signal));
}
.node .nmeta { min-width: 0; }
.node .nmeta b { font-size: 12px; display: block; }
.node .nmeta span { font-size: 10.5px; color: var(--muted-2); font-family: var(--font-mono); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.node .nutil { margin-left: auto; font-family: var(--font-mono); font-size: 10px; color: var(--muted); }

.spark { display: inline-flex; gap: 3px; align-items: flex-end; height: 16px; }
.spark i { width: 3px; background: var(--swarm-signal); border-radius: 1px; opacity: .8; animation: pulse 1.4s ease-in-out infinite; }
.spark i:nth-child(2) { animation-delay: .15s; }
.spark i:nth-child(3) { animation-delay: .3s; }
.spark i:nth-child(4) { animation-delay: .45s; }
@keyframes pulse { 0%,100% { height: 4px; opacity: .45; } 50% { height: 14px; opacity: 1; } }

.log { display: flex; flex-direction: column; gap: 0; }
.log-row { display: grid; grid-template-columns: 68px 1fr; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--line-soft); }
.log-row:last-child { border-bottom: 0; }
.log-row .t { font-family: var(--font-mono); font-size: 10.5px; color: var(--muted-2); }
.log-row .ev { font-size: 12px; color: #cfded7; }
.log-row .ev b { font-family: var(--font-mono); font-size: 11px; color: var(--swarm-signal); margin-right: 6px; }
.k-read b { color: var(--muted) !important; }
.k-write b { color: var(--hive-lime) !important; }
.k-idea b { color: var(--swarm-neural) !important; }

/* table */
.tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.tbl th { text-align: left; font-size: 10px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted-2); font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 10px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr:hover td { background: rgba(140,231,244,.03); }
.tbl .num { font-family: var(--font-mono); }

/* stat */
.stat { padding: 14px; }
.stat .label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted-2); font-weight: 700; }
.stat .val { font-family: var(--font-display); font-size: 24px; font-weight: 700; margin-top: 6px; line-height: 1; }
.stat .val small { font-size: 12px; color: var(--muted-2); font-family: var(--font-sans); font-weight: 500; }
.stat .delta { font-size: 11px; margin-top: 6px; font-family: var(--font-mono); }

/* ledger */
.alloc-row { display: grid; grid-template-columns: 1fr 64px; gap: 10px; align-items: center; padding: 9px 0; border-bottom: 1px dashed var(--line-soft); }
.alloc-row:last-child { border-bottom: 0; }
.donut { --p: 60; width: 132px; height: 132px; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--hive-lime) calc(var(--p) * 1%), var(--surface-3) 0);
  position: relative; margin: 0 auto;
}
.donut::after { content: ""; position: absolute; inset: 14px; border-radius: 50%; background: var(--surface); }
.donut .cin { position: relative; z-index: 2; text-align: center; }
.donut .cin b { display: block; font-family: var(--font-display); font-size: 20px; }
.donut .cin span { font-size: 10px; color: var(--muted-2); }

/* monogram marks */
.hex-mark { display: inline-grid; place-items: center; }

/* ── SWARM node geometry (SPEC-01 §3) ─────────────────────────────── */
.swarm-links { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.swarm-links .link { stroke: rgba(140,231,244,.35); stroke-width: 1; fill: none; }

/* Page-head honeycomb divider: three tiny filled cells. */
.hex-divider { display: inline-flex; gap: 3px; margin-top: 8px; }
.hex-divider i {
  width: 7px; height: 7px; background: rgba(184,245,138,.55);
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
}
.hex-divider i:nth-child(2) { background: var(--hive-lime); }
.hex-divider i:nth-child(3) { background: rgba(184,245,138,.3); }

/* toast */
.toast-wrap { position: fixed; bottom: 18px; right: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 80; }
.toast {
  border: 1px solid var(--line); background: var(--surface-3); color: var(--text);
  border-radius: 10px; padding: 10px 14px; font-size: 12.5px; box-shadow: var(--shadow);
  display: flex; gap: 8px; align-items: center; animation: slide .18s ease;
}
@keyframes slide { from { transform: translateY(6px); opacity: 0; } to { transform: none; opacity: 1; } }

/* modal-ish */
.modal-back { position: fixed; inset: 0; background: rgba(4,9,13,.66); backdrop-filter: blur(3px); display: grid; place-items: center; z-index: 60; }
.modal { width: min(460px, 92vw); border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); padding: 18px; }
.modal h3 { font-size: 15px; }

/* misc */
.err { color: var(--danger); font-size: 11px; }
.empty { text-align: center; padding: 28px 16px; color: var(--muted); font-size: 12.5px; }
.sample-note {
  font-size: 10.5px; color: var(--muted-2); font-family: var(--font-mono);
  border: 1px dashed var(--line); border-radius: 7px; padding: 5px 9px; display: inline-flex; gap: 6px;
}
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.tab { padding: 8px 11px; font-size: 12.5px; color: var(--muted); border-bottom: 2px solid transparent; background: none; border-top: 0; border-left: 0; border-right: 0; font-weight: 600; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--swarm-signal); }

.reduced-motion .spark i, .reduced-motion .toast { animation: none !important; }

@media (prefers-reduced-motion: reduce) {
  .spark i, .toast, .node-drift, .path-flow, .hex-dot.busy, .hex-dot.review,
  .sd-awaiting-approval, .drawer { animation: none !important; }
  .path-flow { stroke-dasharray: none; }
}

/* ── agent-to-agent conversation ─────────────── */
.convo { display: flex; flex-direction: column; gap: 0; }
.turn { display: grid; grid-template-columns: 34px 1fr; gap: 10px; padding: 12px 0; border-bottom: 1px dashed var(--line-soft); position: relative; }
.turn:last-child { border-bottom: 0; }
.turn .tmain { min-width: 0; }
.turn .tmeta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 5px; }
.turn .tmeta .who { font-weight: 700; font-size: 12px; font-family: var(--font-mono); }
.turn .tmeta .arrow { color: var(--muted-2); font-size: 11px; }
.turn .tmeta .to { font-size: 11.5px; color: var(--muted); font-family: var(--font-mono); }
.turn .ttext { font-size: 12.8px; color: #d7e6df; line-height: 1.58; }
.turn .tfoot { display: flex; align-items: center; gap: 8px; margin-top: 7px; flex-wrap: wrap; }

.tbadge {
  font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em;
  padding: 1px 6px; border-radius: 4px; border: 1px solid transparent;
}
.tb-propose { color: var(--swarm-signal); background: rgba(140,231,244,.1); border-color: rgba(140,231,244,.3); }
.tb-agree { color: var(--hive-lime); background: rgba(184,245,138,.1); border-color: rgba(184,245,138,.3); }
.tb-challenge { color: var(--danger); background: rgba(242,150,109,.1); border-color: rgba(242,150,109,.3); }
.tb-question { color: var(--swarm-neural); background: rgba(169,139,255,.1); border-color: rgba(169,139,255,.3); }
.tb-constraint { color: var(--warn); background: rgba(242,196,109,.1); border-color: rgba(242,196,109,.3); }
.tb-conclude { color: #fff; background: rgba(184,245,138,.22); border-color: var(--hive-lime); }

/* the vertical thread line connecting turns */
.turn::before { content: ""; position: absolute; left: 17px; top: 46px; bottom: -1px; width: 1px; background: var(--line-soft); }
.turn:last-child::before { display: none; }

.conf { display: inline-flex; align-items: center; gap: 5px; font-size: 10px; font-family: var(--font-mono); color: var(--muted-2); }
.conf .cbar { width: 42px; height: 4px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.conf .cbar > i { display: block; height: 100%; background: var(--swarm-signal); }
.conf.low .cbar > i { background: var(--danger); }
.conf.mid .cbar > i { background: var(--warn); }

.convo-summary {
  border: 1px solid rgba(184,245,138,.28); background: rgba(184,245,138,.06);
  border-radius: 9px; padding: 11px 13px; margin-top: 10px;
}
.convo-summary .cs-title { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; color: var(--hive-lime); margin-bottom: 4px; }
.convo-summary .cs-body { font-size: 12.5px; color: #d7e6df; }

.scope-list { display: flex; flex-direction: column; gap: 5px; }
.scope-item { display: flex; align-items: center; gap: 7px; font-size: 11.5px; }
.scope-item .ok { color: var(--hive-lime); }
.scope-item .no { color: var(--muted-2); }

/* agent detail drawer */
.drawer-back { position: fixed; inset: 0; background: rgba(4,9,13,.6); z-index: 55; display: flex; justify-content: flex-end; }
.drawer {
  width: min(420px, 94vw); height: 100%; overflow-y: auto; background: var(--surface);
  border-left: 1px solid var(--line); padding: 18px; box-shadow: -20px 0 60px -20px #000;
  animation: slidein .18s ease;
}
@keyframes slidein { from { transform: translateX(20px); opacity: .6; } to { transform: none; opacity: 1; } }

/* ── session states (milestone-16 §4.1) ──────── */
.sd { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: 0 0 auto; }
.sd-running { background: var(--busy); box-shadow: 0 0 0 3px rgba(140,231,244,.15); }
.sd-completed { background: var(--ok); }
.sd-paused { background: var(--muted); box-shadow: 0 0 0 3px rgba(143,166,179,.15); }
.sd-awaiting-approval { background: var(--warn); box-shadow: 0 0 0 3px rgba(242,196,109,.18); animation: blink 1.8s ease-in-out infinite; }
.sd-blocked { background: #e05c7a; box-shadow: 0 0 0 3px rgba(224,92,122,.18); }
.sd-failed { background: var(--danger); }
.sd-cancelled { background: #4b5c67; }
.sd-interrupted { background: var(--swarm-neural); }
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: .45; } }

.st-running { color: var(--swarm-signal); border-color: rgba(140,231,244,.28); background: rgba(140,231,244,.08); }
.st-completed { color: var(--hive-lime); border-color: rgba(184,245,138,.28); background: rgba(184,245,138,.08); }
.st-paused { color: var(--muted); border-color: var(--line); background: var(--surface-2); }
.st-awaiting-approval { color: var(--warn); border-color: rgba(242,196,109,.3); background: rgba(242,196,109,.08); }
.st-blocked { color: #e05c7a; border-color: rgba(224,92,122,.35); background: rgba(224,92,122,.08); }
.st-failed { color: var(--danger); border-color: rgba(242,150,109,.3); background: rgba(242,150,109,.08); }
.st-cancelled { color: var(--muted-2); border-color: var(--line); background: var(--surface-2); }
.st-interrupted { color: var(--swarm-neural); border-color: rgba(169,139,255,.3); background: rgba(169,139,255,.08); }

.sess-note { font-size: 11px; color: var(--muted); margin-top: 7px; padding: 6px 9px; border-radius: 6px; background: rgba(255,255,255,.02); border-left: 2px solid var(--line); }
.sess-note.warn { border-left-color: var(--warn); color: var(--warn); }
.sess-note.danger { border-left-color: var(--danger); color: var(--danger); }

/* ── plan review ─────────────────────────────── */
.plan-grid { display: grid; grid-template-columns: 1fr 320px; gap: 14px; align-items: start; }
@media (max-width: 1080px) { .plan-grid { grid-template-columns: 1fr; } }

.plan-sec { border: 1px solid var(--line); border-radius: 10px; padding: 13px; background: var(--surface-2); }
.plan-sec h4 { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted-2); margin-bottom: 8px; font-weight: 700; font-family: var(--font-sans); }
.plan-sec p { margin: 0; font-size: 12.5px; color: #cfded7; line-height: 1.6; }

.dep-task { border: 1px solid var(--line-soft); border-radius: 8px; padding: 10px; background: var(--surface); }
.dep-task .dt-head { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.dep-task .dt-id { font-family: var(--font-mono); font-size: 10px; font-weight: 700; color: var(--swarm-signal); border: 1px solid rgba(140,231,244,.3); border-radius: 4px; padding: 0 5px; }
.dep-task .dt-title { font-size: 12.5px; font-weight: 600; flex: 1; }
.dep-task .dt-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }

.perm-row { display: flex; align-items: center; gap: 8px; padding: 5px 0; font-size: 12px; border-bottom: 1px dashed var(--line-soft); }
.perm-row:last-child { border-bottom: 0; }
.perm-row .pmark.y { color: var(--hive-lime); }
.perm-row .pmark.n { color: var(--danger); }
.perm-row.denied span.plabel { color: var(--muted-2); text-decoration: line-through; text-decoration-color: rgba(242,150,109,.5); }

.risk { display: flex; gap: 8px; padding: 8px 0; border-bottom: 1px dashed var(--line-soft); font-size: 12px; }
.risk:last-child { border-bottom: 0; }
.risk .rlevel { flex: 0 0 auto; font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; padding: 1px 6px; border-radius: 4px; height: fit-content; }
.rlevel.medium { color: var(--warn); background: rgba(242,196,109,.12); }
.rlevel.low { color: var(--muted); background: var(--surface-3); }
.rlevel.high { color: var(--danger); background: rgba(242,150,109,.12); }

.approve-bar { display: flex; gap: 8px; align-items: center; padding: 12px; border: 1px solid rgba(242,196,109,.3); background: rgba(242,196,109,.06); border-radius: 10px; }

/* ── diff ────────────────────────────────────── */
.diff-file { border: 1px solid var(--line); border-radius: 9px; overflow: hidden; margin-bottom: 10px; background: var(--surface); }
.diff-file.out-of-scope { border-color: rgba(242,150,109,.45); }
.diff-head { display: flex; align-items: center; gap: 9px; padding: 9px 12px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.diff-head .dpath { font-family: var(--font-mono); font-size: 11.5px; color: var(--text); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.diff-head .dstat { font-family: var(--font-mono); font-size: 10.5px; }
.dstat .add { color: var(--ok); }
.dstat .del { color: var(--danger); }
.diff-body { font-family: var(--font-mono); font-size: 11.5px; line-height: 1.7; overflow-x: auto; }
.dline { display: flex; white-space: pre; }
.dline .dn { flex: 0 0 38px; text-align: right; padding-right: 8px; color: var(--muted-2); user-select: none; }
.dline .dc { flex: 0 0 14px; text-align: center; user-select: none; }
.dline.add { background: rgba(126,224,138,.07); }
.dline.add .dc { color: var(--ok); }
.dline.del { background: rgba(242,150,109,.07); }
.dline.del .dc { color: var(--danger); }
.dline.ctx { color: var(--muted); }
.dline .dtext { flex: 1; padding-right: 12px; }

.diff-decision { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); background: var(--surface-2); align-items: center; }


/* ── phone navigation: off-canvas rail ──────────
   Below 821 px the rail is a panel, not a column: the shell is one column and every
   wide grid already collapses, so no panel needs horizontal panning. */
.nav-toggle, .nav-close { display: none; }
.nav-close {
  margin-left: auto; width: 34px; height: 34px; border-radius: 8px; flex: 0 0 auto;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--muted);
  place-items: center; font-size: 14px;
}
.nav-backdrop {
  position: fixed; inset: 0; z-index: 64;
  background: rgba(4, 9, 13, .62); backdrop-filter: blur(2px);
}
@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .nav-toggle { display: grid; }
  .nav-close { display: grid; }
  .rail {
    position: fixed; inset: 0 auto 0 0; z-index: 70;
    width: min(304px, 86vw); height: 100dvh;
    transform: translateX(-102%); visibility: hidden;
    transition: transform .2s ease, visibility .2s;
    box-shadow: 24px 0 60px -30px #000;
  }
  body.nav-open .rail { transform: none; visibility: visible; }
  body.nav-open { overflow: hidden; }
  .content { padding: 18px 14px 84px; }
  .page-head .right { margin-left: 0; flex-wrap: wrap; }
  .tbl-scroll { overflow-x: auto; }
}

/* ── Guilds: three panels that stack instead of panning ───────────
   The view used an inline 250px/1fr/210px grid, which pinned the document to
   597 px at a 390 px viewport. */
.guild-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr) 210px; gap: 14px; align-items: start; }
.guild-layout > * { min-width: 0; }
@media (max-width: 1080px) {
  .guild-layout { grid-template-columns: 240px minmax(0, 1fr); }
  .guild-layout .guild-members { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
  .guild-layout { grid-template-columns: minmax(0, 1fr); }
  .guild-layout .guild-members { grid-column: auto; }
  .tabs { flex-wrap: wrap; }
  .msg .body { min-width: 0; overflow-wrap: anywhere; }
  .chat { height: min(calc(100vh - 260px), 480px); }
}

/* Phone follows: hide the Create button at source specificity it cannot lose, and
   keep the drawer foot clear of the floating demo bar. */
@media (max-width: 700px) {
  .topbar .create-btn { display: none; }
}
@media (max-width: 960px) {
  .rail { padding-bottom: 88px; }
  .nav-close { order: 3; }
}
