:root {
  --ink: #0a0a0a;
  --paper: #f2efe6;
  --paper-2: #e8e4d7;
  --public: #1f6f6a;
  --private: #8a2f6b;
  --publish: #b8860b;
  --ingest: #3b5ba5;
  --contrib: #4a4a4a;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: ui-sans-serif, -apple-system, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

canvas {
  display: block;
  position: fixed;
  inset: 0;
  touch-action: none;
  cursor: grab;
}

canvas.panning { cursor: grabbing; }

.hud {
  position: fixed;
  z-index: 10;
  pointer-events: none;
}

.panel-wrap {
  --panel-w: min(332px, calc(100vw - 56px));
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 12;
  display: flex;
  pointer-events: none;
  transition: transform .22s ease;
}

.panel-wrap.collapsed {
  transform: translateX(calc(-1 * var(--panel-w)));
}

.panel {
  pointer-events: auto;
  width: var(--panel-w);
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 22px 20px 22px 22px;
  background: rgba(242, 239, 230, .92);
  backdrop-filter: blur(10px);
  border-right: 1px solid rgba(10, 10, 10, .12);
  overflow: hidden;
}

.panel-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  margin-top: 4px;
  padding-right: 4px;
}

.panel-toggle {
  pointer-events: auto;
  flex: none;
  align-self: flex-start;
  margin-top: 22px;
  width: 28px;
  height: 40px;
  border: 1px solid rgba(10, 10, 10, .14);
  border-left: none;
  border-radius: 0 3px 3px 0;
  background: rgba(242, 239, 230, .92);
  backdrop-filter: blur(10px);
  color: var(--ink);
  font: inherit;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  opacity: .75;
}

.panel-toggle:hover,
.panel-toggle:focus-visible {
  opacity: 1;
  outline: none;
}

.kicker {
  font-size: 11px;
  letter-spacing: .34em;
  text-transform: uppercase;
  font-weight: 600;
  opacity: .55;
  margin: 0 0 8px;
}

.title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

h1 {
  margin: 0;
  font-size: clamp(22px, 3.2vw, 30px);
  font-weight: 700;
  letter-spacing: -.02em;
  line-height: 1.05;
}

.helpbtn {
  pointer-events: auto;
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid rgba(10, 10, 10, .28);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  opacity: .7;
  transition: opacity .15s, background .15s;
}

.helpbtn:hover,
.helpbtn:focus-visible {
  opacity: 1;
  background: var(--paper);
  outline: none;
}

.sub {
  margin: 10px 0 0;
  font-size: 13.5px;
  line-height: 1.5;
  opacity: .62;
  font-weight: 450;
}

.panel-legend {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid rgba(10, 10, 10, .12);
}

.panel-legend h2 {
  margin: 0 0 12px;
  font-size: 10px;
  letter-spacing: .28em;
  text-transform: uppercase;
  font-weight: 600;
  opacity: .5;
}

.nodekey {
  position: fixed;
  bottom: 22px;
  right: 26px;
  z-index: 10;
  pointer-events: none;
  display: flex;
  gap: 20px;
  align-items: flex-end;
  background: rgba(242, 239, 230, .82);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(10, 10, 10, .14);
  border-radius: 2px;
  padding: 12px 16px;
}

.nk {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
  font-weight: 600;
  opacity: .65;
}

.nk svg { display: block; }

.lrow {
  display: flex;
  align-items: baseline;
  gap: 9px;
  margin: 0 0 7px;
  font-size: 12px;
  line-height: 1.35;
}

.lrow:last-child { margin-bottom: 0; }

.swatch {
  flex: none;
  width: 22px;
  height: 2px;
  position: relative;
  top: -3px;
  border-radius: 2px;
}

.swatch.dash {
  height: 0;
  border-top: 2px dashed;
  background: none;
}

.lname { font-weight: 600; }
.ldesc { opacity: .58; }

.flow-legend {
  margin: 0 0 10px;
}

.controls {
  top: 22px;
  right: 26px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
  pointer-events: auto;
}

.btnrow {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.btn {
  pointer-events: auto;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .02em;
  background: var(--ink);
  color: var(--paper);
  border: none;
  padding: 9px 15px;
  border-radius: 2px;
  transition: opacity .15s;
}

.btn:hover { opacity: .82; }

.btn.ghost {
  background: none;
  color: var(--ink);
  border: 1px solid rgba(10, 10, 10, .28);
}

.type-modal { width: min(400px, 100%); }

.type-body { padding-top: 14px; }

.typepicker {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.typepick {
  width: 100%;
  text-align: center;
  padding: 12px 10px;
}

.placehint {
  margin: 0;
  max-width: min(280px, 70vw);
  font-size: 11.5px;
  line-height: 1.45;
  opacity: .62;
  text-align: right;
}

canvas.placing { cursor: crosshair; }

.stat {
  font-size: 11px;
  letter-spacing: .02em;
  opacity: .55;
  text-align: right;
  font-variant-numeric: tabular-nums;
  line-height: 1.5;
}

.stat b {
  font-weight: 600;
  opacity: .85;
}

.pop {
  position: fixed;
  z-index: 20;
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity .13s, transform .13s;
  width: 216px;
  background: var(--ink);
  color: var(--paper);
  border-radius: 4px;
  padding: 13px 14px 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .28);
  font-size: 12px;
  line-height: 1.45;
}

.pop.show {
  opacity: 1;
  transform: translateY(0);
}

.pop .ptitle {
  font-weight: 700;
  font-size: 13px;
  letter-spacing: .01em;
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 2px;
}

.pop .pid {
  opacity: .5;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.pop .prole {
  font-size: 10px;
  letter-spacing: .16em;
  text-transform: uppercase;
  opacity: .55;
  margin-bottom: 10px;
}

.pop .prow {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 5px 0;
  font-variant-numeric: tabular-nums;
}

.pop .plab {
  opacity: .62;
  display: flex;
  align-items: center;
  gap: 6px;
}

.pop .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: none;
}

.pop .pval { font-weight: 600; }

.pop .bar {
  height: 5px;
  border-radius: 3px;
  background: rgba(242, 239, 230, .16);
  margin: 3px 0 9px;
  overflow: hidden;
  display: flex;
}

.pop .bar i {
  display: block;
  height: 100%;
}

.pop .pnet {
  margin-top: 9px;
  padding-top: 9px;
  border-top: 1px solid rgba(242, 239, 230, .14);
  font-size: 11px;
}

.pop .pnet b { font-weight: 700; }

.scrim {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(20, 18, 12, .42);
  backdrop-filter: blur(3px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.scrim.show { display: flex; }

.modal {
  width: min(720px, 100%);
  max-height: 88vh;
  overflow: auto;
  background: var(--paper);
  border: 1px solid rgba(10, 10, 10, .16);
  border-radius: 6px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .3);
}

.mhead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 20px 24px 0;
}

.mhead h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -.01em;
}

.mclose {
  cursor: pointer;
  border: none;
  background: none;
  font-size: 22px;
  line-height: 1;
  opacity: .5;
  padding: 4px 6px;
}

.mclose:hover { opacity: .9; }

.tabs {
  display: flex;
  gap: 4px;
  padding: 14px 24px 0;
  border-bottom: 1px solid rgba(10, 10, 10, .1);
}

.tab {
  cursor: pointer;
  border: none;
  background: none;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .02em;
  padding: 8px 12px 12px;
  opacity: .5;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.tab.active {
  opacity: 1;
  border-bottom-color: var(--ink);
}

.mbody { padding: 20px 24px 24px; }

.help-modal { width: min(560px, 100%); }

.help-body {
  padding-top: 12px;
}

.help-section {
  margin: 0 0 20px;
}

.help-section:last-child { margin-bottom: 0; }

.help-section h3 {
  margin: 0 0 8px;
  font-size: 11px;
  letter-spacing: .22em;
  text-transform: uppercase;
  font-weight: 600;
  opacity: .5;
}

.help-section p,
.help-section li {
  margin: 0 0 8px;
  font-size: 13.5px;
  line-height: 1.55;
  opacity: .82;
}

.help-section ul {
  margin: 0 0 8px;
  padding: 0 0 0 1.15em;
}

.help-section li { margin-bottom: 7px; }

.help-section b { font-weight: 650; opacity: 1; }

.kref {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .02em;
  border: 1px solid rgba(10, 10, 10, .28);
  padding: 1px 7px;
  border-radius: 2px;
  opacity: .9;
}

.mnote {
  font-size: 12px;
  opacity: .55;
  margin: 0 0 16px;
  line-height: 1.5;
}

.sort {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 0 0 16px;
}

.sort-label {
  font-size: 10px;
  letter-spacing: .16em;
  text-transform: uppercase;
  font-weight: 600;
  opacity: .45;
  margin-right: 4px;
}

.sortbtn {
  cursor: pointer;
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .02em;
  background: none;
  color: var(--ink);
  border: 1px solid rgba(10, 10, 10, .22);
  border-radius: 2px;
  padding: 5px 10px;
  opacity: .55;
}

.sortbtn:hover { opacity: .85; }

.sortbtn.active {
  opacity: 1;
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

#barChart { width: 100%; }

.brow {
  display: grid;
  grid-template-columns: 168px 1fr;
  gap: 12px;
  align-items: center;
  margin: 0 -6px 4px;
  padding: 5px 6px;
  border-radius: 3px;
  cursor: pointer;
  border: none;
  background: none;
  width: calc(100% + 12px);
  font: inherit;
  color: inherit;
  text-align: left;
}

.brow:hover,
.brow:focus-visible {
  background: rgba(10, 10, 10, .05);
  outline: none;
}

.blabel {
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-width: 0;
}

.bname {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: rgba(10, 10, 10, .22);
}

.bglyph { opacity: .5; }

.bkind {
  font-size: 10px;
  letter-spacing: .01em;
  opacity: .5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.brow:hover .bname,
.brow:focus-visible .bname {
  text-decoration-color: var(--ink);
}

.btrack {
  position: relative;
  height: 20px;
  display: flex;
  align-items: center;
}

.btrack .mid {
  position: absolute;
  left: 50%;
  top: -2px;
  bottom: -2px;
  width: 1px;
  background: rgba(10, 10, 10, .16);
}

.bhalf {
  height: 11px;
  display: flex;
  align-items: center;
}

.bhalf.prod {
  justify-content: flex-end;
  padding-right: 2px;
}

.bhalf.cons {
  justify-content: flex-start;
  padding-left: 2px;
}

.bhalf i {
  display: block;
  height: 100%;
  border-radius: 2px;
}

.bmini {
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  opacity: .6;
  padding: 0 4px;
}

.axisrow {
  display: grid;
  grid-template-columns: 168px 1fr;
  gap: 12px;
  margin-top: 4px;
}

.axis {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  letter-spacing: .1em;
  text-transform: uppercase;
  opacity: .45;
  font-weight: 600;
}

svg.line {
  width: 100%;
  height: 230px;
  display: block;
}

.typelegend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 14px;
  font-size: 11px;
}

.typelegend span {
  display: flex;
  align-items: center;
  gap: 6px;
  opacity: .75;
}

.typelegend i {
  width: 14px;
  height: 2px;
  border-radius: 2px;
  display: block;
}

@media (max-width: 720px) {
  .nodekey { display: none; }
  .controls { top: 14px; right: 14px; }
  .btn {
    padding: 8px 12px;
    font-size: 11px;
  }
  .panel { padding: 16px 16px 16px 16px; }
}
