os-graph { 
  display: block; 
  --brand-bg: #0b0f19;
  --brand-text: #f8fafc;
  --brand-muted: #94a3b8;
  --brand-border: rgba(255, 255, 255, 0.12);
  --brand-primary: #3b82f6;
}

.osg-stage {
  position: relative;
  width: 100%;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--brand-border);
  background: #0b0f19;
  background-image: radial-gradient(rgba(255, 255, 255, 0.07) 1.2px, transparent 1.2px);
  background-size: 24px 24px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.osg-plot { position: absolute; inset: 0; }
.osg-fallback { position: absolute; inset: 0; display: grid; place-items: center; color: var(--brand-muted); font-size: .9rem; background: #fff; }

/* Floating HUD (Top-Left Search, View Switcher & Stats) */
.osg-hud { position: absolute; top: 14px; left: 14px; z-index: 5; display: grid; gap: 8px; pointer-events: none; }
.osg-view-switcher {
  pointer-events: auto;
  display: flex; gap: 4px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(12px);
  padding: 4px;
  border-radius: 999px;
  border: 1px solid var(--brand-border);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}
.osg-vtab {
  border: 0; background: transparent;
  color: #94a3b8;
  font-size: .75rem; font-weight: 700;
  padding: 5px 12px; border-radius: 999px;
  cursor: pointer; transition: all 0.15s ease;
}
.osg-vtab:hover { color: #f8fafc; background: rgba(255,255,255,0.08); }
.osg-vtab-on {
  background: #2563eb !important;
  color: #ffffff !important;
  font-weight: 800;
  box-shadow: 0 2px 10px rgba(37, 99, 235, 0.5);
}
.osg-searchbar {
  pointer-events: auto;
  display: flex; align-items: center; gap: 8px;
  width: 280px; max-width: 60vw;
  padding: 9px 14px;
  border: 1px solid var(--brand-border);
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(12px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  transition: all 0.15s ease;
}
.osg-searchbar:focus-within {
  border-color: var(--brand-primary);
  box-shadow: 0 4px 20px rgba(59, 130, 246, 0.3);
}
.osg-ic { width: 16px; height: 16px; color: var(--brand-muted); flex: none; }
.osg-search { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; color: #f8fafc; font-size: .86rem; font-weight: 500; }
.osg-stat {
  pointer-events: none; width: fit-content;
  padding: 5px 12px; border-radius: 999px;
  border: 1px solid var(--brand-border);
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(10px);
  font-size: .73rem; font-weight: 700; color: #94a3b8;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}
.osg-stat b { color: #f8fafc; font-weight: 800; }

/* Controls Toolbar (Top-Right Zoom/Reset) */
.osg-controls {
  position: absolute; top: 14px; right: 14px; z-index: 5;
  display: flex; flex-direction: column; gap: 6px;
}
.osg-btn {
  width: 36px; height: 36px; border-radius: 10px;
  border: 1px solid var(--brand-border);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
  color: #334155; font-size: 1.1rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all 0.15s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
.osg-btn:hover {
  background: #ffffff; color: var(--brand-primary);
  border-color: var(--brand-primary);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.12);
}

/* Cluster & Entity Type Legend (Bottom-Left) */
.osg-legend {
  position: absolute; bottom: 14px; left: 14px; z-index: 5;
  width: min(280px, 58%); max-height: 48%; overflow: auto;
  display: flex; flex-direction: column; gap: 4px;
  padding: 12px 14px;
  border: 1px solid var(--brand-border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}
.osg-legend:empty { display: none; }
.osg-modes { display: flex; gap: 4px; margin-bottom: 8px; background: #f1f5f9; padding: 3px; border-radius: 999px; }
.osg-mode {
  flex: 1; border: none; border-radius: 999px;
  background: transparent; color: var(--brand-muted);
  font-size: .72rem; font-weight: 700; padding: 4px 10px; cursor: pointer;
  transition: all 0.12s ease;
}
.osg-mode:hover { color: var(--brand-text); }
.osg-mode-on { background: #ffffff; color: var(--brand-primary); font-weight: 800; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06); }
.osg-legend-h { font-size: .66rem; font-weight: 900; text-transform: uppercase; letter-spacing: .05em; color: var(--brand-muted); margin-bottom: 2px; }
.osg-leg { display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: transparent; cursor: pointer; text-align: left; padding: 5px 8px; border-radius: 8px; font-size: .78rem; color: var(--brand-text); font-weight: 600; transition: background 0.12s; }
.osg-leg:hover { background: #f1f5f9; }
.osg-leg i { width: 12px; height: 12px; border-radius: 50%; flex: none; box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.8); }
.osg-leg span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.osg-leg b { color: var(--brand-muted); font-size: .72rem; font-weight: 700; }

/* Detail Card / Drawer (Slides in on right when node selected) */
.osg-card {
  position: absolute; top: 14px; right: 14px; z-index: 6;
  width: 330px; max-width: calc(100% - 28px);
  max-height: calc(100% - 28px); overflow: auto;
  padding: 18px 20px;
  border: 1px solid var(--brand-border);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(16px);
  box-shadow: 0 12px 36px rgba(15, 23, 42, 0.14);
  opacity: 0; transform: translateX(12px) scale(.98);
  transition: opacity .2s ease, transform .2s ease;
}
.osg-card.osg-in { opacity: 1; transform: none; }
.osg-card[hidden] { display: none; }
.osg-card-header { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; padding-right: 28px; }
.osg-x { position: absolute; top: 14px; right: 14px; border: 0; background: #f1f5f9; color: var(--brand-muted); font-size: 1.1rem; width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all 0.12s; }
.osg-x:hover { background: #e2e8f0; color: var(--brand-text); }
.osg-dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; flex: none; box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.05); }
.osg-card h4 { margin: 0 0 8px; font-size: 1.08rem; font-weight: 800; color: var(--brand-text); padding-right: 24px; line-height: 1.3; }
.osg-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.osg-tag { font-size: .7rem; font-weight: 800; padding: 3px 10px; border-radius: 999px; background: #eff6ff; color: #1d4ed8; text-transform: uppercase; letter-spacing: .03em; border: 1px solid #bfdbfe; }
.osg-tag-soft { background: #f8fafc; color: var(--brand-muted); border-color: #e2e8f0; }
.osg-snip { margin: 8px 0 12px; font-size: .83rem; line-height: 1.5; color: #334155; background: #f8fafc; padding: 10px 12px; border-radius: 10px; border-left: 3px solid var(--brand-primary); }
.osg-rel-head { font-size: .7rem; font-weight: 900; text-transform: uppercase; letter-spacing: .04em; color: var(--brand-muted); margin: 14px 0 8px; }
.osg-rels { display: grid; gap: 6px; }
.osg-rel { display: block; width: 100%; text-align: left; border: 1px solid var(--brand-border); border-radius: 10px; background: #ffffff; color: var(--brand-text); padding: 9px 12px; cursor: pointer; font-size: .83rem; transition: all .15s ease; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02); }
.osg-rel:hover { border-color: var(--brand-primary); background: #eff6ff; transform: translateY(-1px); box-shadow: 0 3px 8px rgba(37, 99, 235, 0.08); }
.osg-rel-row { display: flex; align-items: center; gap: 6px; }
.osg-relverb { font-size: .68rem; font-weight: 800; color: var(--brand-primary); text-transform: uppercase; letter-spacing: .03em; flex: none; background: #dbeafe; padding: 2px 6px; border-radius: 4px; }
.osg-conf { display: inline-block; font-size: .65rem; font-weight: 800; padding: 2px 6px; border-radius: 999px; border: 1px solid #bbf7d0; background: #f0fdf4; color: #166534; margin-left: auto; white-space: nowrap; }
.osg-conf-inf { border-style: dashed; background: #f8fafc; color: var(--brand-muted); border-color: #cbd5e1; }
.osg-evidence { font-size: .73rem; font-style: italic; line-height: 1.4; color: #475569; margin-top: 4px; padding-left: 2px; }
.osg-relempty { font-size: .8rem; color: var(--brand-muted); font-style: italic; }

/* BENTO GRID MATRIX STYLES (Mode "bento") */
.osg-bento-container {
  position: absolute; inset: 0; top: 76px; overflow-y: auto;
  padding: 16px 20px 24px;
  background: var(--brand-bg);
  z-index: 2;
}
.osg-bento-empty { text-align: center; color: var(--brand-muted); font-size: .9rem; padding: 40px 0; }
.osg-bento-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.osg-bento-card {
  border: 1px solid var(--brand-border);
  border-radius: 14px;
  background: #ffffff;
  padding: 14px 16px;
  cursor: pointer;
  transition: all 0.18s ease;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.03);
  display: flex; flex-direction: column; gap: 8px;
}
.osg-bento-card:hover {
  border-color: var(--brand-primary);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.1);
}
.osg-bento-h { display: flex; align-items: center; gap: 8px; }
.osg-bento-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.osg-bento-title { font-weight: 800; font-size: .95rem; color: var(--brand-text); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.osg-bento-badge { font-size: .68rem; font-weight: 800; color: var(--brand-muted); background: #f1f5f9; padding: 2px 8px; border-radius: 999px; flex: none; }
.osg-bento-sub { font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .03em; }
.osg-bento-snip { margin: 0; font-size: .78rem; line-height: 1.4; color: #475569; font-style: italic; background: #f8fafc; padding: 6px 10px; border-radius: 8px; }
.osg-bento-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: auto; }
.osg-bento-chip { font-size: .7rem; font-weight: 600; padding: 3px 8px; border-radius: 6px; background: #f1f5f9; color: #334155; transition: background 0.12s; }
.osg-bento-chip:hover { background: #dbeafe; color: #1d4ed8; }
.osg-bento-verb { color: var(--brand-primary); font-weight: 800; text-transform: uppercase; font-size: .65rem; }

@media (max-width: 640px) {
  .osg-card { width: calc(100% - 28px); }
  .osg-searchbar { width: calc(100vw - 90px); }
  .osg-bento-grid { grid-template-columns: 1fr; }
}
