/* fungus dashboard — dark theme mirroring the EventCatalog refs.
   Single stylesheet shipped inline via include_str! at build time. */

:root {
  --bg: #0a0a0a;
  --bg-elev: #141414;
  --bg-elev-2: #1c1c1c;
  --border: #262626;
  --border-strong: #383838;
  --text: #e6e6e6;
  --muted: #8a8a8a;
  --accent: #f97316;
  --accent-soft: rgba(249, 115, 22, 0.14);
  --green: #4ade80;
  --blue: #60a5fa;
  --violet: #a78bfa;
  --pink: #f472b6;

  --radius-sm: 4px;
  --radius: 8px;
  --radius-lg: 12px;

  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); }
body { font-family: var(--sans); font-size: 14px; line-height: 1.5; }
a { color: inherit; text-decoration: none; }

code { font-family: var(--mono); font-size: 0.92em; color: var(--text); }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }

/* ── shell ────────────────────────────────────────────────────── */
.shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

.frame {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* ── topbar ───────────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 2;
}
.crumbs {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
}
.crumb { color: var(--muted); }
.crumb:hover { color: var(--text); }
.crumb.is-current { color: var(--text); font-weight: 500; }
.crumb-sep { color: var(--border-strong); }

.env-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elev);
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}
.env-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(74,222,128,0.18);
}
.env-label { color: var(--text); }

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  width: 320px;
  max-width: 40vw;
}
.search-icon { color: var(--muted); }
.search input {
  flex: 1;
  background: transparent;
  border: 0;
  color: var(--text);
  font: inherit;
  outline: none;
}
.search input::placeholder { color: var(--muted); }
.search kbd {
  font: 11px var(--mono);
  padding: 2px 6px;
  border-radius: 3px;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  color: var(--muted);
}

.sidebar {
  background: var(--bg);
  border-right: 1px solid var(--border);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px;
}
.brand-mark {
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #111;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.brand-name { font-weight: 600; letter-spacing: -0.01em; }

.nav-primary { display: flex; flex-direction: column; gap: 1px; }
.nav-secondary { display: flex; flex-direction: column; gap: 1px; margin-top: auto; }
.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-weight: 500;
  font-size: 13px;
  transition: background 80ms ease, color 80ms ease;
}
.nav-link:hover { background: var(--bg-elev); color: var(--text); }
.nav-link.is-active { background: var(--bg-elev); color: var(--text); }
.nav-link.is-active .nav-icon { color: var(--accent); }
.nav-icon {
  width: 14px;
  height: 14px;
  flex: none;
  color: inherit;
  opacity: 0.85;
}
.nav-link:hover .nav-icon { opacity: 1; }
.nav-section {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-weight: 600;
  color: var(--border-strong);
  padding: 20px 10px 6px;
}

/* Nested sub-items expand under their parent nav-link (used for Ports
   per-kind). Indented + smaller; the parent's left margin reserves the
   icon column. */
.nav-sublink {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 10px 5px 32px;
  margin-left: 2px;
  border-left: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
  font-family: var(--mono);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.nav-sublink:hover { color: var(--text); background: var(--bg-elev); }
.nav-sublink.is-active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: var(--accent-soft);
}
.nav-sublink-mark { text-transform: lowercase; }
.nav-sublink-count {
  color: var(--border-strong);
  font-family: var(--mono);
  font-size: 11px;
}
.nav-sublink.is-active .nav-sublink-count { color: var(--accent); }

/* ── domain graph (Cytoscape hero diagram on /) ───────────────── */
.cy-graph {
  width: 100%;
  height: 420px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  position: relative;
  overflow: hidden;
}
.cy-graph:focus-within { outline: none; }

.sidebar-foot { font-size: 12px; padding: 0 8px; }

/* ── content ──────────────────────────────────────────────────── */
.content {
  padding: 36px 48px 80px;
  max-width: 1280px;
  width: 100%;
}

/* ── detail grid (quickref + main + rail) ─────────────────────── */
.detail-grid {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) 280px;
  gap: 0;
  align-items: start;
}
.detail-main {
  padding: 28px 32px 80px;
  min-width: 0;
}
.quickref, .rail {
  padding: 28px 16px;
  border-right: 1px solid var(--border);
  min-height: calc(100vh - 50px);
  font-size: 13px;
  position: sticky;
  top: 50px;
  align-self: start;
  max-height: calc(100vh - 50px);
  overflow-y: auto;
}
.rail { border-right: 0; border-left: 1px solid var(--border); }

@media (max-width: 1100px) {
  .detail-grid { grid-template-columns: 200px minmax(0, 1fr); }
  .rail { display: none; }
}
@media (max-width: 820px) {
  .detail-grid { grid-template-columns: 1fr; }
  .quickref { display: none; }
}

/* quick reference nav */
.qr { display: flex; flex-direction: column; gap: 2px; }
.qr-section {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 18px 0 6px;
  padding: 0 8px;
}
.qr-section:first-child { margin-top: 0; }
.qr-section h3 {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted);
  margin: 0;
}
.qr-icon {
  color: var(--accent);
  font-size: 12px;
  line-height: 1;
  width: 14px;
  height: 14px;
  flex: none;
}
.qr-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px 5px 22px;
  margin: 1px 0 1px 4px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 12px;
  border-left: 2px solid transparent;
  min-width: 0;
}
.qr-link:hover { color: var(--text); background: var(--bg-elev); }
.qr-link.is-active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: var(--accent-soft);
}
.qr-link.static { cursor: default; }
.qr-link.drill .qr-chev {
  width: 12px;
  height: 12px;
  margin-left: auto;
  opacity: 0;
  color: var(--accent);
  transition: opacity 80ms ease;
  flex: none;
}
.qr-link.drill:hover .qr-chev { opacity: 1; }
.qr-mark {
  font-family: var(--mono);
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  color: var(--text);
  flex: none;
}
.qr-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.qr-empty {
  padding: 4px 8px 4px 22px;
  color: var(--border-strong);
  font-size: 12px;
  font-style: italic;
}

/* right rail */
.rail-panel {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.rail-panel:last-child { border-bottom: 0; }
.rail-head {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}
.rail-list { display: grid; grid-template-columns: 1fr; gap: 6px; margin: 0; }
.rail-list dt {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  margin-top: 4px;
}
.rail-list dd {
  margin: 0 0 4px;
  font-size: 13px;
  /* Long UUIDs + sha digests would otherwise break out of the rail
     column with horizontal overflow. Force-wrap on any character. */
  word-break: break-all;
  line-height: 1.4;
}
.rail-list dd .small,
.rail-list dd .mono { display: inline-block; }

.versions { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; }
.versions li { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.ver-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border-strong);
}
.ver-dot.is-latest { background: var(--green); box-shadow: 0 0 0 3px rgba(74,222,128,0.18); }
/* Pre-release dot: hollow violet ring to read as "draft, not promoted". */
.ver-dot.is-pre {
  background: transparent;
  border: 1.5px dashed var(--violet);
  width: 7px;
  height: 7px;
}
.versions.prerelease li code.ver-tag { color: var(--muted); font-style: italic; }
.ver-tag { font-size: 12px; }
.badge.accent { color: var(--accent); background: var(--accent-soft); border-color: rgba(249,115,22,0.35); }
.badge.pre {
  color: var(--violet);
  background: rgba(167,139,250,0.12);
  border-color: rgba(167,139,250,0.45);
  text-transform: lowercase;
}
/* Per-version compatibility guarantee badge (spec §6.1). Levels are
   ordered from "strongest" (full) to "weakest" (none). Colors track
   the green→amber→red signal palette so the safest level is most
   visible. */
.badge.compat {
  text-transform: lowercase;
  font-variant-numeric: tabular-nums;
}
.badge.compat-full {
  color: var(--green);
  background: rgba(74,222,128,0.10);
  border-color: rgba(74,222,128,0.4);
}
.badge.compat-backward,
.badge.compat-forward {
  color: var(--blue);
  background: rgba(96,165,250,0.10);
  border-color: rgba(96,165,250,0.4);
}
.badge.compat-none {
  color: #fbbf24;
  background: rgba(251,191,36,0.10);
  border-color: rgba(251,191,36,0.4);
}

/* Compact "+N / −M / ~K" change summary that sits on each timeline
   entry next to the compat badge. Color-coded the same as git diff
   chips elsewhere (add=green, remove=red, change=blue). */
.vt-changes {
  display: inline-flex;
  gap: 6px;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.vt-changes .vt-add { color: var(--green); }
.vt-changes .vt-rm  { color: #fca5a5; }
.vt-changes .vt-ch  { color: var(--blue); }
/* Mutable pre-release ("-unstable" tag): amber + "mutable" wording so the
   reader knows this slot can change underfoot. Different vibe from the
   regular pre-release dot, which is immutable. */
.badge.unstable {
  color: var(--accent);
  background: rgba(249,115,22,0.12);
  border-color: rgba(249,115,22,0.45);
  text-transform: lowercase;
}
.ver-dot.is-unstable,
.vt-dot.is-unstable {
  background: var(--accent);
  border: 1.5px dashed var(--accent);
  box-shadow: 0 0 0 3px rgba(249,115,22,0.14);
}
.vt-item.is-unstable .vt-version { color: var(--accent); font-style: normal; }

/* Rail sub-section label so the Stable / Pre-releases grouping is
   visually distinct without two separate panels. */
.rail-subhead {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 10px 0 4px;
  font-weight: 600;
}
.rail-subhead:first-of-type { margin-top: 0; }

/* "Behind latest" warning chip on consumer rows. */
.chip.warn {
  color: #fbbf24;
  background: rgba(251,191,36,0.10);
  border-color: rgba(251,191,36,0.4);
}

/* Row tinting for consumer table rows that are pinned to a stale port
   version — same amber palette as the chip, so the row reads as
   "needs attention" at a glance. */
.data-table tr.row-warn {
  background: rgba(251,191,36,0.05);
}
.data-table tr.row-warn:hover {
  background: rgba(251,191,36,0.10);
}
/* Compat-breach: the consumer's requires_compatibility isn't met by
   the publisher's guarantee. Red overrides amber when both apply. */
.data-table tr.row-danger {
  background: rgba(248,113,113,0.07);
}
.data-table tr.row-danger:hover {
  background: rgba(248,113,113,0.14);
}
.chip.danger {
  color: #fca5a5;
  background: rgba(248,113,113,0.10);
  border-color: rgba(248,113,113,0.4);
}

/* ── port version timeline (port detail main column) ──────────── */
.version-timeline {
  list-style: none;
  padding: 0;
  margin: 0;
}
.vt-item {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 12px;
  padding: 8px 0;
}
.vt-marker {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.vt-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border-strong);
  margin-top: 4px;
  flex: none;
  z-index: 1;
}
.vt-dot.is-latest {
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(74,222,128,0.18);
}
.vt-dot.is-pre {
  background: transparent;
  border: 1.5px dashed var(--violet);
}
.vt-item.is-pre .vt-version { color: var(--muted); font-style: italic; }
.vt-spine {
  position: absolute;
  top: 18px;
  bottom: -8px;
  width: 1px;
  background: var(--border);
}
.vt-body { min-width: 0; padding-top: 2px; }
.vt-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.vt-version { font-size: 13px; }
.vt-meta {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
  word-break: break-all;
}
.vt-diff {
  font-family: var(--mono);
  font-size: 11px;
  margin-left: auto;
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
}
.vt-diff:hover { color: var(--accent); border-color: var(--accent); }
.vt-item.is-selected .vt-version,
.versions li.is-selected .ver-tag { color: var(--accent); }
.versions li.is-selected {
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
  padding: 2px 6px;
}
.ver-link { display: inline-flex; align-items: center; }
.ver-link:hover .ver-tag { color: var(--accent); }

/* ── schema diff ──────────────────────────────────────────────── */
.diff-block { padding: 0; }
.diff-lines {
  list-style: none;
  margin: 0;
  padding: 8px 0;
}
.diff-line {
  display: grid;
  grid-template-columns: 16px 38px 38px 1fr;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.6;
  border-left: 2px solid transparent;
}
.diff-line.add    { background: rgba(74, 222, 128, 0.07); border-left-color: rgba(74, 222, 128, 0.6); }
.diff-line.remove { background: rgba(244, 114, 182, 0.07); border-left-color: rgba(244, 114, 182, 0.55); }
.diff-line.context { color: #d4d4d4; }
.diff-gutter {
  text-align: center;
  color: var(--muted);
  user-select: none;
}
.diff-line.add .diff-gutter    { color: var(--green); }
.diff-line.remove .diff-gutter { color: var(--pink); }
.diff-no {
  text-align: right;
  padding-right: 10px;
  color: var(--border-strong);
  font-size: 11px;
  user-select: none;
}
.diff-code { white-space: pre; padding-right: 16px; }

.diff-stat {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  margin-right: 4px;
}
.diff-stat.add { color: var(--green); background: rgba(74, 222, 128, 0.10); border: 1px solid rgba(74, 222, 128, 0.35); }
.diff-stat.rem { color: var(--pink);  background: rgba(244, 114, 182, 0.10); border: 1px solid rgba(244, 114, 182, 0.35); }

.kv {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 8px 16px;
  font-size: 13px;
}
.kv dt {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.kv dd { margin: 0; }

.small { font-size: 12px; }

/* star button */
.star {
  background: transparent;
  border: 0;
  color: var(--border-strong);
  font-size: 18px;
  cursor: pointer;
  vertical-align: middle;
  margin-left: 8px;
  padding: 0 4px;
}
.star:hover { color: var(--accent); }


.page-head { margin-bottom: 22px; }
.page-head h1 {
  margin: 4px 0 6px;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.page-head .lead { color: var(--muted); margin: 0; max-width: 70ch; font-size: 13px; }
.page-head .kicker {
  display: inline-block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  font-weight: 600;
}
.page-head .meta { color: var(--muted); margin: 6px 0 0; }
.page-head .meta a { color: var(--text); }

/* ── stat cards ───────────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}
.stat-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 80ms ease;
}
.stat-card:hover { border-color: var(--border-strong); }
.stat-card.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.stat-card.is-active .stat-value { color: var(--accent); }
.stat-label { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; }
.stat-value { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.15; }

/* ── panels ───────────────────────────────────────────────────── */
.panel {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 16px;
}
.panel + .panel { margin-top: 0; }
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.panel-head h2 { margin: 0; font-size: 13px; font-weight: 600; letter-spacing: -0.005em; }
.panel-head .muted { font-size: 12px; }
.two-col > .panel { margin-bottom: 0; }

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
@media (max-width: 960px) {
  .two-col { grid-template-columns: 1fr; }
}

/* ── tables ───────────────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table th {
  text-align: left;
  font-weight: 500;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: var(--bg-elev-2); }

.result-count { margin: 12px 4px 0; font-size: 12px; }

/* ── lists ────────────────────────────────────────────────────── */
.list { list-style: none; padding: 0; margin: 0; }
.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 4px;
  border-bottom: 1px solid var(--border);
}
.list-item:last-child { border-bottom: 0; }
.list-title { font-weight: 500; }
.list-title:hover { color: var(--accent); }

/* ── feeds ────────────────────────────────────────────────────── */
.feed { list-style: none; padding: 0; margin: 0; }
.feed-item {
  display: grid;
  /* type (auto pill) | actor (1fr, truncates) | time (auto) |
     target (auto, only on /history). Listing the type as `auto` lets
     the pill size to its content so the actor cell gets the rest. */
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  gap: 14px;
  align-items: center;
  padding: 9px 4px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.feed-item:last-child { border-bottom: 0; }
.feed-type {
  font-family: var(--mono);
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  color: var(--text);
  white-space: nowrap;
  display: inline-flex;
  align-self: start;
}
.feed-type.project    { color: var(--accent); border-color: rgba(249, 115, 22, 0.35); background: var(--accent-soft); }
.feed-type.port       { color: var(--blue);   border-color: rgba(96, 165, 250, 0.32); background: rgba(96,165,250,0.08); }
.feed-type.type_registry { color: var(--violet); border-color: rgba(167, 139, 250, 0.32); background: rgba(167,139,250,0.08); }
.feed-type.reservation   { color: var(--pink);   border-color: rgba(244, 114, 182, 0.32); background: rgba(244,114,182,0.08); }
.feed-actor {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  /* `min-width: 0` lets the grid item shrink below its content width
     so the ellipsis kicks in; without it the column stretches to fit
     the long `user:email (uuid)` string. */
  min-width: 0;
}
.feed-time { font-family: var(--mono); font-size: 12px; }
.feed-target { font-size: 12px; max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── chips ────────────────────────────────────────────────────── */
.chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
  margin-left: 8px;
}
.chip.backend  { color: var(--accent); border-color: rgba(249, 115, 22, 0.35); background: var(--accent-soft); }
.chip.frontend { color: var(--blue);   border-color: rgba(96, 165, 250, 0.32); background: rgba(96,165,250,0.08); }
.chip.batch    { color: var(--green);  border-color: rgba(74, 222, 128, 0.32); background: rgba(74,222,128,0.08); }
.chip.dashboard { color: var(--violet); border-color: rgba(167, 139, 250, 0.32); background: rgba(167,139,250,0.08); }
.chip.streaming { color: var(--pink);   border-color: rgba(244, 114, 182, 0.32); background: rgba(244,114,182,0.08); }
.chip.kind     { color: var(--text); }

/* ── badges ───────────────────────────────────────────────────── */
.badge-row { display: inline-flex; gap: 6px; }
.badge {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  font-size: 11px;
  font-weight: 500;
}
.badge.muted { color: var(--muted); }

/* ── forms ────────────────────────────────────────────────────── */
.filter-row {
  display: flex;
  align-items: end;
  gap: 12px;
  margin-bottom: 16px;
}
.filter-label {
  display: flex;
  flex-direction: column;
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  gap: 6px;
  flex: 1;
}
.filter-label input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 8px 10px;
  font-family: var(--mono);
  font-size: 13px;
}
.filter-label input:focus { outline: 1px solid var(--accent); border-color: var(--accent); }

.btn {
  background: var(--accent);
  color: #111;
  font-weight: 600;
  border: 0;
  border-radius: var(--radius-sm);
  padding: 9px 14px;
  cursor: pointer;
  font-family: var(--sans);
}
.btn:hover { filter: brightness(1.05); }

/* ── links ────────────────────────────────────────────────────── */
.link { color: var(--text); border-bottom: 1px dashed var(--border-strong); }
.link:hover { color: var(--accent); border-bottom-color: var(--accent); }
.link-subtle { color: var(--muted); }
.link-subtle:hover { color: var(--accent); }

/* Type-coded link tints. Apply by adding the type as a class on the
   <a class="link backend">. Default `link` color wins until hover; the
   type class shifts the hover accent to the entity's signature color. */
.link.backend:hover    { color: var(--accent); border-bottom-color: var(--accent); }
.link.frontend:hover   { color: var(--blue);   border-bottom-color: var(--blue); }
.link.batch:hover      { color: var(--green);  border-bottom-color: var(--green); }
.link.dashboard:hover  { color: var(--violet); border-bottom-color: var(--violet); }
.link.streaming:hover  { color: var(--pink);   border-bottom-color: var(--pink); }
.link.transformations:hover { color: var(--pink); border-bottom-color: var(--pink); }

/* ── services list header + inline filter ─────────────────────── */
.services-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}
.inline-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--muted);
  width: 220px;
}
.inline-filter input {
  background: transparent;
  border: 0;
  outline: none;
  color: var(--text);
  font: inherit;
  flex: 1;
}
.inline-filter input::placeholder { color: var(--muted); }
.inline-filter:focus-within { border-color: var(--accent); color: var(--accent); }

/* ── tech pill (per-row language/framework/engine badge) ──────── */
.tech-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  text-transform: lowercase;
}
.tech-pill.rust       { color: #f97316; border-color: rgba(249,115,22,0.35); }
.tech-pill.go         { color: #00add8; border-color: rgba(0,173,216,0.35); }
.tech-pill.python     { color: #ffd43b; border-color: rgba(255,212,59,0.35); }
.tech-pill.typescript { color: #3178c6; border-color: rgba(49,120,198,0.45); }
.tech-pill.nextjs     { color: #ffffff; border-color: var(--border-strong); }
.tech-pill.sveltekit  { color: #ff3e00; border-color: rgba(255,62,0,0.35); }
.tech-pill.vite       { color: #b975ff; border-color: rgba(185,117,255,0.4); }
.tech-pill.astro      { color: #ff5d01; border-color: rgba(255,93,1,0.35); }
.tech-pill.dbt        { color: #ff694b; border-color: rgba(255,105,75,0.4); }
.tech-pill.sqlmesh    { color: #4ec9b0; border-color: rgba(78,201,176,0.35); }
.tech-pill.spark      { color: #e25a1c; border-color: rgba(226,90,28,0.35); }
.tech-pill.grafana    { color: #f46800; border-color: rgba(244,104,0,0.4); }
.tech-pill.metabase   { color: #509ee3; border-color: rgba(80,158,227,0.4); }
.tech-pill.looker     { color: #4285f4; border-color: rgba(66,133,244,0.4); }
.tech-pill.superset   { color: #20a7c9; border-color: rgba(32,167,201,0.4); }

/* ── pagination footer ───────────────────────────────────────── */
.table-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 4px 0;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}
.pager {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.pager-pos { font-family: var(--mono); }
.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font: inherit;
}
.btn-ghost:hover:not(:disabled) { color: var(--text); border-color: var(--border-strong); }
.btn-ghost:disabled { opacity: 0.45; cursor: not-allowed; }

/* ── empty ────────────────────────────────────────────────────── */
.empty {
  text-align: center;
  padding: 28px 12px;
  color: var(--muted);
  font-size: 13px;
}

/* ── count pills (services list) ──────────────────────────────── */
.count-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--bg-elev-2);
}
.count-pill.sends    { color: var(--accent); border-color: rgba(249,115,22,0.4);  background: var(--accent-soft); }
.count-pill.receives { color: var(--blue);   border-color: rgba(96,165,250,0.4);  background: rgba(96,165,250,0.08); }

.th-arrow { color: var(--accent); margin-right: 4px; }

/* ── schema viewer ────────────────────────────────────────────── */
.schema-file { margin-top: 10px; }
.schema-file:first-child { margin-top: 0; }
.schema-file-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 0 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}
.schema-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  position: relative;
  top: 1px;
}
.schema-tab.is-active {
  color: var(--accent);
  border-bottom: 2px solid var(--accent);
}
.schema-icon { font-family: var(--mono); }

.code-block {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin: 0;
  padding: 0;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.55;
  overflow: auto;
  max-height: 600px;
}
.code-lines {
  list-style: none;
  counter-reset: line;
  margin: 0;
  padding: 12px 0;
}
.code-lines li {
  counter-increment: line;
  padding: 0 16px 0 56px;
  position: relative;
  white-space: pre;
  color: #d4d4d4;
}
.code-lines li::before {
  content: counter(line);
  position: absolute;
  left: 0;
  width: 44px;
  text-align: right;
  padding-right: 12px;
  color: var(--border-strong);
  user-select: none;
}
.code-lines li:hover { background: var(--bg-elev); }

/* ── syntax highlighting tokens ───────────────────────────────── */
/* Palette inspired by VS Code's "Dark+" theme, tuned for our bg.
   Token spans are inline; whitespace is emitted as Plain spans so
   alignment is preserved without forcing `white-space: pre` on each
   span (the `<li>` already pre-wraps via the .code-lines styling). */
.t-keyword { color: #c586c0; }   /* fn, message, if, return, ... */
.t-type    { color: #4ec9b0; }   /* int32, allow, deny, ... */
.t-ident   { color: #9cdcfe; }   /* identifiers, field names */
.t-string  { color: #ce9178; }   /* "hello" */
.t-number  { color: #b5cea8; }   /* 1, 1.0 */
.t-comment { color: #6a9955; font-style: italic; } /* // ... */
.t-punct   { color: #d4d4d4; }   /* { } ( ) ; = , */
.t-plain   { color: inherit; }   /* whitespace, fallback */

/* ── search results ───────────────────────────────────────────── */
.search-results { list-style: none; margin: 0; padding: 0; }
.search-results li { border-bottom: 1px solid var(--border); }
.search-results li:last-child { border-bottom: 0; }
.search-hit {
  display: grid;
  grid-template-columns: 80px 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 10px 8px;
  border-radius: var(--radius-sm);
}
.search-hit:hover { background: var(--bg-elev-2); }
.hit-kind {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  text-align: center;
  border: 1px solid var(--border);
}
.hit-kind.project       { color: var(--accent); border-color: rgba(249,115,22,0.4); background: var(--accent-soft); }
.hit-kind.port          { color: var(--blue);   border-color: rgba(96,165,250,0.4); background: rgba(96,165,250,0.08); }
.hit-kind.type_registry { color: var(--violet); border-color: rgba(167,139,250,0.4); background: rgba(167,139,250,0.08); }
.hit-name { font-weight: 500; }
.hit-context { white-space: nowrap; }
.search-hit:hover .hit-name { color: var(--accent); }

/* ── type registry page ───────────────────────────────────────── */
.with-field {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  flex-wrap: wrap;
}
.port-kind {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.port-kind:last-child { border-bottom: 0; padding-bottom: 0; }
.port-kind:first-child { padding-top: 0; }
.port-kind-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.port-kind-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
@media (max-width: 720px) { .port-kind-body { grid-template-columns: 1fr; } }
.port-kind-body h4 {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.kv-list { list-style: none; padding: 0; margin: 0; }
.kv-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  flex-wrap: wrap;
  border-bottom: 1px dashed var(--border);
}
.kv-list li:last-child { border-bottom: 0; }

.chip.type_registry { color: var(--violet); border-color: rgba(167,139,250,0.4); background: rgba(167,139,250,0.08); }

/* ── markdown / documentation panel ───────────────────────────── */
.markdown {
  color: var(--text);
  font-size: 14px;
  line-height: 1.7;
  max-width: 78ch;
}
.markdown > *:first-child { margin-top: 0; }
.markdown > *:last-child  { margin-bottom: 0; }
.markdown h1, .markdown h2, .markdown h3, .markdown h4 {
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 22px 0 6px;
  line-height: 1.3;
}
.markdown h1:first-child, .markdown h2:first-child { margin-top: 0; }
.markdown h1 { font-size: 22px; border-bottom: 1px solid var(--border); padding-bottom: 6px; }
.markdown h2 { font-size: 18px; }
.markdown h3 { font-size: 15px; color: var(--accent); text-transform: uppercase; letter-spacing: 0.05em; }
.markdown h4 { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.markdown p { margin: 8px 0 12px; }
.markdown ul, .markdown ol { padding-left: 22px; margin: 8px 0 12px; }
.markdown li { margin: 4px 0; }
.markdown a { color: var(--accent); }
.markdown a:hover { text-decoration: underline; }
.markdown code {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 5px;
  font-size: 12px;
}
.markdown pre {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin: 12px 0;
  overflow: auto;
  font-size: 12px;
  line-height: 1.55;
}
.markdown pre code { background: transparent; border: 0; padding: 0; font-size: inherit; }
.markdown blockquote {
  border-left: 3px solid var(--accent);
  padding: 4px 14px;
  margin: 12px 0;
  color: var(--muted);
  background: var(--accent-soft);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.markdown table {
  border-collapse: collapse;
  width: 100%;
  margin: 12px 0;
  font-size: 13px;
}
.markdown th, .markdown td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
.markdown th {
  font-weight: 500;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.markdown hr { border: 0; border-top: 1px solid var(--border); margin: 18px 0; }
.doc-panel { background: var(--bg-elev); }

/* ── Auth (login + register) ────────────────────────────────────── */
.auth-panel { max-width: 420px; margin: 32px auto; }
.auth-form { display: flex; flex-direction: column; gap: 12px; padding: 16px 20px 24px; }
.auth-form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.auth-form input {
  padding: 7px 10px;
  border: 1px solid #d4d4d8;
  border-radius: 4px;
  font: inherit;
  background: #fff;
}
.auth-form input:focus { outline: 2px solid #6366f1; outline-offset: -1px; }
.auth-form button {
  margin-top: 4px;
  padding: 8px 14px;
  background: #1f1f23;
  color: #fff;
  border: none;
  border-radius: 4px;
  font: inherit;
  cursor: pointer;
}
.auth-form button:hover { background: #36363c; }
.auth-panel .error {
  margin: 0 20px;
  padding: 8px 12px;
  background: #fef2f2;
  border-left: 3px solid #dc2626;
  color: #991b1b;
  font-size: 13px;
}
.auth-panel .muted.small { padding: 0 20px 16px; }
.device-code-display { text-align: center; margin: 16px 0; }
.device-code-display code {
  font-size: 22px;
  letter-spacing: 4px;
  padding: 6px 14px;
  background: #f4f4f5;
  border-radius: 4px;
}
.auth-panel .success {
  margin: 16px 20px;
  padding: 10px 14px;
  background: #ecfdf5;
  border-left: 3px solid #16a34a;
  color: #14532d;
  font-size: 13px;
}
.oauth-button {
  display: block;
  margin: 8px 20px 0;
  padding: 8px 14px;
  text-align: center;
  background: #fff;
  border: 1px solid #d4d4d8;
  border-radius: 4px;
  color: #1f1f23;
  text-decoration: none;
  font: inherit;
  font-weight: 500;
}
.oauth-button:hover { background: #f4f4f5; }
.auth-divider {
  display: flex;
  align-items: center;
  margin: 12px 20px 0;
  gap: 8px;
}
.auth-divider::before, .auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #e4e4e7;
}

/* ── Click-to-copy affordance + toast ──────────────────────────── */
.js-copy { cursor: pointer; }
.js-copy:hover { color: var(--text); }
.copy-toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  padding: 6px 12px;
  background: var(--bg-elev-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity .15s ease, transform .15s ease;
  z-index: 1000;
  pointer-events: none;
}
.copy-toast.is-visible { opacity: 1; transform: translateY(0); }

/* ── digest pill (GitHub-style short SHA) ─────────────────────── */
/* Visual fingerprint for content-addressed digests. The visible 7
   chars are not meant to be read — they exist so the eye notices
   when the value changes. Full digest is on hover + click-to-copy. */
.digest-pill {
  display: inline-block;
  padding: 1px 6px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.02em;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--muted);
  vertical-align: baseline;
}
.digest-pill:hover { color: var(--text); border-color: var(--border-strong); }

/* ── digest pill (GitHub-style short SHA) ─────────────────────── */
/* Visual fingerprint for content-addressed digests. The visible 7
   chars are not meant to be read — they exist so the eye notices
   when the value changes. Full digest is on hover + click-to-copy. */
.digest-pill {
  display: inline-block;
  padding: 1px 6px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.02em;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--muted);
  vertical-align: baseline;
}
.digest-pill:hover { color: var(--text); border-color: var(--border-strong); }
