/* ============================================================================
   ocellio — brand design system. One hand-written sheet, no framework, no
   @import, no external CDN (CSP: default-src 'none'; style/script/font 'self').
   OCELLIO brand kit — navy #102A43 · vivid purple #A05CFF · teal #4FD1C5 ·
   light grey #E4E7EB. Light (default) / dark, both on the brand palette.
   Display/wordmark = Sora · body = Hanken Grotesk · data = monospace.
   Fonts are self-hosted under ./fonts/ (relative → resolves under /assets/<v>/).
   ============================================================================ */

@font-face { font-family: "Sora"; font-style: normal; font-weight: 600; font-display: swap;
  src: url(fonts/sora-600.woff2) format("woff2"); }
@font-face { font-family: "Sora"; font-style: normal; font-weight: 700; font-display: swap;
  src: url(fonts/sora-700.woff2) format("woff2"); }
@font-face { font-family: "Hanken Grotesk"; font-style: normal; font-weight: 400; font-display: swap;
  src: url(fonts/hanken-400.woff2) format("woff2"); }
@font-face { font-family: "Hanken Grotesk"; font-style: normal; font-weight: 500; font-display: swap;
  src: url(fonts/hanken-500.woff2) format("woff2"); }
@font-face { font-family: "Hanken Grotesk"; font-style: normal; font-weight: 600; font-display: swap;
  src: url(fonts/hanken-600.woff2) format("woff2"); }

:root {
  /* brand constants (theme-independent) */
  --purple: #a05cff; --teal-vivid: #4fd1c5; --navy: #102a43;
  --brand-grad: linear-gradient(135deg, #a05cff 0%, #4fd1c5 100%);

  /* light (default) */
  --ink:    #eceff3;   /* page */
  --panel:  #ffffff;   /* surfaces */
  --raised: #f4f7fb;   /* hover / inputs */
  --line:   #dbe1e9;   /* hairlines */
  --line2:  #eef1f5;   /* quiet table-row dividers */
  --fg:     #102a43;   /* navy ink */
  --muted:  #566679;
  --faint:  #6b7888;
  --faint2: #9aa7b6;   /* breadcrumb chevrons, timestamps */
  --pagebg: #f4f7fb;   /* detail/doc reading background */
  --accent: #7a3df0;   /* brand purple, contrast-tuned on white */
  --accent-hi: #6a2fd6;
  --on-accent: #ffffff;
  --teal:   #168a7f;   /* teal that reads as text on light */
  --danger: #d8453a;
  --ok:     #168a7f;
  --glow:   rgba(160,92,255,0.12);

  /* Puls/Shell aliases (S5-A): the component stylesheets (layout.css,
     components.css) reference these; without a definition their light fallback
     literals would win in dark theme (white nav/cards on navy). --surface/--border
     alias the theme-switched --panel/--line (var() resolves lazily, so one alias
     serves both themes; re-stated in the dark block for explicitness).
     --accent-soft/--accent-border are the Inbox/marker tint — per-theme values. */
  --surface: var(--panel); --border: var(--line);
  --accent-soft: #efe7ff; --accent-border: #c9b8ff;

  --font-display: "Sora", ui-sans-serif, system-ui, sans-serif;
  --font-sans: "Hanken Grotesk", ui-sans-serif, -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Code", Menlo, monospace;

  --r: 12px; --r-sm: 7px;
  --maxw: 1120px;
  --shadow: 0 14px 40px -18px rgba(16,42,67,0.28);
}

:root[data-theme="dark"] {
  --ink:    #081320;   /* deep navy-black */
  --panel:  #0f2740;
  --raised: #16344f;
  --line:   #26466a;
  --line2:  #1c3a59;
  --fg:     #e7eef6;
  --muted:  #93a7bd;
  --faint:  #7e98b5;
  --faint2: #6f88a3;
  --pagebg: #0b1b2e;
  --accent: #a05cff;   /* vivid brand purple pops on navy */
  --accent-hi: #b685ff;
  --on-accent: #15052e; /* dark ink on the lighter purple = readable button text */
  --teal:   #4fd1c5;
  --danger: #ff6b5c;
  --ok:     #4fd1c5;
  --glow:   rgba(160,92,255,0.16);
  --shadow: 0 16px 44px -18px rgba(0,0,0,0.55);

  /* Puls/Shell aliases (dark): --surface/--border track the dark --panel/--line;
     the Inbox reads as a translucent-purple panel on navy (derived from --glow). */
  --surface: var(--panel); --border: var(--line);
  --accent-soft: rgba(160,92,255,0.14); --accent-border: rgba(160,92,255,0.42);
}

* { box-sizing: border-box; }
* > * { min-width: 0; }

html { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  color: var(--fg);
  background: var(--ink);
  /* atmosphere: a soft two-point brand mesh (purple top-right, teal bottom-left) */
  background-image:
    radial-gradient(820px 460px at 90% -12%, color-mix(in oklab, var(--purple) 16%, transparent), transparent 62%),
    radial-gradient(760px 460px at -10% 112%, color-mix(in oklab, var(--teal-vivid) 14%, transparent), transparent 62%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hi); }

h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: 1.12;
  letter-spacing: -0.015em; }
h1 { font-size: clamp(1.9rem, 1.3rem + 1.8vw, 2.6rem); margin: 0 0 6px; font-weight: 700; }
h2 { font-size: 1.32rem; margin: 34px 0 12px; font-weight: 600; }
.muted { color: var(--muted); }
.error { color: var(--danger); min-height: 1.2em; }
code, pre, .mono { font-family: var(--font-mono); }

main { max-width: var(--maxw); margin: 0 auto; padding: 40px 22px 96px;
  animation: rise 0.5s cubic-bezier(.2,.7,.2,1) both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { main { animation: none; } }

/* ---- top bar ------------------------------------------------------------ */
.nav {
  display: flex; align-items: center; gap: 2px;
  padding: 0 16px; height: 56px;
  background: color-mix(in oklab, var(--panel) 88%, transparent);
  backdrop-filter: saturate(1.3) blur(8px);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.nav .brand { display: flex; align-items: center; gap: 9px; margin-right: 8px;
  padding: 4px 6px 4px 0; text-decoration: none; }
.nav .brand:hover { background: transparent; }
.nav .brand-mark { width: 26px; height: 26px; display: block; flex: none; }
.nav .brand-word { font-family: var(--font-display); font-weight: 700; font-size: 1.06rem;
  color: var(--fg); letter-spacing: -0.02em; transition: color .15s; }
.nav .brand:hover .brand-word { color: var(--accent); }
.nav-divider { width: 1px; height: 22px; background: var(--line); margin: 0 12px 0 4px; flex: none; }

/* primary tabs — Dashboard · Graph · Entities. NB: no `transition: all` here;
   the active pill is set server-side from the route, transitions are scoped. */
.nav-tab {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 13.5px; font-weight: 500; color: var(--muted);
  padding: 7px 12px; border-radius: var(--r-sm); text-decoration: none;
  transition: background .15s, color .15s;
}
.nav-tab:hover { background: var(--raised); color: var(--fg); }
.nav-tab.is-active {
  color: var(--accent); font-weight: 600;
  background: color-mix(in oklab, var(--accent) 13%, transparent);
}
.nav-tab.is-active:hover { color: var(--accent); background: color-mix(in oklab, var(--accent) 16%, transparent); }
.nav-ico { flex: none; }

/* search pill → opens the ⌘K palette (cmdk.js) */
.search-pill {
  margin-left: auto; display: inline-flex; align-items: center; gap: 8px;
  height: 34px; width: 178px; padding: 0 9px 0 11px; margin-right: 6px;
  background: var(--ink); color: var(--faint); border: 1px solid var(--line);
  border-radius: 9px; cursor: pointer; font: inherit;
  transition: border-color .15s;
}
.search-pill:hover { filter: none; border-color: var(--accent); }
.search-pill:hover .sp-ico { color: var(--accent); }
.search-pill .sp-ico { color: var(--faint); flex: none; }
.search-pill .sp-text { font-size: 12.5px; color: var(--faint); margin-right: auto; }
.search-pill .sp-kbd {
  font-family: var(--font-mono); font-size: 10.5px; color: var(--faint);
  border: 1px solid var(--line); background: var(--panel); border-radius: 5px; padding: 1px 5px;
}

/* manage + account dropdown shells */
.manage-wrap, .acct-wrap { position: relative; }
.menu-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 11px;
  background: transparent; color: var(--muted); border: none; border-radius: var(--r-sm);
  cursor: pointer; font: inherit; font-size: 13.5px; font-weight: 500;
  transition: background .15s, color .15s;
}
.menu-btn:hover { filter: none; background: var(--raised); color: var(--fg); }
.menu-chev { color: var(--faint); flex: none; }
.manage-menu {
  position: absolute; top: 44px; right: 0; z-index: 50; width: 540px; padding: 16px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow);
}
.manage-head { display: flex; align-items: baseline; gap: 8px;
  padding: 0 4px 10px; margin-bottom: 6px; border-bottom: 1px solid var(--line2); }
.manage-head strong { font-family: var(--font-display); font-size: 14px; font-weight: 600; color: var(--fg); }
.manage-head span { font-size: 12px; color: var(--faint); }
.manage-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 2px 14px; align-items: start; }
.menu-label { font-size: 10px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--faint); padding: 2px 10px 6px; margin: 0; }
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; box-sizing: border-box;
  padding: 8px 10px; border-radius: var(--r-sm); text-decoration: none;
  color: var(--muted); font-size: 13px; font-weight: 500;
  transition: background .12s, color .12s;
}
.menu-item:hover { background: var(--raised); color: var(--fg); }
.menu-item:hover .mi-ico { color: var(--accent); }
.mi-ico { color: var(--faint); width: 16px; text-align: center; flex: none; font-size: 14px; }
.menu-item-btn { background: transparent; border: none; cursor: pointer; font: inherit;
  font-size: 13px; font-weight: 500; text-align: left; }
.menu-item-btn:hover { filter: none; }

.nav-help {
  color: var(--muted); font-size: 13.5px; font-weight: 500; padding: 7px 11px;
  border-radius: var(--r-sm); text-decoration: none; transition: background .15s, color .15s;
}
.nav-help:hover { background: var(--raised); color: var(--fg); }
.nav-help.is-active { color: var(--accent); }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; margin-left: 4px; padding: 0;
  background: transparent; color: var(--muted); border: 1px solid var(--line);
  border-radius: 9px; cursor: pointer; transition: border-color .15s, color .15s;
}
.icon-btn:hover { filter: none; border-color: var(--accent); color: var(--accent); }

.acct {
  display: inline-flex; align-items: center; gap: 9px; height: 38px;
  margin-left: 8px; padding: 3px 11px 3px 4px;
  background: transparent; color: var(--fg); border: 1px solid var(--line);
  border-radius: 999px; cursor: pointer; font: inherit; transition: background .15s;
}
.acct:hover { filter: none; background: var(--raised); }
.acct-avatar {
  width: 28px; height: 28px; border-radius: 50%; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700; font-size: 12px; color: #fff;
  background: var(--brand-grad);
}
.acct-stack { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.1; }
.acct-name { font-size: 12.5px; font-weight: 600; color: var(--fg); }
.acct-ws { font-size: 10.5px; color: var(--faint); }
.acct-chev { color: var(--faint); flex: none; }
.acct-menu {
  position: absolute; top: 46px; right: 0; z-index: 50; width: 190px; padding: 8px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow);
}
.acct-logout { display: block; margin: 0; }

.ctrl-btn {
  background: transparent; color: var(--muted); border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: 6px 12px; cursor: pointer; font: inherit;
  font-size: 0.82rem; transition: all .15s;
}
.ctrl-btn:hover { color: var(--fg); border-color: var(--accent); }
.nav-logout { display: inline; }

/* ---- page sub-header (title · breadcrumb · right slot) ------------------- */
.page-head {
  display: flex; align-items: center; gap: 12px; height: 46px; padding: 0 24px;
  background: var(--panel); border-bottom: 1px solid var(--line2);
}
.ph-title { font-family: var(--font-display); font-weight: 600; font-size: 15px; color: var(--fg); }
.ph-sep { color: var(--faint2); }
.ph-crumb { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ph-right { margin-left: auto; display: flex; align-items: center; gap: 10px;
  font-size: 12.5px; color: var(--muted); }
.ph-right strong { color: var(--fg); }

/* Full-bleed app views (dashboard, entities) break out of the centred `main`
   into a full-height flex column: sticky nav + fixed page-head, the content
   area scrolls internally so the cluster drawer/table reach the viewport edges
   like the prototype. */
body.app-full { display: flex; flex-direction: column; height: 100vh;
  overflow: hidden; background-image: none; }
body.app-full .page-head { flex: none; }
body.app-full main { flex: 1; min-height: 0; max-width: none; margin: 0;
  padding: 0; animation: none; display: flex; }

/* ---- flash + show-once token ------------------------------------------- */
.flash {
  max-width: var(--maxw); margin: 18px auto -8px; padding: 11px 16px;
  background: color-mix(in oklab, var(--ok) 14%, var(--panel));
  border: 1px solid color-mix(in oklab, var(--ok) 50%, var(--line));
  border-left: 3px solid var(--ok); border-radius: var(--r-sm); color: var(--fg);
}
.token-box {
  max-width: var(--maxw); margin: 18px auto -8px; padding: 14px 16px;
  background: var(--glow); border: 1px solid var(--accent); border-radius: var(--r);
}
.token-once { display: block; margin-top: 8px; font-family: var(--font-mono);
  font-size: 0.92rem; word-break: break-all; user-select: all; color: var(--accent-hi); }

/* ---- buttons + forms ---------------------------------------------------- */
button, .btn {
  font: inherit; font-size: 0.9rem; font-weight: 500; cursor: pointer;
  background: var(--accent); color: var(--on-accent); border: 1px solid transparent;
  border-radius: var(--r-sm); padding: 8px 16px; transition: transform .08s, filter .15s, background .15s;
}
button:hover, .btn:hover { filter: brightness(1.06); }
button:active, .btn:active { transform: translateY(1px); }
.ctrl-btn, .nav button { font-weight: 400; }
input, select, textarea {
  font: inherit; color: var(--fg); background: var(--raised);
  border: 1px solid var(--line); border-radius: var(--r-sm); padding: 9px 11px;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 28%, transparent);
}
::placeholder { color: var(--faint); }
fieldset { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 14px; }
legend { color: var(--muted); font-size: 0.78rem; padding: 0 6px; text-transform: uppercase;
  letter-spacing: 0.08em; }

/* ---- auth card (login / bootstrap) — the first impression ---------------- */
.auth-card {
  max-width: 408px; margin: 11vh auto 0; padding: 38px 36px 34px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 14px;
  position: relative; overflow: hidden; text-align: center;
  animation: rise 0.55s cubic-bezier(.2,.7,.2,1) both;
}
.auth-card::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 3px;
  background: var(--brand-grad);
}
.auth-mark { width: 66px; height: 66px; margin: 2px auto 0; display: block; }
.auth-card h1 { font-size: 2.5rem; margin: -4px 0 0; letter-spacing: -0.03em; color: var(--fg); }
/* Gradient wordmark only where text-clip is supported; otherwise the base rule
   above keeps it a solid, readable navy/off-white (no invisible-text risk). */
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .auth-card h1 { background: var(--brand-grad); -webkit-background-clip: text;
    background-clip: text; -webkit-text-fill-color: transparent; color: transparent; }
}
.auth-card input { padding: 11px 13px; }
.auth-card button[type="submit"], .auth-card #login-btn, .auth-card #bootstrap-btn,
.auth-card #enroll-btn, .auth-card #enroll-continue, .auth-card #passkey-auth {
  padding: 11px; font-size: 0.95rem; margin-top: 4px;
}
/* v1 'initial' mode: the token form IS the login box content */
.auth-card .token-login {
  display: flex; flex-direction: column; gap: 10px; text-align: left;
  margin-top: 4px;
}
.auth-card .token-login label { font-size: 0.82rem; }
/* v1 'passkey' confirm mode: ghost Cancel below the confirm button */
.auth-card .cancel-login { margin-top: 8px; }
.auth-card .cancel-login .btn-ghost {
  width: 100%; padding: 10px; background: transparent; color: var(--muted);
  border: 1px solid var(--line); border-radius: var(--r-sm); cursor: pointer;
}
.auth-card .cancel-login .btn-ghost:hover { color: var(--fg); border-color: var(--muted); }
.auth-card .setup-steps { text-align: left; margin: 0; padding-left: 1.3em; }
.auth-card .setup-steps li { margin-bottom: 6px; }
.auth-card .info {
  color: var(--muted); font-size: 0.88rem; background: var(--raised);
  border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 12px;
}
/* one-time token reveal after first-passkey enrollment */
.auth-card #token-reveal { display: flex; flex-direction: column; gap: 10px; }
.auth-card #token-reveal[hidden] { display: none; }
.auth-card #new-token {
  background: var(--glow); border: 1px dashed var(--accent);
  border-radius: var(--r-sm); padding: 10px 12px; margin-top: 0;
}

/* ---- context chips / filter bars ---------------------------------------- */
.contexts { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.contexts a {
  padding: 5px 13px; border: 1px solid var(--line); border-radius: 999px;
  color: var(--muted); font-size: 0.82rem; transition: all .15s;
}
.contexts a:hover { border-color: var(--accent); color: var(--fg); }
.contexts a.active { color: var(--on-accent); background: var(--accent); border-color: var(--accent); }
.search, .filter-bar, .share-form, .token-create form {
  display: flex; gap: 10px; flex-wrap: wrap; margin: 16px 0; align-items: flex-end;
}
.search input, .filter-bar input[name="q"] { flex: 1 1 260px; }

/* ---- tables — editorial hairline rules ---------------------------------- */
table { width: 100%; border-collapse: collapse; margin: 10px 0; }
th, td { text-align: left; padding: 11px 12px; vertical-align: top; }
th { color: var(--faint); font-weight: 700; font-size: 0.69rem; text-transform: uppercase;
  letter-spacing: 0.06em; border-bottom: 1px solid var(--line); }
td { border-bottom: 1px solid var(--line2); }    /* quiet row dividers (prototype) */
tbody tr { transition: background .12s; }
tbody tr:hover { background: color-mix(in oklab, var(--accent) 6%, transparent); }
td code { font-size: 0.85rem; color: var(--teal); }

/* ---- kind badge --------------------------------------------------------- */
.kind { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 0.74rem;
  font-family: var(--font-mono); letter-spacing: 0.02em;
  background: color-mix(in oklab, var(--teal) 16%, transparent);
  border: 1px solid color-mix(in oklab, var(--teal) 40%, transparent); color: var(--teal); }

/* ---- entity detail (v1 layout: breadcrumb, badge row, two-column grid) -- */
.breadcrumb { font-size: 0.8rem; color: var(--muted); margin-bottom: 10px;
  overflow-wrap: anywhere; word-break: break-all; }
.breadcrumb .mono { font-family: var(--font-mono); }
.entity-title { overflow-wrap: anywhere; word-wrap: break-word; }
.badge-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center;
  margin: 4px 0 6px; max-width: 100%; color: var(--muted); font-size: 0.85rem; }
.tag { display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 0.74rem; color: var(--muted); border: 1px solid var(--line); }
.tag.mono { font-family: var(--font-mono); }
/* v1 .grid: content left, share + connections right; collapses on mobile.
   min-width:0 on children — grid items default to min-width:auto and overflow. */
.grid { display: grid; grid-template-columns: 1fr minmax(280px, 380px);
  gap: 26px; margin-top: 14px; }
.grid > * { min-width: 0; }
@media (max-width: 860px) { .grid { grid-template-columns: 1fr; gap: 0; } }
.card { background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r); padding: 16px; margin-bottom: 22px;
  overflow-wrap: anywhere; max-width: 100%; }
.card pre { margin: 0; }
.connection-row { padding: 7px 0; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 8px; font-size: 0.85rem; }
.connection-row:last-child { border-bottom: none; }
.connection-relation { font-family: var(--font-mono); font-size: 0.69rem;
  color: var(--muted); text-transform: uppercase; min-width: 120px; }
.connection-peer { flex: 1; overflow-wrap: anywhere; }
.secret-flag { color: var(--danger); border: 1px solid var(--danger);
  padding: 1px 9px; border-radius: 999px; font-size: 0.74rem; }
pre {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r);
  border-left: 3px solid color-mix(in oklab, var(--accent) 60%, var(--line));
  padding: 16px; overflow: auto; white-space: pre-wrap; word-break: break-word;
  font-size: 0.88rem; line-height: 1.55;
}
.markdown-body pre.plain { font-family: var(--font-sans); font-size: 1rem; line-height: 1.72;
  border-left-color: var(--accent); }

/* ---- badges / misc ------------------------------------------------------ */
.badge-current { background: var(--glow); border: 1px solid var(--accent);
  color: var(--accent-hi); padding: 2px 10px; border-radius: 999px; font-size: 0.76rem; }
.signout-device { margin-top: 22px; }
/* CSP-clean utilities (no inline style= — style-src 'self' forbids it) */
.inline-form { display: inline; }
.pager { margin-top: 20px; display: flex; gap: 10px; flex-wrap: wrap; }
.pager a, .pager span { display: inline-flex; align-items: center; height: 32px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--panel);
  color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.pager a:hover { border-color: var(--accent); color: var(--accent); }
.pager span { color: var(--faint); }
/* create-form card (tokens, users) */
.token-create { background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 18px 20px; margin: 16px 0 8px; }
.token-create > h2 { font-family: var(--font-display); font-size: 14px; font-weight: 600;
  margin: 0 0 14px; text-transform: none; letter-spacing: 0; color: var(--fg); }
td.ua { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--muted); font-family: var(--font-mono); font-size: 0.8rem; }
.token-create label { display: flex; flex-direction: column; gap: 5px; font-size: 0.82rem;
  color: var(--muted); }
/* [hidden] must win over the display:flex above (author rules beat the UA
   [hidden] rule regardless of specificity) — else the github/generic field
   toggle on /webhooks never actually hides anything. */
.token-create label[hidden], .token-create fieldset[hidden] { display: none; }
.token-create .chk { flex-direction: row; align-items: center; gap: 6px; color: var(--fg); }
.share-result { color: var(--ok); word-break: break-all; }

/* ---- inline entity share (step-up + 3 format variants) ------------------ */
.share-card { background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r); padding: 16px; }
.share-card .muted { margin: 0 0 12px; font-size: 0.85rem; }
/* [hidden] must win even though sibling rules set display (UA specificity tie). */
#share-status[hidden], #share-result[hidden], #share-error[hidden] { display: none; }
#share-status { margin: 12px 0 0; font-size: 0.85rem; }
#share-error.alert-danger { margin-top: 14px; padding: 12px 14px; color: var(--fg);
  background: color-mix(in oklab, var(--danger) 14%, var(--panel));
  border: 1px solid color-mix(in oklab, var(--danger) 50%, var(--line));
  border-left: 3px solid var(--danger); border-radius: var(--r-sm); }
.share-success { margin-top: 14px; padding: 12px 14px;
  background: color-mix(in oklab, var(--ok) 14%, var(--panel));
  border: 1px solid color-mix(in oklab, var(--ok) 50%, var(--line));
  border-left: 3px solid var(--ok); border-radius: var(--r-sm); }
.share-success > strong { display: block; }
.share-note { margin: 6px 0 12px; font-size: 0.82rem; }
.share-expiry { margin: 12px 0 0; font-size: 0.77rem; }
.share-link-row { margin: 10px 0; }
.share-link-row-label strong { font-size: 0.85rem; }
.share-link-row-label span { color: var(--muted); font-size: 0.78rem; margin-left: 8px; }
.share-link-box { display: flex; align-items: center; gap: 8px; margin-top: 4px;
  background: var(--raised); border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: 6px 8px; }
.share-link-url { flex: 1; font-family: var(--font-mono); font-size: 0.8rem;
  word-break: break-all; user-select: all; color: var(--fg); }
.share-copy-btn { flex: none; font-size: 0.78rem; padding: 5px 12px;
  background: var(--raised); color: var(--fg); border: 1px solid var(--line); }
.share-copy-btn:hover { border-color: var(--accent); filter: none; }
.share-copy-btn.copied { background: var(--glow); color: var(--accent-hi);
  border-color: var(--accent); }
.share-copy-btn.copied::before { content: "✓ "; }   /* v1 parity: checkmark prefix */

/* ---- graph view — v1 parity (plexus src/ui/pages/graph.ts) --------------
   v1's headExtra viewport lock + inline style= attributes ported to classes
   (strict CSP forbids both); v1 --color-* mapped like the other blocks:
   page→panel, surface→raised, border→line, ink/body→fg, subtle/light→faint. */
body.graph-page { height: 100vh; margin: 0; display: flex; flex-direction: column;
  overflow: hidden; }
body.graph-page .nav { flex-shrink: 0; }
body.graph-page main { flex: 1; overflow: hidden; padding: 0; min-height: 0;
  max-width: none; margin: 0; display: flex; flex-direction: column; animation: none; }
.graph-layout { display: flex; gap: 0; flex: 1; min-height: 0; }

/* chronological event column (history / time travel) */
#graph-feed { width: 340px; flex-shrink: 0; display: flex; flex-direction: column;
  background: var(--panel); border-right: 1px solid var(--line); min-height: 0; }
.gf-head { padding: 14px 16px 10px; border-bottom: 1px solid var(--line2); }
.gf-search { display: flex; align-items: center; gap: 8px; padding: 8px 12px;
  border: 1px solid var(--line); border-radius: 9px; background: var(--raised); color: var(--faint); }
.gf-search input { flex: 1; border: none; outline: none; background: transparent;
  font: inherit; font-size: 13px; color: var(--fg); }
.gf-search input:focus { box-shadow: none; }
.gf-list { flex: 1; overflow-y: auto; padding: 6px 14px 30px; min-height: 0; }
.gf-day { display: flex; align-items: center; gap: 9px; margin: 16px 2px 7px; }
.gf-day span { font-family: var(--font-display); font-size: 11px; font-weight: 700;
  letter-spacing: 0.08em; color: var(--faint); }
.gf-day::after { content: ""; flex: 1; height: 1px; background: var(--line2); }
.gf-row { display: flex; align-items: flex-start; gap: 11px; width: 100%; text-align: left;
  padding: 9px 11px; margin: 2px 0; border-radius: 10px; border: 1px solid transparent;
  background: transparent; cursor: pointer; font: inherit; transition: background .1s; }
.gf-row:hover { background: var(--raised); }
.gf-row.is-active { background: color-mix(in oklab, var(--accent) 12%, transparent);
  border-color: color-mix(in oklab, var(--accent) 35%, transparent); }
.gf-ico { flex: none; width: 26px; height: 26px; border-radius: 50%; display: flex;
  align-items: center; justify-content: center; font-size: 13px; font-weight: 700; color: #fff;
  background: color-mix(in oklab, var(--accent) 70%, var(--teal)); }
.gf-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.gf-title { font-size: 13.5px; font-weight: 600; color: var(--fg); line-height: 1.25;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gf-meta { font-size: 11.5px; color: var(--faint); }
.gf-time { flex: none; font-size: 11px; color: var(--faint2); font-variant-numeric: tabular-nums; padding-top: 1px; }
.gf-empty { color: var(--faint); font-size: 13px; padding: 16px 4px; }

/* filters become a floating overlay so the graph fills the canvas */
#graph-legend { position: absolute; top: 14px; right: 14px; z-index: 6; width: 188px;
  max-height: calc(100% - 332px); overflow-y: auto; padding: 8px 10px;
  background: color-mix(in oklab, var(--panel) 94%, transparent);
  border: 1px solid var(--line); border-radius: 13px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 4px; backdrop-filter: blur(6px); }
#graph-legend.is-collapsed { width: auto; max-height: none; overflow: visible; padding: 4px; }
.graph-legend-toggle { display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 5px 6px; background: transparent; border: none; cursor: pointer; font: inherit;
  font-size: 0.8rem; font-weight: 700; color: var(--fg); border-radius: 8px; }
.graph-legend-toggle:hover { background: var(--raised); filter: none; }
.graph-legend-toggle .gl-ico { color: var(--accent); flex: none; }
.graph-legend-toggle .gl-chev { margin-left: auto; color: var(--faint); flex: none;
  transition: transform .15s; }
#graph-legend.is-collapsed .gl-chev { transform: rotate(-90deg); }
#graph-legend.is-collapsed .graph-legend-body { display: none; }
.graph-legend-body { display: flex; flex-direction: column; gap: 4px; padding: 4px 3px 2px; }

/* "Stand" (as-of) indicator + keyboard hint overlays */
.graph-stand { position: absolute; top: 16px; left: 18px; z-index: 5; display: flex;
  align-items: center; gap: 9px; padding: 8px 14px; border-radius: 11px;
  background: color-mix(in oklab, var(--panel) 92%, transparent);
  border: 1px solid var(--line); box-shadow: 0 6px 20px -12px rgba(16,42,67,.4); }
.graph-stand svg { color: var(--accent); flex: none; }
.graph-stand .gs-label { font-size: 11px; font-weight: 600; color: var(--faint); }
.graph-stand .gs-value { font-family: var(--font-display); font-size: 13.5px; font-weight: 600; color: var(--fg); }
.graph-stand.is-past .gs-value { color: var(--accent); }
.graph-keyhint { position: absolute; bottom: 14px; left: 18px; z-index: 4;
  font-size: 11.5px; color: var(--faint2); max-width: 60%; }
.ph-zeitreise { display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 20px; font-weight: 600; font-size: 11.5px;
  background: color-mix(in oklab, var(--accent) 12%, transparent); color: var(--accent-hi); }
.ph-zeitreise .gz-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--teal); }
.graph-context-section { margin-bottom: 8px; }
.graph-micro-label { font-size: 0.62rem; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--faint); margin-bottom: 2px; }
#graph-context-filter { width: 100%; padding: 3px 6px; font-size: 0.77rem;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-sm);
  color: var(--fg); cursor: pointer; }
.graph-kind-row { display: flex; align-items: center; gap: 4px; cursor: pointer;
  white-space: nowrap; }
.graph-kind-row input[type="checkbox"] { margin: 0; }
.graph-kind-row span { font-size: 0.69rem; color: var(--muted); }
/* v1 inlines accent-color per kind on each legend checkbox (TYPE_COLORS) */
.kf-concept { accent-color: #4a7a9b; }    .kf-fact { accent-color: #7a4a9b; }
.kf-decision { accent-color: #9b7a4a; }   .kf-template { accent-color: #4a9b7a; }
.kf-secret { accent-color: #9b4a4a; }     .kf-config { accent-color: #6b7a9b; }
.kf-project { accent-color: #4a7a4a; }    .kf-task { accent-color: #9b9b4a; }
.kf-document { accent-color: #5a6a8a; }   .kf-note { accent-color: #8a8a5a; }
.kf-inbox_item { accent-color: #7a8a9a; } .kf-user { accent-color: #9a7a7a; }
.kf-tag { accent-color: #7a9a8a; }        .kf-skill { accent-color: #c97a3a; }
.graph-meta-section { margin-top: 10px; padding-top: 6px;
  border-top: 1px solid var(--line); }
.graph-meta-section .graph-micro-label { margin-bottom: 4px; }
#graph-meta { display: flex; flex-direction: column; gap: 2px; }
.graph-meta-row { display: flex; justify-content: space-between; font-size: 0.62rem;
  color: var(--muted); line-height: 1.4; }
.graph-meta-value { font-family: var(--font-mono); }
.graph-meta-orphans { color: #c08080; }
.graph-meta-cut { color: var(--faint); }
#graph-container { position: relative; flex: 1; background: var(--raised);
  overflow: hidden; }
#graph-tooltip { position: absolute; background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--r-sm); padding: 8px 12px;
  font-size: 0.77rem; color: var(--fg); box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  z-index: 50; pointer-events: none; max-width: 240px; display: none; }
.graph-tip-strong { font-weight: 600; margin-bottom: 2px; }
.graph-tip-sub { font-size: 0.69rem; color: var(--faint); }
.graph-tip-sub-mt { font-size: 0.69rem; color: var(--faint); margin-top: 2px; }
.graph-msg { padding: 2rem; color: var(--faint); text-align: center; }
.graph-msg-center { position: absolute; inset: 0; display: flex;
  align-items: center; justify-content: center; }

/* ---- error / shared (public) pages -------------------------------------- */
.error-page h1 { font-family: var(--font-display); font-size: 4rem; color: var(--faint); }
.shared { max-width: 760px; margin: 8vh auto 0; }
.shared .kind { margin: 6px 0; }
body.public { background-attachment: fixed; }

/* ---- OAuth consent (nav-less focused modal) ----------------------------- */
main.consent { max-width: 520px; margin: 7vh auto 0; padding: 0 22px 80px; }
.consent-mark { width: 54px; height: 54px; display: block; margin-bottom: 14px; }
.consent-eyebrow { font-size: 0.69rem; color: var(--faint); text-transform: uppercase;
  letter-spacing: 0.12em; margin: 0 0 6px; }
.consent h1 { font-size: 1.9rem; margin: 0 0 6px; }
.consent-card { background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r); padding: 16px 18px; margin: 16px 0; }
.consent-card p { margin: 0 0 4px; }
.consent-card p:last-child { margin-bottom: 0; }
.consent-strong { font-weight: 600; font-size: 1rem; color: var(--fg); }
.consent-scope { list-style: none; margin: 0 0 8px; padding: 0; }
.consent-scope li { padding: 3px 0 3px 22px; position: relative; color: var(--fg); }
.consent-scope li::before { content: "✓"; position: absolute; left: 0; color: var(--teal);
  font-weight: 700; }
.consent-actions { display: flex; flex-direction: column; gap: 10px; margin: 22px 0 0; }
.consent-actions button { padding: 12px; font-size: 0.95rem; }
.btn-ghost { background: transparent; color: var(--fg); border: 1px solid var(--line); }
.btn-ghost:hover { background: var(--raised); filter: none; border-color: var(--accent); }
.consent-foot { font-size: 0.8rem; margin-top: 18px; }

/* ---- ⌘K command palette ------------------------------------------------- */
.cmdk-backdrop { position: fixed; inset: 0; background: color-mix(in oklab, var(--ink) 70%, transparent);
  backdrop-filter: blur(3px); display: flex; align-items: flex-start; justify-content: center;
  padding-top: 13vh; z-index: 60; }
/* The class above sets display unconditionally, which ties the UA [hidden] rule on
   specificity (author wins) → the overlay would stay permanently visible and block
   the page. This higher-specificity guard restores the `hidden` attribute toggle. */
.cmdk-backdrop[hidden] { display: none; }
.cmdk-modal { width: min(640px, 92vw); background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow);
  animation: rise 0.18s ease both; }
#cmdk-input { width: 100%; box-sizing: border-box; padding: 17px 18px; border: 0;
  border-bottom: 1px solid var(--line); background: transparent; color: var(--fg);
  font-size: 1.02rem; font-family: var(--font-display); }
#cmdk-input:focus { outline: none; box-shadow: none; }
.cmdk-results { list-style: none; margin: 0; padding: 6px; max-height: 52vh; overflow: auto; }
.cmdk-row { display: flex; flex-direction: column; gap: 1px; padding: 9px 13px;
  border-radius: var(--r-sm); color: var(--fg); text-decoration: none; }
.cmdk-row.active { background: var(--glow); }
.cmdk-title { font-weight: 600; }
.cmdk-meta { font-size: 0.76rem; color: var(--muted); font-family: var(--font-mono); }
.cmdk-snip { font-size: 0.82rem; color: var(--muted); }
.cmdk-foot { padding: 9px 15px; border-top: 1px solid var(--line); color: var(--faint);
  font-size: 0.73rem; font-family: var(--font-mono); }

/* ---- context badges (shared: entities, proposals, dashboard members) ----- */
.badge { font-size: 0.77rem; font-weight: 600; padding: 0.23rem 0.69rem;
  border-radius: var(--r-sm); display: inline-block; letter-spacing: 0.04em; }
.badge-dev { background: #e8ede9; color: #4a6b50; }
.badge-bemodi { background: #f0e8e8; color: #6b4a4a; }
.badge-ifp-labs { background: #e8edf2; color: #4a5f6b; }
.badge-musik { background: #ece8f2; color: #5f4a6b; }
.badge-privat { background: #ececec; color: #666; }
.badge-status { font-size: 0.77rem; padding: 0.23rem 0.69rem;
  border-radius: var(--r-sm); margin-left: 0.46rem; }
.badge-active { background: var(--glow); color: var(--accent-hi); }
.badge-ctx-plain { color: var(--faint); border: 1px solid var(--line); }
.badge-ctx-active { outline: 2px solid var(--fg); outline-offset: 1px; }
.empty { color: var(--faint); font-size: 0.92rem; padding: 1.23rem 0; }

/* ---- filter bar (shared: audit, auth log) ------------------------------- */
.filter-bar { align-items: center; gap: 0.62rem; padding: 0.77rem 0.92rem;
  background: var(--raised); border: 1px solid var(--line);
  border-radius: var(--r); margin: 0 0 1.54rem; }
.filter-bar select { appearance: none; -webkit-appearance: none; -moz-appearance: none;
  background-color: var(--panel);
  background-image: url(icons/chevron.svg);
  background-repeat: no-repeat; background-position: right 0.69rem center;
  background-size: 12px; border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 0.46rem 2.15rem 0.46rem 0.77rem; color: var(--fg); font-size: 0.85rem;
  cursor: pointer; transition: border-color 0.12s, background-color 0.12s;
  min-width: 150px; }
.filter-bar select:hover { border-color: var(--muted); background-color: var(--raised); }
.filter-bar select:focus { outline: none; border-color: var(--fg);
  background-color: var(--panel); box-shadow: none; }
.filter-bar .btn { padding: 0.46rem 0.92rem; font-size: 0.85rem; }
.filter-bar-check { display: inline-flex; align-items: center; gap: 0.38rem;
  padding: 0.46rem 0.77rem; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r-sm); font-size: 0.85rem; color: var(--fg); cursor: pointer;
  user-select: none; transition: border-color 0.12s, background-color 0.12s; }
.filter-bar-check:hover { border-color: var(--muted); }
.filter-bar-check input[type="checkbox"] { appearance: none; -webkit-appearance: none;
  width: 14px; height: 14px; padding: 0; border: 1.5px solid var(--line);
  border-radius: 0.23rem; background: var(--panel); cursor: pointer;
  position: relative; transition: all 0.12s; flex-shrink: 0; }
.filter-bar-check input[type="checkbox"]:checked { background: var(--fg);
  border-color: var(--fg); }
.filter-bar-check input[type="checkbox"]:checked::after { content: '';
  position: absolute; left: 3px; top: 0; width: 4px; height: 8px;
  border: solid var(--panel); border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); }
.badge-archived { background: var(--raised); color: var(--muted); }

/* ---- entities browser: toolbar, kind chips, sortable table -------------- */
.ent-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 16px 0 10px; }
.ent-toolbar .cl-search { flex: 1 1 280px; }
.ent-select { appearance: none; -webkit-appearance: none; -moz-appearance: none;
  height: 36px; padding: 0 30px 0 12px; border: 1px solid var(--line); border-radius: 9px;
  background-color: var(--panel); background-image: url(icons/chevron.svg);
  background-repeat: no-repeat; background-position: right 10px center; background-size: 12px;
  color: var(--fg); font-size: 12.5px; cursor: pointer; }
.ent-select:focus { outline: none; border-color: var(--accent); box-shadow: none; }
.ent-chips { display: flex; gap: 7px; flex-wrap: wrap; padding: 4px 0 12px; }
.ent-chip { display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--panel);
  color: var(--muted); cursor: pointer; font: inherit; font-size: 12.5px; font-weight: 600;
  transition: border-color .12s, color .12s, background .12s; }
.ent-chip:hover { filter: none; border-color: var(--accent); color: var(--fg); }
.ent-chip.is-on { border-color: var(--accent); color: var(--accent);
  background: color-mix(in oklab, var(--accent) 12%, transparent); }
.ent-chip-n { opacity: 0.6; font-weight: 500; }
.ent-resultline { font-size: 12.5px; color: var(--muted); margin: 0 0 8px; padding: 0 2px; }
.ent-resultline strong { color: var(--fg); }
.ent-name-cell { display: flex; align-items: center; gap: 10px; }
.ent-title { font-family: var(--font-display); font-size: 14px; font-weight: 600;
  color: var(--fg); text-decoration: none; }
.entrow:hover .ent-title { color: var(--accent); }
.ent-title mark { background: #fff3b8; color: inherit; padding: 0 0.15rem; border-radius: 0.15rem; }
:root[data-theme="dark"] .ent-title mark { background: #5a4a1e; color: #f5e8b0; }
.ent-art { font-size: 12.5px; color: var(--muted); }
.ent-art .kdot { margin-right: 6px; vertical-align: middle; }
.ent-date { font-size: 12.5px; color: var(--muted); }
.ent-graph { display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--panel); color: var(--muted); text-decoration: none; font-size: 14px; }
.ent-graph:hover { border-color: var(--accent); color: var(--accent); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---- entity detail: quiet reading layout (var(--pagebg), centred article) - */
body.doc { background: var(--pagebg); background-image: none; }
body.doc main { max-width: none; margin: 0; padding: 0; }
.page-head .ph-back { font-size: 13px; font-weight: 600; color: var(--muted);
  text-decoration: none; white-space: nowrap; }
.page-head .ph-back:hover { color: var(--accent); }
.page-head .ph-crumb a { color: var(--muted); }
.page-head .asof-form { display: flex; align-items: center; gap: 6px; }
.page-head .asof-form input { height: 30px; padding: 0 8px; font-size: 12px; }
.page-head .asof-form .btn-ghost { height: 30px; padding: 0 11px; font-size: 12px; }
.doc-article { max-width: 760px; margin: 0 auto; padding: 36px 24px 90px; }
.doc-badges { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.ctx-badge { font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: var(--r-sm);
  background: var(--line2); color: var(--muted); }
.status-badge { font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: var(--r-sm);
  background: var(--raised); color: var(--muted); }
.doc-title { font-family: var(--font-display); font-size: 30px; font-weight: 700;
  letter-spacing: -0.02em; line-height: 1.15; margin: 0 0 12px; color: var(--fg); }
.doc-meta { display: flex; flex-wrap: wrap; gap: 16px; font-size: 12.5px; color: var(--faint);
  padding-bottom: 20px; border-bottom: 1px solid var(--line); margin-bottom: 24px; }
.doc-meta strong { color: var(--muted); font-weight: 600; }
.doc-body { font-size: 15.5px; line-height: 1.7; color: var(--fg); margin: 0 0 8px; }
.doc-section { margin-top: 30px; }
.doc-h { font-family: var(--font-display); font-size: 13px; font-weight: 700;
  letter-spacing: 0.04em; text-transform: uppercase; color: var(--faint);
  margin: 0 0 12px; display: flex; align-items: center; gap: 10px; }
.doc-h-n { font-family: var(--font-mono); font-weight: 600; color: var(--muted);
  text-transform: none; letter-spacing: 0; }
.doc-h-link { margin-left: auto; font-size: 12px; font-weight: 600; text-transform: none;
  letter-spacing: 0; color: var(--accent); }
/* prominent "view in graph" CTA — a filled accent button, right-aligned in the section head */
.graph-cta { margin-left: auto; display: inline-flex; align-items: center; gap: 0.4rem;
  font-size: 13px; font-weight: 700; text-transform: none; letter-spacing: 0;
  padding: 0.34rem 0.8rem; border-radius: var(--r-sm); background: var(--accent);
  color: #fff; text-decoration: none; }
.graph-cta:hover { filter: none; background: var(--accent-hi); }
.doc-history { display: flex; flex-direction: column; }
.hist-row { display: flex; align-items: center; gap: 10px; padding: 11px 8px;
  border-bottom: 1px solid var(--line2); text-decoration: none; color: var(--fg);
  border-radius: var(--r-sm); }
.hist-row:hover { background: var(--raised); }
.hist-action { font-size: 13.5px; font-weight: 600; color: var(--fg); }
.hist-keys { font-family: var(--font-mono); font-size: 11.5px; color: var(--muted); }
.hist-meta { margin-left: auto; font-size: 11px; color: var(--faint2); white-space: nowrap; }

/* --- markdown-rendered bodies (S4 entity_detail + shared_entity) --- */
.markdown-body { line-height: 1.6; }
.markdown-body > :first-child { margin-top: 0; }
.markdown-body h1, .markdown-body h2, .markdown-body h3 { line-height: 1.25; margin: 1.4em 0 .5em; }
.markdown-body h1 { font-size: 1.5rem; }
.markdown-body h2 { font-size: 1.25rem; }
.markdown-body h3 { font-size: 1.1rem; }
.markdown-body p { margin: .6em 0; }
.markdown-body ul, .markdown-body ol { margin: .6em 0; padding-left: 1.4em; }
.markdown-body li { margin: .2em 0; }
.markdown-body a { color: var(--purple, #a05cff); text-decoration: underline; }
.markdown-body code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em; background: rgba(127,127,127,.14); padding: .1em .35em; border-radius: 4px; }
.markdown-body pre { background: rgba(127,127,127,.12); padding: .8em 1em; border-radius: 8px; overflow-x: auto; }
.markdown-body pre code { background: none; padding: 0; }
.markdown-body blockquote { margin: .6em 0; padding: .2em 1em; border-left: 3px solid rgba(127,127,127,.4); color: var(--faint, #6b7a8d); }
.markdown-body table { border-collapse: collapse; margin: .8em 0; }
.markdown-body th, .markdown-body td { border: 1px solid rgba(127,127,127,.3); padding: .35em .7em; text-align: left; }
.markdown-body hr { border: none; border-top: 1px solid rgba(127,127,127,.3); margin: 1.2em 0; }

/* --- UX wave A: grouped connections, breadcrumb, origin, keyboard focus --- */
.origin-row { margin: 0.35rem 0 0; font-size: 0.86rem; display: flex;
  gap: 1.1rem; flex-wrap: wrap; }
.origin-row a { color: inherit; text-decoration: underline; }
.crumb-current { color: var(--muted); }
.connection-section-title, .connection-group-title { font-size: 0.72rem;
  font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--faint); margin: 0.9rem 0 0.3rem; }
.connection-section .connection-group-title { margin-top: 0.45rem; }
.connection-group:first-child > .connection-group-title,
.connection-section:first-child > .connection-section-title { margin-top: 0; }
.connection-group summary.connection-group-title { cursor: pointer; }
details.backlinks { margin-top: 0.9rem; }
details.backlinks > summary { font-size: 0.72rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em; color: var(--faint);
  cursor: pointer; }
.kbd-focus { outline: 2px solid var(--purple, #a05cff); outline-offset: 2px;
  border-radius: 4px; }

/* --- UX wave B: provenance trail, ego graph panel, relation filters ------ */
.trail-card { padding: 0.9rem 1rem; }
.trail { list-style: none; margin: 0; padding: 0; position: relative; }
.trail::before { content: ""; position: absolute; left: 5px; top: 8px; bottom: 8px;
  width: 2px; background: rgba(155, 122, 74, 0.35); }
.trail-row { position: relative; padding: 0.28rem 0 0.28rem 1.2rem;
  display: flex; align-items: baseline; gap: 0.45rem; flex-wrap: wrap;
  font-size: 0.9rem; }
.trail-row::before { content: ""; position: absolute; left: 1px; top: 0.72em;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--panel, #fff); border: 2px solid rgba(155, 122, 74, 0.65); }
.trail-current::before { background: #9b7a4a; border-color: #9b7a4a; }
.trail-current .trail-this { font-weight: 600; }
.trail-verb { font-size: 0.72rem; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--faint); min-width: 6.4rem; }
.trail-status { font-size: 0.72rem; color: var(--faint); }
.graph-link { font-size: 0.72rem; font-weight: 500; text-transform: uppercase;
  letter-spacing: 0.05em; margin-left: 0.5rem; vertical-align: middle; }
/* node inspector: bottom-right so it never collides with the top-right filter
   legend (the legend's max-height reserves this zone). */
.graph-panel { position: absolute; top: auto; bottom: 14px; right: 14px; z-index: 8;
  width: 280px; max-height: 300px; overflow-y: auto;
  background: var(--panel, #fff); border: 1px solid var(--line);
  border-radius: 13px; padding: 0.9rem; box-shadow: var(--shadow); }
.graph-panel-close { position: absolute; top: 0.45rem; right: 0.45rem; }
.graph-panel-title { font-weight: 600; font-size: 1rem; line-height: 1.3;
  margin: 0 1.4rem 0.25rem 0; }
.graph-panel-meta { font-size: 0.78rem; color: var(--muted); margin-bottom: 0.6rem; }
/* node panel actions: the primary "Detailseite öffnen" is a full-width accent
   button (was an easy-to-miss tiny inline link), focus is a secondary button. */
.graph-panel-actions { display: flex; flex-direction: column; gap: 8px; margin: 6px 0 12px; }
#graph-panel-open { display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 10px; border-radius: 9px; border: 1px solid var(--accent);
  background: var(--accent); color: #fff; font-size: 13px; font-weight: 600;
  text-decoration: none; box-shadow: 0 8px 20px -10px var(--accent); }
#graph-panel-open:hover { background: var(--accent-hi); color: #fff; filter: none; }
#graph-panel-open kbd { font-family: var(--font-mono); font-size: 11px; line-height: 1;
  border: 1px solid rgba(255,255,255,.45); border-radius: 4px; padding: 1px 5px; opacity: .9; }
#graph-panel-focus { width: 100%; padding: 8px; border-radius: 9px; border: 1px solid var(--line);
  background: var(--panel); color: var(--muted); font: inherit; font-size: 12.5px;
  font-weight: 600; cursor: pointer; }
#graph-panel-focus:hover { border-color: var(--accent); color: var(--accent); filter: none; }
.graph-panel-neighbors { display: flex; flex-direction: column; gap: 0.1rem; }
.graph-panel-row { display: flex; flex-direction: column; padding: 0.3rem 0.4rem;
  border-radius: 6px; text-decoration: none; color: inherit; }
.graph-panel-row:hover { background: rgba(127,127,127,.12); }
/* neighbor row is now a <button> — strip native chrome, keep the .graph-panel-row layout */
button.graph-panel-row { width: 100%; text-align: left; background: none; border: none;
  font: inherit; cursor: pointer; }
/* graph inspector breadcrumb trail */
.graph-panel-trail { display: flex; flex-wrap: wrap; align-items: center;
  gap: 2px 4px; margin: 0 0 0.4rem; }
.graph-trail-sep { color: var(--faint); font-size: 0.8rem; }
.graph-trail-chip { font: inherit; font-size: 0.72rem; padding: 1px 6px;
  border-radius: var(--r-sm); background: var(--raised); color: var(--muted);
  border: 1px solid var(--line); cursor: pointer; max-width: 12ch;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.graph-trail-chip:hover { filter: none; border-color: var(--accent); color: var(--fg); }
.graph-trail-chip[aria-current="true"] { color: var(--fg); border-color: var(--accent); }
.graph-panel-rel { font-size: 0.68rem; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--faint); }
.graph-panel-peer { font-size: 0.86rem; }
.graph-rel-adr { color: #9b7a4a; }
.graph-meta-back { display: block; margin-top: 0.4rem; font-size: 0.8rem; }
.graph-msg { pointer-events: none; }
.trail-branch { opacity: 0.85; }
.trail-branch .trail-verb::after { content: " (branch)"; text-transform: none; }

/* --- UX waves C+D: time travel, history, preview cards, peek slide-over -- */
.breadcrumb-row { display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; }
.asof-form { display: flex; gap: 0.4rem; align-items: center; }
.asof-form input[type="date"] { font-size: 0.8rem; padding: 0.15rem 0.35rem; }
.asof-form button { font-size: 0.72rem; }
.asof-banner { margin: 0.5rem 0; padding: 0.5rem 0.8rem; border-radius: 8px;
  font-size: 0.85rem; background: rgba(155, 122, 74, 0.12);
  border: 1px solid rgba(155, 122, 74, 0.4); }
/* shared warn banner (replaces ad-hoc asof-banner on non-as_of uses) */
.banner { margin: 0.5rem 0; padding: 0.5rem 0.8rem; border-radius: 8px;
  font-size: 0.85rem; }
.banner-warn { background: rgba(155, 122, 74, 0.12);
  border: 1px solid rgba(155, 122, 74, 0.35); color: var(--fg); }
/* copy button (token-box copy + code-block copy via codecopy.js) */
.copy-btn { font-size: 0.75rem; padding: 4px 10px;
  border-radius: var(--r-sm); background: var(--raised);
  color: var(--muted); border: 1px solid var(--line); cursor: pointer; }
.copy-btn:hover { filter: none; border-color: var(--accent); color: var(--fg); }
.copy-btn.copied { color: var(--accent); }
.history-row { display: flex; gap: 0.55rem; align-items: baseline;
  padding: 0.28rem 0; font-size: 0.86rem; flex-wrap: wrap; }
.history-action { font-weight: 600; }
.history-keys { color: var(--muted); font-family: ui-monospace, SFMono-Regular,
  Menlo, monospace; font-size: 0.78rem; }
details.history > summary { cursor: pointer; font-size: 0.85rem;
  color: var(--muted); }
.preview-pop { position: fixed; z-index: 60; width: 320px; max-width: 90vw;
  background: var(--panel, #fff); border: 1px solid rgba(127,127,127,.3);
  border-radius: 10px; padding: 0.7rem 0.85rem;
  box-shadow: 0 10px 30px rgba(0,0,0,.18); pointer-events: none; }
.preview-title { font-weight: 600; font-size: 0.92rem; margin-bottom: 0.15rem; }
.preview-meta { font-size: 0.74rem; color: var(--faint); margin-bottom: 0.4rem; }
.preview-excerpt { font-size: 0.82rem; color: var(--muted); line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical;
  overflow: hidden; }
.peek { position: fixed; top: 0; right: 0; bottom: 0; width: 440px;
  max-width: 92vw; z-index: 50; overflow-y: auto;
  background: var(--panel, #fff); border-left: 1px solid rgba(127,127,127,.3);
  box-shadow: -12px 0 36px rgba(0,0,0,.16); padding: 0.9rem 1.1rem; }
.peek-head { display: flex; align-items: center; gap: 0.6rem;
  margin-bottom: 0.6rem; }
.peek-head a { font-size: 0.82rem; margin-right: auto; }
.peek-article .entity-title { font-size: 1.25rem; }
.peek-article h2 { font-size: 0.95rem; margin: 1rem 0 0.4rem; }

/* ── kind colour dots + initial badges (shared: dashboard, entities) ──────── */
.kdot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--faint); flex: none; }
.kdot.k-concept{background:#4a7a9b}.kdot.k-fact{background:#7a4a9b}.kdot.k-decision{background:#9b7a4a}
.kdot.k-template{background:#4a9b7a}.kdot.k-secret{background:#9b4a4a}.kdot.k-config{background:#6b7a9b}
.kdot.k-project{background:#4a7a4a}.kdot.k-task{background:#9b9b4a}.kdot.k-document{background:#5a6a8a}
.kdot.k-note{background:#8a8a5a}.kdot.k-inbox_item{background:#7a8a9a}.kdot.k-user{background:#9a7a7a}
.kdot.k-tag{background:#7a9a8a}.kdot.k-skill{background:#c97a3a}
.kbadge { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px;
  border-radius: var(--r-sm); font-family: var(--font-display); font-weight: 700; font-size: 11px;
  flex: none; color: var(--muted); background: var(--raised); }
.kbadge.k-concept{color:#4a7a9b;background:color-mix(in oklab,#4a7a9b 16%,transparent)}
.kbadge.k-fact{color:#7a4a9b;background:color-mix(in oklab,#7a4a9b 16%,transparent)}
.kbadge.k-decision{color:#9b7a4a;background:color-mix(in oklab,#9b7a4a 16%,transparent)}
.kbadge.k-template{color:#4a9b7a;background:color-mix(in oklab,#4a9b7a 16%,transparent)}
.kbadge.k-secret{color:#9b4a4a;background:color-mix(in oklab,#9b4a4a 16%,transparent)}
.kbadge.k-config{color:#6b7a9b;background:color-mix(in oklab,#6b7a9b 16%,transparent)}
.kbadge.k-project{color:#4a7a4a;background:color-mix(in oklab,#4a7a4a 16%,transparent)}
.kbadge.k-task{color:#9b9b4a;background:color-mix(in oklab,#9b9b4a 16%,transparent)}
.kbadge.k-document{color:#5a6a8a;background:color-mix(in oklab,#5a6a8a 16%,transparent)}
.kbadge.k-note{color:#8a8a5a;background:color-mix(in oklab,#8a8a5a 16%,transparent)}
.kbadge.k-inbox_item{color:#7a8a9a;background:color-mix(in oklab,#7a8a9a 16%,transparent)}
.kbadge.k-user{color:#9a7a7a;background:color-mix(in oklab,#9a7a7a 16%,transparent)}
.kbadge.k-tag{color:#7a9a8a;background:color-mix(in oklab,#7a9a8a 16%,transparent)}
.kbadge.k-skill{color:#c97a3a;background:color-mix(in oklab,#c97a3a 16%,transparent)}

/* ── cluster dashboard (Cluster = context) ───────────────────────────────── */
.cl-layout { flex: 1; display: flex; min-height: 0; }
.cl-main { flex: 1; min-width: 0; display: flex; flex-direction: column;
  overflow-y: auto; padding: 0 24px 48px; }
.cl-filter { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 16px 0 12px; }
.cl-search { display: flex; align-items: center; gap: 8px; min-width: 300px; padding: 8px 12px;
  border: 1px solid var(--line); border-radius: 9px; background: var(--panel); color: var(--faint); }
.cl-search input { border: none; outline: none; background: transparent; padding: 0;
  font-size: 13px; color: var(--fg); width: 100%; }
.cl-search input:focus { box-shadow: none; }
.cl-count { font-size: 12px; color: var(--faint); }
.cl-count strong { color: var(--muted); }

.cl-table { width: 100%; border-collapse: collapse; }
.cl-table thead th { position: sticky; top: 0; z-index: 1; background: var(--ink); text-align: left;
  padding: 11px 12px; font-size: 11px; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--faint); border-bottom: 1px solid var(--line); white-space: nowrap; }
.cl-table th.cl-num { text-align: right; }
.cl-sort { cursor: pointer; user-select: none; }
.cl-sort:hover { color: var(--muted); }
.cl-sort.cl-is-sorted { color: var(--accent); }
.cl-arrow { margin-left: 4px; }

.clrow { cursor: pointer; }
.clrow > td { padding: 13px 12px; border-bottom: 1px solid var(--line2); vertical-align: middle; }
.clrow:hover > td { background: var(--raised); }
.clrow.is-selected > td { background: color-mix(in oklab, var(--accent) 8%, transparent); }
.cl-name-cell { border-left: 3px solid var(--acc, var(--line)); }
.cl-name { font-family: var(--font-display); font-size: 14.5px; font-weight: 600;
  color: var(--fg); text-decoration: none; display: block; }
.clrow:hover .cl-name { color: var(--accent); }
.cl-desc { font-size: 11.5px; color: var(--faint); margin-top: 1px; display: block; }
.cl-dots { display: inline-flex; align-items: center; gap: 4px; }
.cl-arten { font-size: 11.5px; color: var(--faint); margin-left: 5px; }
.cl-num { text-align: right; }
.cl-stat-n { font-family: var(--font-display); font-weight: 700; font-size: 15px; color: var(--fg); }
.cl-rel { font-size: 13px; font-weight: 600; color: var(--fg); display: block; }
.cl-abs { font-size: 11px; color: var(--faint); display: block; }

/* deterministic per-context accent (set as --acc via class; never inline) */
.acc-0 { --acc: #7a3df0; } .acc-1 { --acc: #168a7f; } .acc-2 { --acc: #c08a3a; }
.acc-3 { --acc: #3f78a0; } .acc-4 { --acc: #7a4a9b; } .acc-5 { --acc: #4a7a4a; }
.acc-6 { --acc: #9b4a6a; } .acc-7 { --acc: #5a6a8a; }

/* cluster detail drawer */
.cl-drawer { width: 362px; flex: none; border-left: 1px solid var(--line);
  background: var(--panel); overflow-y: auto; }
.cl-panel { padding: 22px 22px 40px; }
.cl-panel-head { display: flex; align-items: flex-start; justify-content: space-between;
  gap: 10px; margin-bottom: 16px; }
.cl-panel-title { font-family: var(--font-display); font-size: 21px; font-weight: 700;
  margin: 0; color: var(--fg); letter-spacing: -0.01em; }
.cl-panel-sub { font-size: 13px; color: var(--muted); margin: 3px 0 0; }
.cl-close { width: 26px; height: 26px; flex: none; border-radius: var(--r-sm);
  border: 1px solid var(--line); background: var(--raised); color: var(--faint);
  font-size: 15px; line-height: 1; cursor: pointer; padding: 0; }
.cl-close:hover { filter: none; color: var(--fg); border-color: var(--accent); }
.cl-bigstats { display: flex; gap: 24px; padding: 14px 0; margin-bottom: 18px;
  border-top: 1px solid var(--line2); border-bottom: 1px solid var(--line2); }
.cl-big { display: flex; flex-direction: column; }
.cl-big-n, .cl-big-rel { font-family: var(--font-display); font-weight: 700; color: var(--fg); line-height: 1; }
.cl-big-n { font-size: 26px; }
.cl-big-rel { font-size: 15px; }
.cl-big-l { font-size: 11px; color: var(--faint); margin-top: 4px; }
.cl-section-h { font-size: 10px; font-weight: 700; letter-spacing: 0.07em;
  text-transform: uppercase; color: var(--faint); margin: 0 0 9px; }
.cl-comp { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 20px; }
.cl-comp-item { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.cl-members { display: flex; flex-direction: column; gap: 6px; margin-bottom: 20px; }
.cl-member { display: flex; align-items: center; gap: 9px; padding: 5px 8px;
  border-radius: var(--r-sm); font-size: 13px; color: var(--fg); text-decoration: none; }
.cl-member:hover { background: var(--raised); }
.cl-spark { display: block; width: 100%; height: 30px; margin-bottom: 24px; }
.cl-spark rect { fill: color-mix(in oklab, var(--accent) 35%, transparent); }
.cl-cta { display: flex; align-items: center; justify-content: center; gap: 9px; width: 100%;
  padding: 12px; border-radius: var(--r); background: var(--accent); color: #fff;
  font-size: 13.5px; font-weight: 600; text-decoration: none;
  box-shadow: 0 8px 20px -8px var(--accent); }
.cl-cta:hover { background: var(--accent-hi); color: #fff; }
@media (max-width: 820px) { .cl-drawer { display: none; } }

/* Webhook GitHub-registration helper (shown once after creating a source). */
.wh-register { margin: 0.7rem 0; display: grid; grid-template-columns: max-content 1fr;
  gap: 6px 16px; align-items: baseline; }
.wh-register dt { font-size: 0.8rem; color: var(--muted); white-space: nowrap; }
.wh-register dd { margin: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.wh-register dd code { font-family: var(--font-mono); word-break: break-all; }
.wh-deeplink { margin-top: 0.8rem; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); text-decoration: none; }
.btn-primary:hover { background: var(--accent-hi); color: #fff; }
