/* Scoped styles for the ReBAC access explorer.
   The prototype's accent maps to the app's --primary token; relation colors
   reuse the prototype's semantic palette for parity with the design. */

.explorer {
  --rebac-accent: hsl(var(--primary));
  --rebac-accent-soft: #eaf0fb;
  --rebac-green: #1f9d6b;
  --rebac-green-soft: #e7f6ee;
  --rebac-green-text: #137a4f;
  --rebac-amber: #c98a00;
  --rebac-amber-soft: #fbf2dd;
  --rebac-red: #d6453d;
  --rebac-red-soft: #fcebea;
  --rebac-red-text: #a8332c;
  --rebac-violet: #5e6ad2;
  --rebac-purple: #8a4fd0;
  --rebac-muted: #8a8f98;
  --rebac-muted2: #a4a8b0;
  --rebac-border: hsl(var(--border));
  --rebac-border-soft: #f2f2f3;
  --rebac-hover: #f5f5f6;
  --rebac-hover2: #f0f0f1;
  --rebac-text2: #42454c;
  --rebac-mono: "JetBrains Mono", ui-monospace, Menlo, monospace;

  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

/* toolbar */
.tbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 2px 14px;
  flex-shrink: 0;
}
.seg {
  display: inline-flex;
  background: var(--rebac-hover2);
  border-radius: 8px;
  padding: 3px;
}
.segBtn {
  height: 28px;
  padding: 0 12px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--rebac-muted);
  font-size: 12.5px;
  font-weight: 500;
  border: none;
  background: none;
  cursor: pointer;
}
.segBtnOn {
  background: #fff;
  color: hsl(var(--foreground));
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.07);
}
.spacer {
  flex: 1;
}
.headline {
  font-size: 12.5px;
  color: var(--rebac-muted);
}
.headline b {
  color: hsl(var(--foreground));
  font-weight: 600;
}

/* body split */
.body {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 392px;
  overflow: hidden;
  min-height: 0;
  border: 1px solid var(--rebac-border);
  border-radius: 12px;
}
@media (max-width: 980px) {
  .body {
    grid-template-columns: 1fr;
    overflow: auto;
  }
}

/* graph pane */
.graphpane {
  overflow: auto;
  position: relative;
  background: radial-gradient(circle at 1px 1px, #ececef 1px, transparent 0) 0 0 /
    22px 22px;
  border-radius: 12px 0 0 12px;
}
.canvas {
  position: relative;
  margin: 8px auto;
}
.collabel {
  position: absolute;
  top: 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--rebac-muted2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.edges {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}
.edge {
  fill: none;
  stroke: #d3d5da;
  stroke-width: 1.6;
  transition: opacity 0.12s, stroke-width 0.12s;
}
.edgePermUser {
  stroke: #9fb4e0;
}
.edgePermEditor {
  stroke: #b7aee6;
}
.edgePermOwner {
  stroke: #c9b0ec;
}
.edgePermConnect {
  stroke: #9fb4e0;
}
.edgeMember {
  stroke: #d3d5da;
}
.edgeDim {
  opacity: 0.18;
}
.edgeOn {
  stroke-width: 2.4;
  opacity: 1;
}
.edgeOn.edgePermUser {
  stroke: var(--rebac-accent);
}
.edgeOn.edgePermEditor {
  stroke: var(--rebac-violet);
}
.edgeOn.edgePermOwner {
  stroke: var(--rebac-purple);
}
.edgeOn.edgePermConnect {
  stroke: var(--rebac-accent);
}
.edgeOn.edgeMember {
  stroke: var(--rebac-text2);
}

.node {
  position: absolute;
  border: 1px solid var(--rebac-border);
  background: #fff;
  border-radius: 9px;
  padding: 7px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: box-shadow 0.12s, border-color 0.12s, opacity 0.12s;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
  text-align: left;
}
.node:hover {
  border-color: #d2d2d8;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.07);
}
.nodeDim {
  opacity: 0.32;
}
.nodeOn {
  border-color: var(--rebac-accent);
  box-shadow: 0 0 0 3px var(--rebac-accent-soft);
}
.nIc {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  color: #fff;
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 700;
}
.nH {
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.nName {
  font-weight: 600;
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nSub {
  font-size: 10.5px;
  color: var(--rebac-muted);
  white-space: nowrap;
}
.cnt {
  font-size: 11px;
  font-weight: 700;
  color: var(--rebac-text2);
  background: var(--rebac-hover2);
  border-radius: 20px;
  padding: 1px 7px;
  margin-left: auto;
}

.elabel {
  position: absolute;
  transform: translate(-50%, -50%);
  font-size: 10px;
  font-weight: 600;
  background: #fff;
  border: 1px solid var(--rebac-border);
  border-radius: 5px;
  padding: 1px 6px;
  color: var(--rebac-muted);
  white-space: nowrap;
  pointer-events: none;
}
.elabelUser {
  color: var(--rebac-accent);
}
.elabelEditor {
  color: var(--rebac-violet);
}
.elabelOwner {
  color: var(--rebac-purple);
}
.elabelConnect {
  color: var(--rebac-accent);
}
.elabelDim {
  opacity: 0.2;
}

/* inspector */
.inspector {
  border-left: 1px solid var(--rebac-border);
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.card {
  border: 1px solid var(--rebac-border);
  border-radius: 11px;
  overflow: hidden;
}
.cardH {
  padding: 11px 13px;
  border-bottom: 1px solid var(--rebac-border-soft);
  display: flex;
  align-items: center;
  gap: 8px;
}
.cardT {
  font-weight: 600;
  font-size: 13px;
}
.cardHIc {
  color: var(--rebac-muted);
  display: flex;
}
.cardB {
  padding: 13px;
}
.countBadge {
  margin-left: auto;
  font-size: 11px;
  font-weight: 700;
  color: var(--rebac-text2);
  background: var(--rebac-hover2);
  border-radius: 20px;
  padding: 1px 8px;
}

/* resolver */
.resolveRow {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 6px;
}
.sel {
  flex: 1;
  height: 32px;
  border: 1px solid var(--rebac-border);
  border-radius: 7px;
  padding: 0 9px;
  font-size: 12.5px;
  color: hsl(var(--foreground));
  background: #fff;
  display: flex;
  align-items: center;
  gap: 7px;
}
.sel:hover {
  background: var(--rebac-hover);
}
.selAv {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  flex-shrink: 0;
}
.selNative {
  border: none;
  background: none;
  outline: none;
  font-size: 12.5px;
  color: hsl(var(--foreground));
  width: 100%;
  cursor: pointer;
  font-family: inherit;
}
.relWord {
  font-size: 12px;
  color: var(--rebac-muted);
  padding: 0 2px;
  white-space: nowrap;
}

.verdict {
  margin-top: 12px;
  border-radius: 9px;
  padding: 11px 12px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.verdictAllow {
  background: var(--rebac-green-soft);
}
.verdictDeny {
  background: var(--rebac-red-soft);
}
.verdictIcon {
  flex-shrink: 0;
  margin-top: 1px;
}
.verdictAllow .verdictIcon {
  color: var(--rebac-green);
}
.verdictDeny .verdictIcon {
  color: var(--rebac-red);
}
.verdictTitle {
  font-weight: 600;
  font-size: 13px;
}
.verdictAllow .verdictTitle {
  color: var(--rebac-green-text);
}
.verdictDeny .verdictTitle {
  color: var(--rebac-red-text);
}
.verdictSub {
  font-size: 11.5px;
  color: var(--rebac-text2);
  margin-top: 2px;
}

.pathsCap {
  font-size: 10.5px;
  color: var(--rebac-muted2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  margin: 13px 0 7px;
}
.path {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  padding: 8px 9px;
  border: 1px solid var(--rebac-border);
  border-radius: 8px;
  margin-bottom: 6px;
  background: hsl(var(--sidebar));
}
.pnode {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 500;
  background: #fff;
  border: 1px solid var(--rebac-border);
  border-radius: 6px;
  padding: 2px 7px;
}
.pd {
  width: 7px;
  height: 7px;
  border-radius: 2px;
}
.parrow {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  color: var(--rebac-muted2);
  padding: 0 1px;
}
.prel {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1;
  color: var(--rebac-muted);
}
.prelUser {
  color: var(--rebac-accent);
}
.prelEditor {
  color: var(--rebac-violet);
}
.prelOwner {
  color: var(--rebac-purple);
}
.prelConnect {
  color: var(--rebac-accent);
}

/* tuples */
.tuple {
  font-family: var(--rebac-mono);
  font-size: 11px;
  padding: 8px 11px;
  border-bottom: 1px solid var(--rebac-border-soft);
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 1.4;
}
.tuple:last-child {
  border-bottom: none;
}
.tuple:hover {
  background: var(--rebac-hover);
}
.tk {
  color: var(--rebac-text2);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tkObj {
  color: var(--rebac-accent);
}
.tkRel {
  color: var(--rebac-violet);
  font-weight: 600;
}
.tkSub {
  color: var(--rebac-purple);
}
.tkAt {
  color: var(--rebac-muted2);
}
.fan {
  margin-left: auto;
  font-size: 10.5px;
  font-family: var(--font-sans, Inter, sans-serif);
  color: var(--rebac-muted);
  background: var(--rebac-hover2);
  border-radius: 20px;
  padding: 1px 8px;
  white-space: nowrap;
  flex-shrink: 0;
}
.tupleDirect .fan {
  color: var(--rebac-amber);
  background: var(--rebac-amber-soft);
}

.addrule {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 13px;
  border-top: 1px solid var(--rebac-border-soft);
  font-size: 12px;
  color: var(--rebac-text2);
  font-weight: 500;
  width: 100%;
  background: none;
  border-left: none;
  border-right: none;
  border-bottom: none;
  cursor: pointer;
  font-family: inherit;
}
.addrule:hover {
  background: var(--rebac-hover);
}

.scaleNote {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  background: var(--rebac-accent-soft);
  border-radius: 9px;
  padding: 10px 12px;
  font-size: 11.5px;
  color: var(--rebac-text2);
  line-height: 1.5;
}
.scaleNote b {
  color: hsl(var(--foreground));
}
.scaleNoteIcon {
  color: var(--rebac-accent);
  flex-shrink: 0;
  margin-top: 1px;
}

.emptyPane {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 360px;
  padding: 40px;
  text-align: center;
  color: var(--rebac-muted);
  font-size: 13px;
}
