/* ============================================================================
   ocellio — /graph (Graph v3, Spec §5.6, a47): full-height grid of canvas +
   control bar | sidebar, the SVG classes of hulls, nodes, edges and relation
   pills, the filter overlay, the Stand pill and the sidebar ("Was sich bewegt
   hat" / node panel). Loads after auth.css. Project colours via pjb-N →
   --pj-cur (components.css), kind colours as SVG attributes from
   kind_palette; states are classes here, never inline (CSP).
   Text contrast ≥ 4.5:1 in both themes: small labels use --faint (not
   --faint2) or --muted, project colours as text are mixed towards --fg,
   accent text uses --g-accent-text (--accent-hi on navy). Kind and project
   colours under or behind an initial are darkened in oklab (review a47,
   pinned by tests/web/test_graph_contrast.py): node initials 70 % on the
   light node fill of both themes, the white initial of the panel badge on
   75 %, of the project node on 82 % (as the a41 cross badge).
   ============================================================================ */

/* ---- frame: 100dvh (WP-3 F024), no main padding ------------------------- */
body.graph-page { height: 100vh; height: 100dvh; margin: 0; display: flex;
  flex-direction: column; overflow: hidden;
  --g-node: #ffffff; --g-accent-text: var(--accent);
  --gzi: 1;   /* 1 / zoom, set on #graph-svg by graph-render.js (zoomLabels) */ }
:root[data-theme="dark"] body.graph-page { --g-node: #dce6f1; --g-accent-text: var(--accent-hi); }
body.graph-page .topnav { flex: none; }
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 { flex: 1; min-height: 0; display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px); background: var(--pagebg); }
.graph-stage { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
#graph-container { position: relative; flex: 1; min-height: 0; overflow: hidden;
  background: var(--pagebg); }
#graph-svg { display: block; }

/* ---- Stand pill (top left) ---------------------------------------------- */
.graph-stand { position: absolute; top: 16px; left: 18px; z-index: 5; display: inline-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 .gs-label { font-size: 11px; font-weight: 600; color: var(--muted); }
.graph-stand .gs-value { font-family: var(--font-display); font-size: 13.5px; font-weight: 600;
  color: var(--fg); font-variant-numeric: tabular-nums; }
.graph-stand.is-past .gs-value { color: var(--g-accent-text); }
.graph-stand .gs-count { font-size: 11px; color: var(--muted); white-space: nowrap; }
.graph-keyhint { position: absolute; bottom: 12px; left: 18px; z-index: 4;
  padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line);
  background: color-mix(in oklab, var(--panel) 92%, transparent);
  font-size: 11.5px; color: var(--muted); pointer-events: none; }

/* ---- SVG: hulls ---------------------------------------------------------- */
.g-glow-0 { stop-color: var(--accent); stop-opacity: .35; }
.g-glow-1 { stop-color: var(--accent); stop-opacity: 0; }
.g-hull, .g-hull-label { cursor: pointer; }
.g-hull-label.is-none { cursor: default; }
.g-hull-c { fill: var(--pj-cur); fill-opacity: .07; stroke: var(--pj-cur); stroke-width: 1.5; }
.g-hull.is-calm .g-hull-c { stroke-dasharray: 4 4; }
.g-hull-t { font-family: var(--font-display); font-size: calc(13px * var(--gzi)); font-weight: 700;
  fill: color-mix(in oklab, var(--pj-cur) 65%, var(--fg));
  paint-order: stroke; stroke: var(--pagebg); stroke-width: calc(3px * var(--gzi));
  stroke-linejoin: round; }
.g-hull-n { font-family: var(--font-sans); font-size: calc(11px * var(--gzi)); fill: var(--muted);
  paint-order: stroke; stroke: var(--pagebg); stroke-width: calc(3px * var(--gzi));
  stroke-linejoin: round; }
.g-hull-label.is-none .g-hull-t { fill: var(--muted); }
.g-hull:hover .g-hull-c, .g-hull:focus-visible .g-hull-c { fill-opacity: .12; stroke-width: 2; }
.g-hull:focus-visible { outline: none; }
.g-hull.is-dim, .g-hull-label.is-dim { opacity: .25; }
.no-hulls .g-hulls, .no-hulls .g-hull-labels { display: none; }

/* ---- SVG: edges and relation pills --------------------------------------- */
.g-edge { stroke: var(--faint2); stroke-opacity: .5; stroke-width: 1.2; }
.g-edge.is-new { stroke: var(--accent); stroke-opacity: .95; stroke-width: 2; }
.g-edge.is-cross { stroke: var(--pj-cur); stroke-opacity: .95; stroke-width: 2;
  stroke-dasharray: 6 4; animation: g-dash 1.4s linear infinite; }
.g-edge:hover { stroke-opacity: 1; stroke-width: 2.5; }
.g-edge.is-dim { stroke-opacity: .12; }
.g-edge.is-hot { stroke: var(--fg); stroke-opacity: 1; stroke-width: 2.5; }
@keyframes g-dash { to { stroke-dashoffset: -20; } }
.g-pill-r { fill: var(--panel); stroke: var(--line); }
.g-pill.is-hidden { display: none; }
.g-pill-t { font-family: var(--font-mono); font-size: 8.5px; text-transform: uppercase;
  fill: var(--muted); }

/* ---- SVG: nodes ---------------------------------------------------------- */
.gn { cursor: pointer; }
.gn-c { fill: var(--g-node); stroke-width: 2; }
.gn:hover .gn-c { stroke-width: 3; }
.gn.is-quiet .gn-c { stroke-width: 1; }
.gn.is-project .gn-c { fill: color-mix(in oklab, var(--pj-cur) 82%, #000);
  stroke: color-mix(in oklab, var(--pj-cur) 82%, #000); }
.gn.is-new .gn-c { fill: var(--accent); stroke: var(--accent); }
.gn.is-sel .gn-c { stroke: var(--fg); stroke-width: 3.5; }
.gn-i { font-family: var(--font-display); font-size: 9px; font-weight: 700;
  fill: color-mix(in oklab, currentColor 70%, #000); }   /* color = kind (attribute) */
.gn.is-project .gn-i { font-size: 12px; fill: #fff; }
.gn.is-new .gn-i { fill: var(--on-accent); }
.gn-halo { fill: none; stroke-width: 2; stroke-opacity: .35; }
.gn-ring { fill: none; stroke: var(--accent); stroke-width: 2; transform-box: fill-box;
  transform-origin: center; animation: g-ring 2.2s ease-out infinite; }
@keyframes g-ring { from { transform: scale(1); opacity: .55; } to { transform: scale(2.4); opacity: 0; } }
.gn-l { font-family: var(--font-sans); font-size: calc(10.5px * var(--gzi)); font-weight: 500;
  fill: var(--fg); paint-order: stroke; stroke: var(--pagebg);
  stroke-width: calc(3px * var(--gzi)); stroke-linejoin: round; }
.gn-l.is-sel { font-weight: 700; }
/* node labels have their own layer above the nodes; which of them show is
   graph-labels.js's call (declutter: priority, no overlap, review a47) — a
   hovered node shows its label anyway */
.gn-l.lbl-off { display: none; }
.gn-l.lbl-off.is-hover { display: inline; }
.no-labels .gn-l { display: none; }
.gn.is-dim { opacity: .18; }

/* ADR / Spec §5.6: prefers-reduced-motion — no pulse, glow or moving dash */
@media (prefers-reduced-motion: reduce) {
  .gn-ring, .gn-glow { display: none; }
  .g-edge.is-cross { animation: none; }
}

/* ---- tooltip + messages --------------------------------------------------- */
#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: 260px; display: none; }
.graph-tip-strong { font-weight: 600; margin-bottom: 2px; }
.graph-tip-rel { font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; }
.graph-tip-sub { font-size: 0.72rem; color: var(--muted); }
.graph-tip-sub-mt { font-size: 0.72rem; color: var(--muted); margin-top: 2px; }
.graph-msg { padding: 2rem; color: var(--muted); text-align: center; pointer-events: none; }
.graph-msg-center { position: absolute; inset: 0; display: flex;
  align-items: center; justify-content: center; }
.graph-empty { flex-direction: column; gap: 6px; }
.graph-empty p { margin: 0; }
.graph-empty-reset { pointer-events: auto; min-height: 44px; padding: 0 12px; border: 0;
  background: none; color: var(--g-accent-text); font: inherit; font-weight: 600; cursor: pointer; }

/* ---- filter overlay (top right, folded by default) ------------------------ */
#graph-legend { position: absolute; top: 14px; right: 14px; z-index: 6; width: 196px;
  max-height: calc(100% - 28px); 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; }
.graph-context-section { margin-bottom: 8px; }
.graph-micro-label { display: block; font-size: 0.66rem; 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.72rem; color: var(--muted); }
/* v1 inlines accent-color per kind on each legend checkbox (kind_palette) */
.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; }
.kf-commit { accent-color: #6a8a6a; }
#graph-legend .asof-form { display: flex; flex-direction: column; gap: 6px; }
#graph-legend .asof-form input { width: 100%; }
.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; gap: 8px; font-size: 0.68rem;
  color: var(--muted); line-height: 1.4; }
.graph-meta-value { font-family: var(--font-mono); }
.graph-meta-back { display: block; margin-top: 0.4rem; font-size: 0.8rem; cursor: pointer; }

/* ---- control bar: time travel + layers ------------------------------------ */
.graph-controls { flex: none; display: flex; flex-direction: column; gap: 6px;
  padding: 10px 18px; background: var(--panel); border-top: 1px solid var(--line); }
.gc-row { display: flex; align-items: center; gap: 12px; min-width: 0; }
.gc-play { flex: none; display: grid; place-items: center; width: 32px; height: 32px;
  padding: 0; border: 0; border-radius: 50%; background: var(--fg); color: var(--panel);
  font-size: 12px; line-height: 1; cursor: pointer; }
.gc-play:hover { filter: none; background: color-mix(in oklab, var(--fg) 85%, var(--accent)); }
.gc-play:focus-visible, .layer-pill:focus-visible, #graph-slider:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px; }
.gc-label { flex: none; font-size: 11px; font-weight: 600; color: var(--faint); }
.gc-track { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; }
.gc-marker-row { position: relative; height: 13px; }
.gc-marker { position: absolute; top: 0; transform: translateX(-50%); white-space: nowrap;
  font-size: 10px; font-weight: 600; line-height: 1; color: var(--g-accent-text); }
.gc-marker.pos-0 { transform: none; }
.gc-marker.pos-100 { transform: translateX(-100%); }
#graph-slider { display: block; width: 100%; margin: 0; accent-color: var(--accent); cursor: pointer; }
.gc-ends { display: flex; justify-content: space-between; font-size: 10px; color: var(--faint); }
.gc-row-2 { flex-wrap: wrap; gap: 6px 10px; font-size: 11.5px; color: var(--muted); }
.gc-hint { flex: 1 1 240px; min-width: 0; }
.gc-layers { margin-left: auto; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.gc-layers-label { font-size: 10.5px; font-weight: 600; color: var(--faint); margin-right: 2px; }
/* on: frame --fg on --raised; off: frame --line, text --muted, swatch faded
   (Spec: off at 50 % — only the swatch, the text keeps 4.5:1) */
.layer-pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--panel);
  color: var(--muted); font: inherit; font-size: 11.5px; cursor: pointer; }
.layer-pill:hover { filter: none; border-color: var(--faint); }
.layer-pill[aria-pressed="true"] { border-color: var(--fg); background: var(--raised); color: var(--fg); }
.lp-sw { flex: none; width: 10px; height: 10px; border-radius: 3px; opacity: .5; }
.layer-pill[aria-pressed="true"] .lp-sw { opacity: 1; }
.lp-hulls { background: color-mix(in oklab, var(--pj-0) 14%, transparent); border: 1px solid var(--pj-0); }
.lp-cross { background: var(--pj-1); }
.lp-quiet { background: var(--g-node); border: 1px solid var(--faint); }
.lp-labels { background: var(--fg); }

/* ---- sidebar ------------------------------------------------------------- */
.graph-side { display: flex; flex-direction: column; min-width: 0; min-height: 0;
  background: var(--panel); border-left: 1px solid var(--line); }
.gm, .graph-panel { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.gm[hidden], .graph-panel[hidden] { display: none; }
.gm-head, .gp-head { flex: none; display: flex; flex-direction: column; gap: 4px;
  padding: 16px 18px 12px; border-bottom: 1px solid var(--line2); }
.gm-title { margin: 0; font-family: var(--font-display); font-size: 15px; font-weight: 600; }
.gm-help { margin: 0; font-size: 12px; color: var(--muted); }
.gm-since { margin: 4px 0 6px; font-size: 11.5px; color: var(--muted); }
.gm-since:empty { display: none; }
.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; min-width: 0; border: none; outline: none; background: transparent;
  font: inherit; font-size: 13px; color: var(--fg); }
.gf-search input:focus { box-shadow: none; }
.gf-search:focus-within { border-color: var(--accent); }
.gm-list { flex: 1; min-height: 0; overflow-y: auto; padding: 6px 10px 20px;
  display: flex; flex-direction: column; gap: 2px; }
.gm-row { flex: none; display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; gap: 11px;
  align-items: start; width: 100%; min-height: 44px; padding: 9px 8px; border: 0;
  border-radius: 10px; background: transparent; color: inherit; font: inherit;
  text-align: left; cursor: pointer; }
.gm-row:hover { background: var(--raised); filter: none; }
.gm-row.is-static { cursor: default; }
.gm-row.is-static:hover { background: transparent; }
.gm-row:focus-visible, .gp-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
/* .ev-ico (puls.css, Radius 8, 28 px) lädt nach graph.css — doppelte Klasse,
   damit der Graph-Feed seinen Kreis behält (Spec §4.3, Review RC). */
.ev-ico.gm-ico { width: 26px; height: 26px; border-radius: 50%; font-size: 13px; }
.gm-body { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.gm-row-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 13.5px; font-weight: 600; line-height: 1.25; color: var(--fg); }
.gm-row-meta { font-size: 11.5px; color: var(--muted); }
.gm-row-meta b { font-weight: 600; color: var(--fg); }
.gm-pj { white-space: nowrap; }      /* Punkt und Projektname brechen nie auseinander */
.gm-pj-dot { color: var(--pj-cur, var(--faint)); }
.gm-rel { padding-top: 1px; font-size: 11px; color: var(--faint); white-space: nowrap; }
.gm-empty { padding: 14px 8px; font-size: 13px; color: var(--muted); }
.gm-empty p { margin: 0 0 6px; }
.gm-reset { min-height: 44px; padding: 0 2px; border: 0; background: none; color: var(--g-accent-text);
  font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.gm-more { display: flex; align-items: center; min-height: 44px; padding: 0 8px; font-size: 12px; }
.gm-legend { flex: none; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px;
  padding: 10px 16px; border-top: 1px solid var(--line2); font-size: 11.5px; color: var(--muted); }
.gm-legend > span { display: flex; align-items: center; gap: 6px; }
.lg-new { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 25%, transparent); }
.lg-edge { flex: none; width: 18px; height: 2px; background: var(--accent); }
.lg-size { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--g-node);
  border: 2px solid var(--muted); }
.lg-cross { flex: none; width: 18px; height: 0; border-top: 2px dashed var(--pj-1); }

/* ---- sidebar: node panel -------------------------------------------------- */
.gp-head { gap: 8px; }
.gp-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.g-kb { flex: none; display: grid; place-items: center; width: 26px; height: 26px;
  border-radius: 50%; background: color-mix(in oklab, var(--kc, #888888) 75%, #000);
  color: #fff; font-family: var(--font-display); font-size: 11px; font-weight: 700; }
.g-kb-22 { width: 22px; height: 22px; font-size: 10px; }
/* kind colours: mirror of web/kind_palette.py (like .ego-node.k-*, components.css) */
.g-kb.k-concept{--kc:#4a7a9b}.g-kb.k-fact{--kc:#7a4a9b}.g-kb.k-decision{--kc:#9b7a4a}
.g-kb.k-template{--kc:#4a9b7a}.g-kb.k-secret{--kc:#9b4a4a}.g-kb.k-config{--kc:#6b7a9b}
.g-kb.k-project{--kc:#4a7a4a}.g-kb.k-task{--kc:#9b9b4a}.g-kb.k-document{--kc:#5a6a8a}
.g-kb.k-note{--kc:#8a8a5a}.g-kb.k-inbox_item{--kc:#7a8a9a}.g-kb.k-user{--kc:#9a7a7a}
.g-kb.k-tag{--kc:#7a9a8a}.g-kb.k-skill{--kc:#c97a3a}.g-kb.k-commit{--kc:#6a8a6a}
.gp-kind { font-family: var(--font-mono); font-size: 11px; color: var(--muted); }
.gp-project { margin-left: auto; display: inline-flex; align-items: center; gap: 5px;
  min-width: 0; font-size: 11px; color: var(--muted); }
.gp-project > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gp-pj-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--pj-cur); }
.gp-close { flex: none; display: grid; place-items: center; width: 32px; height: 32px;
  margin-left: 2px; padding: 0; border: 0; border-radius: 8px; background: transparent;
  color: var(--faint); font-size: 18px; cursor: pointer; }
.gp-close:hover { background: var(--raised); color: var(--fg); filter: none; }
.gp-title { margin: 0; font-family: var(--font-display); font-size: 16px; font-weight: 600;
  line-height: 1.3; letter-spacing: -.01em; overflow-wrap: anywhere; }
.gp-meta { margin: 0; font-size: 12.5px; color: var(--muted); }
.gp-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.gp-open, .gp-focus { display: inline-flex; align-items: center; min-height: 32px;
  padding: 6px 12px; border-radius: 7px; font: inherit; font-size: 12.5px; font-weight: 600; }
.gp-open { background: var(--accent); color: var(--on-accent); text-decoration: none; }
.gp-open:hover { background: var(--accent-hi); color: var(--on-accent); filter: none; }
.gp-focus { border: 1px solid var(--line); background: var(--panel); color: var(--muted); cursor: pointer; }
.gp-focus:hover { border-color: var(--fg); color: var(--fg); filter: none; }
.gp-focus[aria-pressed="true"] { border-color: var(--fg); background: var(--raised); color: var(--fg); }
.gp-sec { flex: none; margin: 0; padding: 10px 18px 0; font-size: 11px; text-transform: uppercase;
  letter-spacing: .05em; color: var(--muted); }
.graph-panel-neighbors { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 10px 20px;
  display: flex; flex-direction: column; gap: 2px; }
.gp-row { flex: none; display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 10px; align-items: center;
  width: 100%; min-height: 44px; padding: 8px; border: 0; border-radius: 8px;
  background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.gp-row:hover { background: var(--raised); filter: none; }
.gp-row-body { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.gp-row-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 13.5px; font-weight: 600; color: var(--fg); }
.gp-row-rel { font-size: 10.5px; color: var(--muted); }
.gp-cross { font-weight: 700; color: color-mix(in oklab, var(--pj-cur) 65%, var(--fg)); }
.gp-empty { margin: 8px; font-size: 13px; color: var(--muted); }
/* breadcrumb trail of recently selected nodes */
.graph-panel-trail { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 4px; }
.graph-panel-trail:empty { display: none; }
.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: 14ch;
  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); }

/* ---- below 768 px: /graph stays a desktop route (ADR G5) — stacked, usable,
   no horizontal scroll; touch targets 44 px -------------------------------- */
@media (max-width: 767px) {
  .graph-layout { grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) minmax(0, 40%); }
  .graph-side { border-left: 0; border-top: 1px solid var(--line); }
  .graph-keyhint { display: none; }
  .graph-stand { top: 10px; left: 10px; padding: 6px 10px; gap: 6px; }
  .graph-controls { padding: 8px 12px; }
  .gc-play, .gp-close { width: 44px; height: 44px; }
  .layer-pill, .gp-open, .gp-focus, .graph-legend-toggle { min-height: 44px; }
  /* review a47: every control 44 px, text links and filter rows too */
  #graph-slider, .graph-trail-chip, #graph-context-filter, #graph-legend .asof-form input,
  #graph-legend .asof-form button, .graph-kind-row { min-height: 44px; }
  #graph-legend .asof-form button { min-width: 44px; }
  .graph-meta-back { display: flex; align-items: center; min-height: 44px; margin-top: 0; }
  .graph-trail-chip { min-width: 44px; }
  /* the Stand pill stays small over the canvas (it covered hull titles);
     the node/edge count stays desktop like the layers */
  .graph-stand .gs-count { display: none; }
  .gc-hint { flex-basis: 100%; }
  /* the canvas needs the room: layers, help text and legend stay desktop */
  .gc-layers, .gm-help, .gm-legend { display: none; }
}
