/* Dark, high contrast, and quiet enough that the graph is the loudest thing
   on screen. Colour is reserved for meaning: node class and edge confidence. */

:root {
  --bg:        #0e1116;
  --panel:     #151a21;
  --panel-2:   #1b212a;
  --line:      #262d38;
  --ink:       #e6eaf0;
  --ink-dim:   #97a2b2;
  --ink-faint: #6b7688;

  --accent:    #4cc2ff;
  --hub:       #4cc2ff;
  --wan:       #7a8cff;
  --gateway:   #55d6a5;
  --firewall:  #ff9f45;
  --circuit:   #c9a3ff;
  --vnet:      #5aa9ff;
  --subnet:    #3d7ec4;
  --avs:       #ff7ac6;
  --compute:   #8b97a8;
  --bad:       #ff6b62;
  --warn:      #ffc857;
  --ok:        #57d38c;

  --radius: 10px;
  --font: "Inter", "Segoe UI", -apple-system, BlinkMacSystemFont, Helvetica, Arial, sans-serif;
  --mono: "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; height: 100%;
  background: var(--bg); color: var(--ink);
  font-family: var(--font); font-size: 14px; line-height: 1.5;
  overflow: hidden;
}

/* ---------- top bar ---------- */

.topbar {
  height: 62px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 18px; background: var(--panel); border-bottom: 1px solid var(--line);
  gap: 20px;
}

.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand h1 { font-size: 15px; margin: 0; font-weight: 600; letter-spacing: .2px; }
.brand p  { font-size: 11.5px; margin: 1px 0 0; color: var(--ink-faint); font-family: var(--mono); }

.mark {
  width: 26px; height: 26px; border-radius: 7px; flex: 0 0 auto;
  background: linear-gradient(135deg, var(--accent), #7a8cff);
  box-shadow: 0 0 16px rgba(76,194,255,.35);
}

.controls { display: flex; align-items: center; gap: 12px; }

.segmented { display: flex; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.segmented button {
  background: none; border: 0; color: var(--ink-dim); padding: 7px 13px;
  font: inherit; font-size: 12.5px; cursor: pointer;
}
.segmented button.on { background: var(--accent); color: #07121a; font-weight: 600; }
.segmented button:not(.on):hover { color: var(--ink); background: #222a35; }

.search { position: relative; }
.search input {
  width: 290px; padding: 8px 12px; border-radius: 8px;
  background: var(--panel-2); border: 1px solid var(--line);
  color: var(--ink); font: inherit; font-size: 13px;
}
.search input:focus { outline: none; border-color: var(--accent); }

#results {
  position: absolute; top: 40px; right: 0; width: 420px; max-height: 380px;
  overflow-y: auto; margin: 0; padding: 5px; list-style: none; z-index: 40;
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 10px; box-shadow: 0 18px 40px rgba(0,0,0,.55);
}
#results li { padding: 8px 10px; border-radius: 6px; cursor: pointer; }
#results li:hover { background: #263041; }
#results .r-name { font-weight: 600; }
#results .r-meta { font-size: 11.5px; color: var(--ink-faint); font-family: var(--mono); }

/* ---------- layout ---------- */

main { display: flex; height: calc(100% - 62px); }

.rail {
  width: 250px; flex: 0 0 250px; background: var(--panel);
  border-right: 1px solid var(--line); overflow-y: auto; padding: 16px 15px 30px;
}
.rail section { margin-bottom: 24px; }
.rail h2 {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .9px;
  color: var(--ink-faint); margin: 0 0 9px; font-weight: 600;
}

.legend { list-style: none; margin: 0; padding: 0; font-size: 12.5px; }
.legend li { display: flex; align-items: center; gap: 8px; padding: 3px 0; color: var(--ink-dim); }
.legend .dot { width: 11px; height: 11px; border-radius: 3px; flex: 0 0 auto; }
.lg-solid  { stroke: var(--ink-dim); stroke-width: 2; }
.lg-dashed { stroke: var(--ink-dim); stroke-width: 2; stroke-dasharray: 5 4; }

.hint { font-size: 11.5px; color: var(--ink-faint); margin: 8px 0 0; line-height: 1.45; }

.gaps { list-style: none; margin: 0; padding: 0; }
.gaps li {
  font-size: 11.5px; color: var(--ink-dim); padding: 8px 9px; margin-bottom: 6px;
  background: var(--panel-2); border-left: 2px solid var(--warn); border-radius: 5px;
}
.gaps .g-title { color: var(--ink); font-weight: 600; display: block; margin-bottom: 3px; }

/* ---------- stage ---------- */

.stage { flex: 1; position: relative; min-width: 0; }
#cy { position: absolute; inset: 0; }

.stagehint {
  position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%);
  font-size: 11.5px; color: var(--ink-faint); background: rgba(21,26,33,.9);
  padding: 6px 13px; border-radius: 20px; border: 1px solid var(--line);
  pointer-events: none;
}

/* ---------- detail ---------- */

.detail {
  width: 430px; flex: 0 0 430px; background: var(--panel);
  border-left: 1px solid var(--line); overflow-y: auto; padding: 18px 20px 40px;
  position: relative;
}
.detail h2 { font-size: 16px; margin: 0 6px 2px 0; word-break: break-word; }
.detail h3 {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .9px;
  color: var(--ink-faint); margin: 22px 0 8px; font-weight: 600;
  border-top: 1px solid var(--line); padding-top: 14px;
}
.dkind { font-size: 12px; color: var(--accent); margin: 0 0 14px; font-family: var(--mono); }

.close {
  position: absolute; top: 12px; right: 14px; background: none; border: 0;
  color: var(--ink-faint); font-size: 24px; cursor: pointer; line-height: 1;
}
.close:hover { color: var(--ink); }

.explain p {
  margin: 0 0 11px; font-size: 13.2px; color: #cfd6e0;
}
.explain p:last-child {
  color: var(--ink-faint); font-size: 12px; font-family: var(--mono);
}

.kv { width: 100%; border-collapse: collapse; font-size: 12.2px; }
.kv td { padding: 5px 7px; border-bottom: 1px solid var(--line); vertical-align: top; }
.kv td:first-child { color: var(--ink-faint); width: 40%; font-family: var(--mono); font-size: 11.5px; }
.kv td:last-child { word-break: break-word; }

.rel { display: flex; align-items: baseline; gap: 8px; padding: 5px 0; font-size: 12.5px; border-bottom: 1px solid var(--line); }
.rel .r-kind {
  font-family: var(--mono); font-size: 10.5px; color: var(--ink-faint);
  flex: 0 0 118px; text-transform: uppercase; letter-spacing: .4px;
}
.rel .r-target { color: var(--accent); cursor: pointer; word-break: break-word; }
.rel .r-target:hover { text-decoration: underline; }
.rel .inferred { color: var(--warn); font-size: 10px; border: 1px solid var(--warn); border-radius: 3px; padding: 0 4px; }

.pill { display: inline-block; padding: 2px 9px; border-radius: 11px; font-size: 11px; font-weight: 600; }
.pill.ok   { background: rgba(87,211,140,.15); color: var(--ok); }
.pill.warn { background: rgba(255,200,87,.15); color: var(--warn); }
.pill.bad  { background: rgba(255,107,98,.15);  color: var(--bad); }

.empty { color: var(--ink-faint); font-size: 12.5px; font-style: italic; }

/* ---------- trace form ---------- */

.fld { display: block; margin-bottom: 11px; }
.fld > span {
  display: block; font-size: 10.5px; text-transform: uppercase;
  letter-spacing: .8px; color: var(--ink-faint); margin-bottom: 4px;
}
.fld input, .fld select {
  width: 100%; padding: 7px 10px; border-radius: 7px;
  background: var(--panel-2); border: 1px solid var(--line);
  color: var(--ink); font: inherit; font-size: 13px;
  font-family: var(--mono);
}
.fld input:focus, .fld select:focus { outline: none; border-color: var(--accent); }

.fldrow { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }

button.run {
  width: 100%; margin-top: 6px; padding: 9px;
  background: var(--accent); color: #07121a; border: 0; border-radius: 7px;
  font: inherit; font-weight: 600; font-size: 13px; cursor: pointer;
}
button.run:hover { filter: brightness(1.08); }
button.run:disabled { opacity: .5; cursor: default; }
button.run:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.examples { list-style: none; margin: 0; padding: 0; font-size: 12px; }
.examples li {
  padding: 7px 9px; margin-bottom: 6px; border-radius: 6px; cursor: pointer;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--ink-dim);
}
.examples li:hover { border-color: var(--accent); color: var(--ink); }
.examples .ex-label { display: block; color: var(--ink); font-weight: 600; margin-bottom: 2px; }
.examples .ex-addr { font-family: var(--mono); font-size: 10.5px; color: var(--ink-faint); }

/* ---------- trace result ---------- */

#tracestage { position: absolute; inset: 0; overflow-y: auto; background: var(--bg); }
.traceinner { max-width: 860px; margin: 0 auto; padding: 34px 30px 70px; }
.tracewelcome { color: var(--ink-dim); font-size: 14px; }

.verdict {
  display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap;
  padding: 16px 20px; border-radius: 10px; margin-bottom: 8px;
  border: 1px solid var(--line); background: var(--panel);
}
.verdict .v {
  font-size: 15px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
}
.verdict.allowed       { border-left: 4px solid var(--ok); }
.verdict.allowed .v    { color: var(--ok); }
.verdict.denied        { border-left: 4px solid var(--bad); }
.verdict.denied .v     { color: var(--bad); }
.verdict.indeterminate { border-left: 4px solid var(--warn); }
.verdict.indeterminate .v { color: var(--warn); }
.verdict.unknown       { border-left: 4px solid var(--ink-faint); }
.verdict .s { color: var(--ink-dim); font-size: 13.5px; }

.tracequery {
  font-family: var(--mono); font-size: 12px; color: var(--ink-faint);
  margin: 0 0 22px 2px;
}

.basis {
  font-size: 12px; color: var(--ink-faint); border-left: 2px solid var(--line);
  padding-left: 12px; margin: 20px 0 0; line-height: 1.55;
}

.tracewarn {
  background: rgba(255,200,87,.08); border: 1px solid rgba(255,200,87,.3);
  border-radius: 8px; padding: 11px 14px; margin-bottom: 18px;
  font-size: 12.5px; color: var(--warn);
}

/* hop chain: marker gutter plus content, connected by a continuous rule */
.hops { position: relative; }

/* ---------- tiered path ---------- */
/*
   A published path crosses two reverse proxies, and under one of them a
   listener fans out into several URL paths. Bands separate the tiers; spurs
   branch off the line so a fan-out does not read as more hops in sequence.
*/
.tier { position: relative; margin-bottom: 6px; }
.tierhead {
  display: flex; align-items: center; gap: 9px;
  margin: 0 0 12px; padding-left: 2px;
}
.tiernum {
  width: 20px; height: 20px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  font-size: 11px; font-weight: 700; font-family: var(--mono);
  color: var(--bg); background: var(--accent);
}
.tiername {
  font-size: 11px; font-weight: 700; letter-spacing: 0.09em;
  text-transform: uppercase; color: var(--ink-dim);
}
.tier + .tier .tierhead { margin-top: 4px; }

/* The offshoot rail: one vertical line, each spur elbowing off it. */
.spurs {
  position: relative; margin: -6px 0 0 17px;
  padding: 6px 0 0 26px; border-left: 2px solid var(--line);
}
.spurs::after {
  content: ""; position: absolute; left: -2px; bottom: 0;
  width: 2px; height: 14px; background: var(--panel);
}
.hop.spur { padding-bottom: 14px; }
.hop.spur::before { display: none; }
.hop.spur::after {
  content: ""; position: absolute; left: -26px; top: 17px;
  width: 18px; height: 2px; background: var(--line);
}
.hop.spur .marker { width: 26px; height: 26px; font-size: 12px; }
.hop.spur { grid-template-columns: 26px minmax(0, 1fr); gap: 0 12px; }
.hop.spur h4 { font-size: 13.5px; margin-top: 2px; }
.hop.spur.deny::after, .hop.spur.unknown::after { background: var(--warn); }
.hop.spur.deny::after { background: var(--bad); }
.hop {
  display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 0 16px;
  padding-bottom: 20px; position: relative;
}
.hop:not(:last-child)::before {
  content: ""; position: absolute; left: 16px; top: 24px; bottom: 0;
  width: 2px; background: var(--line);
}
.hop.deny:not(:last-child)::before { background: var(--bad); }

.marker {
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 15px; font-weight: 700; z-index: 1;
  border: 2px solid var(--line); background: var(--panel);
  color: var(--ink-faint);
}
.hop.allow  .marker { border-color: var(--ok);   color: var(--ok); }
.hop.deny   .marker { border-color: var(--bad);  color: var(--bad); background: rgba(255,107,98,.1); }
.hop.stop   .marker { border-color: var(--warn); color: var(--warn); }
.hop.unknown .marker { border-color: var(--ink-faint); }

.hop h4 {
  margin: 5px 0 3px; font-size: 14.5px; font-weight: 600;
  color: var(--ink); line-height: 1.35;
}
.hop .rule {
  font-family: var(--mono); font-size: 11.5px; color: var(--accent);
  margin: 0 0 5px; word-break: break-word;
}
.hop.deny .rule { color: var(--bad); }
.hop .det { font-size: 13px; color: var(--ink-dim); margin: 0; line-height: 1.55; }
.hop .kindtag {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: .09em;
  text-transform: uppercase; color: var(--ink-faint);
}

/* ---------- graph navigation ---------- */

.navctl {
  position: absolute; top: 14px; left: 14px; z-index: 20;
  display: flex; align-items: center; gap: 8px;
  background: rgba(21,26,33,.92); border: 1px solid var(--line);
  border-radius: 8px; padding: 6px 10px;
}
.navctl button {
  background: var(--panel-2); border: 1px solid var(--line); color: var(--ink-dim);
  font: inherit; font-size: 12px; padding: 4px 11px; border-radius: 6px; cursor: pointer;
}
.navctl button:hover:not(:disabled) { color: var(--ink); border-color: var(--accent); }
.navctl button:disabled { opacity: .38; cursor: default; }
.navctl button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.navctl #navdepth {
  font-family: var(--mono); font-size: 10.5px; color: var(--ink-faint);
  padding-left: 4px; min-width: 74px;
}

/* A collapsed group reads as a placeholder, not as another resource. */

/* ---------- firewall rules panel ---------- */

.rulesum { font-size: 12.5px; color: var(--ink-dim); margin: 0 0 4px; }
/* A rules table is data, not prose. The 860px reading measure that suits an
   explanation wastes two thirds of a widescreen here, and a fixed 340px window
   shows eight rows on a monitor that could show forty. Both now follow the
   viewport. */
.ruletable {
  max-height: clamp(320px, calc(100vh - 300px), 1400px);
  overflow: auto; border: 1px solid var(--line); border-radius: 7px; margin-top: 10px;
}
.ruletable table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.ruletable td.mono, .ruletable .mono { word-break: break-word; }

/* Prose stays readable; a page carrying a table widens to the window. */
#policyinner { max-width: 1080px; }
#policyinner:has(.ruletable) { max-width: min(2200px, 100%); }
#policyinner:has(.ruletable) .sectionnote,
#policyinner:has(.ruletable) .searchnote { max-width: 90ch; }

.searchnote {
  margin: 0 0 12px; padding: 10px 12px; font-size: 12.5px; line-height: 1.6;
  color: var(--ink-dim); background: var(--panel-2);
  border-left: 2px solid var(--accent); border-radius: 5px;
}
.gname { font-weight: 600; color: var(--ink); }
.route.ruledeny { border-left: 2px solid var(--bad); padding-left: 9px; }
.ruletable th {
  position: sticky; top: 0; background: var(--panel-2); text-align: left;
  padding: 6px 8px; font-size: 9.5px; text-transform: uppercase;
  letter-spacing: .07em; color: var(--ink-faint); border-bottom: 1px solid var(--line);
}
.ruletable td { padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.ruletable tr:last-child td { border-bottom: none; }
.ruletable tr.ruledeny td { background: rgba(255,107,98,.06); }
.ruletable .mono { font-family: var(--mono); font-size: 10.5px; color: var(--ink-dim); word-break: break-all; }
.rulemeta { font-family: var(--mono); font-size: 9.5px; color: var(--ink-faint); margin-top: 2px; }

/* ---------- legend as filter ---------- */

.legend.toggles li { cursor: pointer; user-select: none; border-radius: 5px; padding: 3px 5px; }
.legend.toggles li:hover { background: var(--panel-2); color: var(--ink); }
.legend.toggles li.off { opacity: .38; text-decoration: line-through; }
.legend.toggles li.off .dot { background: transparent !important; border: 1px solid var(--ink-faint); }
.legend.toggles li .count {
  margin-left: auto; font-family: var(--mono); font-size: 10px; color: var(--ink-faint);
}

button.mini {
  float: right; background: none; border: 1px solid var(--line); color: var(--ink-faint);
  font: inherit; font-size: 9.5px; text-transform: uppercase; letter-spacing: .06em;
  padding: 1px 6px; border-radius: 4px; cursor: pointer;
}
button.mini:hover { color: var(--ink); border-color: var(--accent); }
button.mini:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.segmented.vertical { flex-direction: column; margin-bottom: 12px; }
.segmented.vertical button { text-align: left; border-bottom: 1px solid var(--line); }
.segmented.vertical button:last-child { border-bottom: 0; }

.picker { list-style: none; margin: 0; padding: 0; }
.picker li {
  padding: 8px 10px; margin-bottom: 5px; border-radius: 6px; cursor: pointer;
  background: var(--panel-2); border: 1px solid var(--line); font-size: 12.5px;
}
.picker li:hover { border-color: var(--accent); }
.picker li.on { border-color: var(--accent); background: #1d2836; }
.picker .p-name { display: block; color: var(--ink); font-weight: 600; }
.picker .p-meta { font-family: var(--mono); font-size: 10px; color: var(--ink-faint); }

/* ---------- publishing & policy page ---------- */

#policystage { position: absolute; inset: 0; overflow-y: auto; background: var(--bg); }

.chain { border: 1px solid var(--line); border-radius: 9px; margin-bottom: 16px; background: var(--panel); }
.chain > header {
  padding: 13px 17px; border-bottom: 1px solid var(--line);
  display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
}
.chain > header h3 { margin: 0; font-size: 15px; }
.chain .host { font-family: var(--mono); font-size: 11.5px; color: var(--accent); }
.chain .body { padding: 6px 17px 15px; }

.route { border-left: 2px solid var(--line); padding: 10px 0 10px 14px; margin: 10px 0; }
.route .rname { font-weight: 600; font-size: 13px; }
.route .rmeta { font-family: var(--mono); font-size: 10.5px; color: var(--ink-faint); margin: 3px 0 8px; }
.origin {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  font-size: 12px; padding: 5px 0 5px 14px; border-left: 1px dashed var(--line);
}
.origin .ohost { font-family: var(--mono); color: var(--ink-dim); word-break: break-all; }

.emptychain { color: var(--ink-faint); font-size: 12.5px; font-style: italic; padding: 4px 0 10px; }

.pathtag {
  font-family: var(--mono); font-size: 9px; letter-spacing: .06em;
  text-transform: uppercase; color: var(--accent);
  border: 1px solid var(--accent); border-radius: 3px;
  padding: 0 5px; margin-left: 8px; white-space: nowrap;
}

pre.arm {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px;
  padding: 14px 16px; font-family: var(--mono); font-size: 11px; line-height: 1.5;
  color: var(--ink-dim); overflow-x: auto; max-height: 420px; overflow-y: auto;
}

.legend .ico { width: 15px; height: 15px; flex: 0 0 auto; }
.legend.toggles li.off .ico { filter: grayscale(1) opacity(.45); }

/* ---------- policy catalogue: drawers, filter, cross links ---------- */
/*
   A Front Door profile can carry eight endpoints and thirty routes. Rendered
   as one scroll it is unreadable, and the question is nearly always about one
   endpoint at a time, so endpoints open as drawers.
*/
.chain.drawer { padding: 0; }
.chain.drawer > summary {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 11px 14px; cursor: pointer; list-style: none;
  border-radius: var(--radius);
}
.chain.drawer > summary::-webkit-details-marker { display: none; }
.chain.drawer > summary::before {
  content: "\25B8"; color: var(--ink-faint); font-size: 11px;
  transition: transform 0.12s ease; flex: none;
}
.chain.drawer[open] > summary::before { transform: rotate(90deg); }
.chain.drawer > summary:hover { background: var(--panel-2); }
.chain.drawer > summary h3 { margin: 0; font-size: 14px; }
.drawermeta {
  margin-left: auto; font-size: 11.5px; color: var(--ink-faint);
  font-family: var(--mono); white-space: nowrap;
}

.wafline {
  margin: 0 0 10px; font-size: 12.5px; color: var(--ink-dim);
  padding-bottom: 9px; border-bottom: 1px solid var(--line);
}
.wafline.none { color: var(--ink-faint); font-style: italic; }
a.wafjump {
  color: var(--accent); text-decoration: none; font-weight: 600;
  border-bottom: 1px dotted var(--accent);
}
a.wafjump:hover { border-bottom-style: solid; }
a.wafjump:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.warntext { color: var(--warn); }
.det.mono {
  font-family: var(--mono); font-size: 11px; color: var(--ink-faint);
  word-break: break-word; margin-top: 4px;
}

#filterfld input { font-family: var(--mono); font-size: 12px; }

/* ---------- section headings inside a catalogue page ---------- */
.sectionhead {
  display: flex; align-items: baseline; gap: 10px;
  margin: 22px 0 4px; padding-top: 14px; border-top: 1px solid var(--line);
  font-size: 12px; font-weight: 700; letter-spacing: 0.09em;
  text-transform: uppercase; color: var(--ink-dim);
}
.sectionhead .drawermeta { text-transform: none; letter-spacing: 0; }
.sectionnote {
  margin: 0 0 14px; font-size: 12.5px; color: var(--ink-faint); line-height: 1.55;
  max-width: 68ch;
}
.policyindex { margin-top: 9px; line-height: 2; }
.mono { font-family: var(--mono); font-size: 0.94em; }

/* ---------- expandable group detail in a DFW rule ---------- */
.gname.clickable { cursor: pointer; border-bottom: 1px dotted var(--ink-faint); }
.gname.clickable:hover { color: var(--accent); border-bottom-color: var(--accent); }
.gname.clickable::after { content: " \25BE"; font-size: 9px; color: var(--ink-faint); }
.gname.clickable.open::after { content: " \25B4"; }
.gdetail {
  margin: 7px 0 9px; padding: 9px 11px; border-radius: 6px;
  background: var(--panel-2); border-left: 2px solid var(--accent);
}
.gmembers { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.gmembers code {
  font-family: var(--mono); font-size: 10.5px; color: var(--ink-dim);
  background: rgba(255,255,255,.05); padding: 2px 6px; border-radius: 4px;
}

#ipamstage { position: absolute; inset: 0; overflow-y: auto; background: var(--bg); }
#ipaminner { max-width: min(2200px, 100%); }

/* ---------- IPAM ---------- */
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--ink); background: rgba(255,255,255,.04); }
.jumpbar {
  display: flex; flex-wrap: wrap; gap: 5px; align-items: center;
  margin: 16px 0 2px;
}
.jumpbar button {
  font-family: var(--mono); font-size: 10.5px; padding: 3px 8px;
  border-radius: 4px; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--ink-dim); cursor: pointer;
}
.jumpbar button:hover { color: var(--ink); border-color: var(--accent); }
#ipamrail .fld select {
  width: 100%; background: var(--panel-2); color: var(--ink);
  border: 1px solid var(--line); border-radius: 5px; padding: 6px 7px;
  font-size: 12px;
}
.chain.drawer > summary h3.mono { font-family: var(--mono); }

/* ---------- visible scrollbars ----------
   The default dark-theme scrollbar is the same value as the panel behind it,
   so a scrollable table looked like a truncated one. */
.ruletable, #ipamstage, #policystage, #tracestage, .picker {
  scrollbar-width: thin;
  scrollbar-color: #4a5568 var(--panel);
}
.ruletable::-webkit-scrollbar,
#ipamstage::-webkit-scrollbar,
#policystage::-webkit-scrollbar,
#tracestage::-webkit-scrollbar,
.picker::-webkit-scrollbar { width: 12px; height: 12px; }
.ruletable::-webkit-scrollbar-track,
#ipamstage::-webkit-scrollbar-track,
#policystage::-webkit-scrollbar-track,
#tracestage::-webkit-scrollbar-track,
.picker::-webkit-scrollbar-track { background: var(--panel); border-radius: 7px; }
.ruletable::-webkit-scrollbar-thumb,
#ipamstage::-webkit-scrollbar-thumb,
#policystage::-webkit-scrollbar-thumb,
#tracestage::-webkit-scrollbar-thumb,
.picker::-webkit-scrollbar-thumb {
  background: #4a5568; border-radius: 7px; border: 2px solid var(--panel);
}
.ruletable::-webkit-scrollbar-thumb:hover,
#ipamstage::-webkit-scrollbar-thumb:hover,
#policystage::-webkit-scrollbar-thumb:hover,
#tracestage::-webkit-scrollbar-thumb:hover,
.picker::-webkit-scrollbar-thumb:hover { background: #64748b; }

/* The hidden attribute loses to a display rule, so these panels stayed on
   screen in the non-graph views. */
.navctl[hidden], #edgeslegend[hidden] { display: none !important; }

/* ---------------------------------------------------------------------------
   Sign-in gate and account management.

   A fixed overlay rather than a page of its own: the body is overflow:hidden
   behind a fixed topbar, so a second document would have to re-create the
   whole shell to look like the same application. Everything here reuses the
   existing vocabulary -- .fld for inputs, button.run for the primary action,
   .mark for the brand tile -- so the login does not look like a bolt-on.
--------------------------------------------------------------------------- */

.authgate {
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: var(--bg);
  overflow: auto;
}

.authgate[hidden] { display: none; }

.authcard {
  position: relative;
  width: 100%; max-width: 380px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 26px 26px 22px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, .5);
}

.authcard.wide { max-width: 640px; }

.authcard .close {
  position: absolute; top: 10px; right: 12px;
  background: none; border: 0; color: var(--ink-faint);
  font-size: 20px; line-height: 1; cursor: pointer;
}
.authcard .close:hover { color: var(--ink); }

.authbrand { display: flex; align-items: center; gap: 13px; margin-bottom: 20px; }
.authbrand h1 { margin: 0; font-size: 16px; font-weight: 650; letter-spacing: -.01em; }
.authbrand p  { margin: 2px 0 0; font-size: 12.5px; color: var(--ink-dim); }

.mark.big { width: 38px; height: 38px; border-radius: 10px; }

/* An email address is not an IP address; the monospace default that .fld
   inputs carry reads as a machine value and makes typos harder to spot. */
.authcard .fld input[type="email"],
.authcard .fld input[type="password"] { font-family: var(--font); font-size: 13.5px; }

.authcard button.run { margin-top: 10px; }

button.run.ghost {
  background: var(--panel-2); color: var(--ink);
  border: 1px solid var(--line); font-weight: 500;
}
button.run.ghost:hover { border-color: var(--accent); filter: none; }

/* "or use your password" with a rule either side. */
.author {
  display: flex; align-items: center; gap: 10px;
  margin: 16px 0 12px; color: var(--ink-faint);
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .8px;
}
.author::before, .author::after {
  content: ""; flex: 1; height: 1px; background: var(--line);
}

.autherr {
  margin: 0 0 14px; padding: 9px 12px; border-radius: 7px;
  background: rgba(255, 107, 98, .1); border: 1px solid rgba(255, 107, 98, .32);
  color: var(--bad); font-size: 12.5px; line-height: 1.45;
}
.autherr[hidden] { display: none; }

.acctok {
  margin: 0 0 14px; padding: 9px 12px; border-radius: 7px;
  background: rgba(87, 211, 140, .1); border: 1px solid rgba(87, 211, 140, .3);
  color: var(--ok); font-size: 12.5px;
}
.acctok[hidden] { display: none; }

.authenrolwhy { margin: 0 0 4px; font-size: 13px; color: var(--ink-dim); line-height: 1.5; }

.authstep[hidden], .acctpane[hidden] { display: none; }

/* Signed-in chip in the topbar. */
.userchip { display: flex; align-items: center; gap: 8px; }
.userchip[hidden] { display: none; }

.userchip .who {
  max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  background: none; border: 0; padding: 0; cursor: pointer;
  font: inherit; font-size: 12px; color: var(--ink-dim);
}
.userchip .who:hover { color: var(--accent); }
.userchip button.mini { float: none; }

/* Account and user administration. */
#accttabs { margin: 4px 0 16px; }
.acctpane h3 {
  margin: 22px 0 10px; font-size: 11px; text-transform: uppercase;
  letter-spacing: .8px; color: var(--ink-faint); font-weight: 600;
}
.acctpane h3:first-child { margin-top: 0; }

.acctrow {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 9px 0; border-bottom: 1px solid var(--line);
}
.acctrow:last-child { border-bottom: 0; }
.acctrow .rname { font-size: 13px; font-weight: 600; }
.acctrow .rmeta { flex: 1; font-family: var(--mono); font-size: 10.5px; color: var(--ink-faint); }

/* Shown exactly once, so it is loud on purpose. */
.tempreveal {
  margin: 14px 0 4px; padding: 13px 15px; border-radius: 8px;
  background: rgba(255, 200, 87, .07); border: 1px solid rgba(255, 200, 87, .3);
}
.tempreveal[hidden] { display: none; }
.tempwhy { margin: 0 0 9px; font-size: 12.5px; color: var(--warn); line-height: 1.5; }
.temprow { display: flex; align-items: center; gap: 10px; }
.temprow code {
  flex: 1; font-family: var(--mono); font-size: 15px; letter-spacing: .05em;
  color: var(--ink); background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 6px; padding: 8px 11px;
  user-select: all; word-break: break-all;
}

/* An IP group reference in a rule table: the group's name, how many entries
   it holds, and what those entries are. The identifier the rule actually
   carries is a subscription path, which answers no question a reader has --
   they want to know whether the rule covers the address in front of them, and
   only the membership answers that. */
.ipgroup { padding: 2px 0; }
.ipgroup + .ipgroup { margin-top: 6px; border-top: 1px dashed var(--line); padding-top: 6px; }
.ipgroup .gname { font-weight: 600; font-size: 12.5px; color: var(--ink); }
.ipgroup .gcount {
  display: inline-block; margin-left: 6px; padding: 0 6px;
  border-radius: 9px; background: var(--panel-2); border: 1px solid var(--line);
  font-family: var(--mono); font-size: 10px; color: var(--ink-faint);
}
.ipgroup .gmembers {
  margin-top: 3px; font-family: var(--mono); font-size: 10.5px;
  color: var(--ink-dim); line-height: 1.5; word-break: break-word;
}
.ipgroup .gmore { color: var(--ink-faint); font-style: italic; }
