/*
 * THE PAPER TRAIL - Documentation Navigator
 * Developed by Robert Merchant  <robert.merchant@togetherforchildren.org.uk>  <robmerch00@gmail.com>
 * Copyright (c) 2026 Robert Merchant. All rights reserved.
 * Please keep this notice with the code.
 */
/* The Paper Trail - styles. Colours live here as variables; app.js reads them. */

:root {
  --bg: #070a11;
  --bg-2: #0c111b;
  --panel: #0d1420;
  --line: #1c2740;
  --line-2: #2a3856;
  --text: #e8edf6;
  --muted: #98a5ba;
  --accent: #8db6ff;
  --focus: #ffd479;

  /* node types: colour AND shape differ so colour is never the only cue */
  --c-event: #f3eedd;
  --c-document: #7aa7ee;
  --c-direct_work: #e68fb3;
  --c-plan: #e0c872;
  --c-action: #6fcf9f;
  --c-decision: #c692e6;
  --c-notification: #eda566;
  --c-review: #5ec5d3;
  --c-system: #9aa8c2;

  /* link types: colour AND line style differ */
  --e-required: #f4f7fd;
  --e-conditional: #ebc65f;
  --e-consider: #9aa8c2;
  --e-informational: #56647f;
  --e-tbv: #b9a3f0;

  --font: "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --topbar-h: 58px;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.noscript { position: fixed; inset: 0; z-index: 99; margin: 0; padding: 40px; background: var(--bg); }

#stars { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; }
.nebula {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(60% 50% at 18% 12%, rgba(70, 100, 190, .13), transparent 70%),
    radial-gradient(50% 45% at 85% 88%, rgba(110, 70, 170, .11), transparent 70%),
    radial-gradient(40% 40% at 70% 20%, rgba(60, 160, 170, .06), transparent 70%);
}

.view { position: relative; z-index: 1; height: 100%; }

button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ----------------------------- LANDING ----------------------------- */
#landing { display: flex; flex-direction: column; align-items: center; padding: 28px 24px 18px; overflow-y: auto; }
.brand { text-align: center; margin-top: 2vh; }
.brand-mark { width: 64px; height: 40px; color: var(--accent); }
.brand h1 { margin: 6px 0 0; font-size: 15px; font-weight: 600; letter-spacing: .42em; padding-left: .42em; }
.brand .sub { margin: 2px 0 0; color: var(--muted); font-size: 13px; letter-spacing: .08em; }

.ask { width: min(860px, 100%); margin: auto 0; text-align: center; padding: 3vh 0; }
.ask h2 { margin: 18px 0 6px; font-size: clamp(30px, 5vw, 52px); font-weight: 300; letter-spacing: -.01em; outline: none; }
.ask-sub { margin: 0 0 30px; color: var(--muted); }

.modes { display: inline-flex; border: 1px solid var(--line-2); border-radius: 999px; padding: 3px; background: rgba(13, 20, 32, .6); }
.modebtn { border: 0; background: transparent; padding: 5px 16px; border-radius: 999px; font-size: 13px; color: var(--muted); letter-spacing: .04em; }
.modebtn[aria-pressed="true"] { background: var(--line-2); color: var(--text); }
.modebtn:hover { color: var(--text); }

/* role selector on the start screen (DO mode) */
.roles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 0 0 18px; text-align: left; }
.roles[hidden] { display: none; }
.role { position: relative; padding: 14px 16px 12px; border: 1px solid var(--line-2); border-radius: 10px; background: rgba(13, 20, 32, .6); color: var(--muted); transition: border-color .2s, background .2s, box-shadow .25s; }
.role .r-label { display: block; font-size: 13px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--text); line-height: 1.35; }
.role .r-hint { display: block; margin-top: 5px; font-size: 12.5px; line-height: 1.4; }
.role .r-count { display: block; margin-top: 8px; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; opacity: .75; }
.role:hover { border-color: var(--accent); color: var(--text); }
.role[aria-pressed="true"] { border-color: var(--accent); background: linear-gradient(180deg, rgba(34, 52, 86, .75), rgba(18, 27, 44, .85)); color: var(--text); box-shadow: 0 0 0 1px rgba(141, 182, 255, .25) inset, 0 6px 24px rgba(110, 150, 255, .12); }
@media (max-width: 760px) { .roles { grid-template-columns: 1fr; } }

.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.tile {
  position: relative; text-align: left; padding: 20px 20px 18px; min-height: 108px;
  background: linear-gradient(180deg, rgba(18, 27, 44, .85), rgba(11, 17, 28, .85));
  border: 1px solid var(--line-2); border-radius: 10px;
  transition: border-color .2s, transform .2s, box-shadow .25s, background .25s;
}
.tile .t-label { display: block; font-size: 15px; font-weight: 600; letter-spacing: .22em; text-transform: uppercase; }
.tile .t-hint { display: block; margin-top: 7px; font-size: 13.5px; color: var(--muted); line-height: 1.4; }
.tile .t-tag { position: absolute; right: 14px; bottom: 14px; font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); border: 1px solid var(--line-2); border-radius: 4px; padding: 1px 6px; }
.tile:last-child { grid-column: 1 / -1; min-height: 84px; }
.tile .t-dot { position: absolute; right: 16px; bottom: 16px; width: 8px; height: 8px; border-radius: 50%; background: var(--c-event); box-shadow: 0 0 10px 2px rgba(243, 238, 221, .45); }
.tile:not([aria-disabled="true"]):hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 8px 30px rgba(110, 150, 255, .14), 0 0 0 1px rgba(141, 182, 255, .25) inset; }
.tile[aria-disabled="true"] { opacity: .5; cursor: default; }
.tile.type-document .t-dot { background: var(--c-document); box-shadow: 0 0 10px 2px rgba(122, 167, 238, .45); }
.tile.type-direct_work .t-dot { background: var(--c-direct_work); box-shadow: 0 0 10px 2px rgba(230, 143, 179, .45); }
.tile.type-event .t-dot { background: var(--c-event); }
.tile.type-plan .t-dot { background: var(--c-plan); box-shadow: 0 0 10px 2px rgba(224, 200, 114, .45); }
.tile.type-review .t-dot { background: var(--c-review); box-shadow: 0 0 10px 2px rgba(94, 197, 211, .45); }
.tile.type-action .t-dot { background: var(--c-action); box-shadow: 0 0 10px 2px rgba(111, 207, 159, .45); }

.search-wrap { position: relative; }
.search-wrap.big { margin: 18px auto 0; width: min(560px, 100%); text-align: left; }
input[type="search"] {
  width: 100%; font: inherit; color: var(--text); background: rgba(8, 12, 20, .85);
  border: 1px solid var(--line-2); border-radius: 8px; padding: 9px 14px;
}
.big input[type="search"] { padding: 14px 18px; font-size: 17px; }
input[type="search"]::placeholder { color: #6e7b92; }
input[type="search"]:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(141, 182, 255, .2); }

.results {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 30; margin: 0; padding: 4px; list-style: none;
  background: #0b111c; border: 1px solid var(--line-2); border-radius: 8px; max-height: 340px; overflow: auto;
  box-shadow: 0 16px 40px rgba(0, 0, 0, .55); min-width: 320px;
}
.results li { padding: 8px 10px; border-radius: 6px; cursor: pointer; }
.results li[aria-selected="true"], .results li:hover { background: rgba(141, 182, 255, .14); }
.results .r-name { display: block; font-weight: 600; }
.results .r-meta { display: block; font-size: 12.5px; color: var(--muted); }
.results .r-none { color: var(--muted); cursor: default; }
.results .r-none:hover { background: none; }

.foot { color: var(--muted); font-size: 12.5px; text-align: center; max-width: 880px; }
.foot-line { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: center; }
.foot-note { margin: 6px 0 0; font-size: 11.5px; color: #7d8aa1; line-height: 1.45; }
.linklike { background: none; border: 0; padding: 0; color: var(--muted); text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; font-size: 12.5px; }
.linklike:hover { color: var(--text); }

/* ----------------------------- MAP VIEW ---------------------------- */
#graphView { display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 14px; height: var(--topbar-h); padding: 0 14px; flex: none;
  background: rgba(7, 10, 17, .82); border-bottom: 1px solid var(--line); backdrop-filter: blur(8px); position: relative; z-index: 20;
}
.btn { background: rgba(18, 27, 44, .7); border: 1px solid var(--line-2); border-radius: 7px; padding: 6px 12px; font-size: 14px; white-space: nowrap; transition: border-color .15s, background .15s; }
.btn:hover { border-color: var(--accent); background: rgba(30, 44, 72, .8); }
.btn[aria-pressed="true"] { border-color: var(--accent); background: rgba(48, 74, 128, .5); }
.btn.icon { width: 32px; height: 32px; padding: 0; border-radius: 50%; font-family: Georgia, serif; font-style: italic; font-weight: 700; }
.evtitle { display: flex; flex-direction: column; line-height: 1.15; margin-right: 4px; }
.evkicker { font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.evtitle strong { font-size: 17px; font-weight: 600; letter-spacing: .02em; }
.topbar .search-wrap { flex: 1 1 220px; max-width: 340px; margin-left: auto; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.btn.pill { border-radius: 999px; font-size: 12.5px; color: var(--muted); padding: 6px 12px; }

.stage { position: relative; flex: 1 1 auto; min-height: 0; overflow: hidden; }
#map { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; outline: none; touch-action: none; }
#map:active { cursor: grabbing; }

/* ---- svg: nodes ---- */
.node { cursor: pointer; outline: none; transition: opacity .35s; }
.node .halo { opacity: .22; transition: opacity .3s, r .3s; }
.node .body { fill: #0d1523; stroke-width: 2; transition: stroke-width .2s, fill .2s; stroke-linejoin: round; }
.node .core { opacity: .9; }
.node .ring-focus { fill: none; stroke: var(--focus); stroke-width: 2.5; opacity: 0; stroke-dasharray: 4 4; }
.node:focus-visible .ring-focus { opacity: 1; }
.node .label { fill: var(--text); font-size: calc(13.5px * var(--ls, 1)); font-family: var(--font); text-anchor: middle; paint-order: stroke; stroke: var(--bg); stroke-width: 4px; stroke-linejoin: round; pointer-events: none; }
.node .label .tag { fill: var(--muted); font-size: .7em; letter-spacing: .12em; text-transform: uppercase; }
.node:hover .halo, .node.hl .halo { opacity: .38; }
.node:hover .body { fill: #14203a; }
.node.sel .halo { opacity: .6; }
.node.sel .body { stroke-width: 4; fill: #17274a; }
.node.dim { opacity: .16; }
.node .sysring { fill: none; stroke: var(--c-system); stroke-width: 1.2; opacity: .8; pointer-events: none; }
.node .sysring.ring-dotted { stroke-dasharray: 1.5 4.5; stroke-width: 2.2; stroke-linecap: round; }
.node .sysring.ring-solid { stroke-width: 1.6; }
.node .sysring.ring-double { stroke-width: 1; }
.node .more-ring { fill: none; stroke-width: 1.5; stroke-dasharray: 3 5; opacity: .75; animation: dashmove 3s linear infinite; }
.node .badge circle { fill: var(--bg); stroke-width: 1.5; }
.node .badge text { fill: var(--text); font-size: 11px; font-weight: 700; text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.node .orbit { fill: none; stroke: var(--c-event); stroke-width: 1; opacity: .35; stroke-dasharray: 2 7; }
.node .orbit.o1 { animation: dashmove 14s linear infinite; }
.node .orbit.o2 { animation: dashmove 24s linear infinite reverse; opacity: .22; }
.node .pulse { fill: none; stroke: var(--c-event); stroke-width: 1.5; opacity: 0; animation: ping 3.6s ease-out infinite; pointer-events: none; }

/* ---- svg: links ---- */
.link { transition: opacity .35s; }
.link .hit { fill: none; stroke: transparent; stroke-width: 16px; cursor: help; }
.link .line { fill: none; stroke-linecap: round; transition: stroke-width .2s; }
.link .glowline { fill: none; opacity: .28; stroke-linecap: round; }
.link.required .line { stroke: var(--e-required); stroke-width: 2.4; }
.link.required .glowline { stroke: var(--e-required); stroke-width: 7; }
.link.conditional .line { stroke: var(--e-conditional); stroke-width: 2.1; stroke-dasharray: 9 6; animation: march 1.2s linear infinite; }
.link.conditional .glowline { stroke: var(--e-conditional); stroke-width: 6; opacity: .16; }
.link.consider .line { stroke: var(--e-consider); stroke-width: 2.2; stroke-dasharray: .1 7; }
.link.informational .line { stroke: var(--e-informational); stroke-width: 1.2; }
.link.tbv .line { stroke: var(--e-tbv); stroke-width: 2; stroke-dasharray: 10 4 2 4; }
.link.tbv .glowline { stroke: var(--e-tbv); stroke-width: 5; opacity: .12; }
.link.sel .line { stroke-width: 4; }
.link.sel .glowline { opacity: .5; }
.link .hit { cursor: pointer; }
.link .rellbl { display: none; }
.link.adj .rellbl { display: block; }
.link .rellbl rect { fill: #0b111c; stroke: var(--line-2); }
.link .rellbl text { fill: var(--text); font-size: 10.5px; letter-spacing: .04em; text-anchor: middle; dominant-baseline: central; }
/* evidence glyphs: always for 'needs confirming', for all links when Evidence is on */
.link .ev { display: none; pointer-events: none; }
.link.ver-needs .ev, #map.show-ev .ev { display: block; }
.link .ev circle { fill: var(--bg); stroke-width: 1.4; }
.link .ev text { font-size: 11px; font-weight: 700; text-anchor: middle; dominant-baseline: central; fill: var(--text); }
.link.ver-verified .ev circle { stroke: var(--c-action); }
.link.ver-inferred .ev circle { stroke: var(--e-consider); stroke-dasharray: 2 2; }
.link.ver-needs .ev circle { stroke: var(--e-conditional); }
.link.ver-inferred .line { opacity: .86; }
.link.ver-needs .line { opacity: .72; }
.link.hl .line { stroke-width: 3.2; }
.link.dim { opacity: .07; }
.link .lbl rect { fill: var(--bg); stroke: var(--line-2); }
.link .lbl text { fill: var(--text); font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-anchor: middle; dominant-baseline: central; }
.link .lbl.yes rect { stroke: var(--c-action); } .link .lbl.no rect { stroke: #e58a8a; }
.particle { pointer-events: none; }
.particle.required { fill: #fff; }
.particle.conditional { fill: var(--e-conditional); }

@keyframes dashmove { to { stroke-dashoffset: -64; } }
@keyframes march { to { stroke-dashoffset: -30; } }
@keyframes ping { 0% { opacity: .55; r: 46px; } 100% { opacity: 0; r: 112px; } }

@media (prefers-reduced-motion: reduce) {
  .node .more-ring, .node .orbit, .node .pulse, .link.conditional .line { animation: none; }
  .tile, .node, .link { transition: none; }
}

/* ---- drawers ---- */
.drawer { position: absolute; top: 0; bottom: 0; z-index: 15; background: rgba(11, 17, 28, .94); border: 0 solid var(--line); backdrop-filter: blur(10px); display: flex; flex-direction: column; box-shadow: 0 0 40px rgba(0, 0, 0, .5); }
.drawer.right { right: 0; width: min(430px, 100%); border-left-width: 1px; animation: slideR .28s ease-out; }
.drawer.left { left: 0; width: min(330px, 100%); border-right-width: 1px; animation: slideL .28s ease-out; }
@keyframes slideR { from { transform: translateX(30px); opacity: 0; } }
@keyframes slideL { from { transform: translateX(-30px); opacity: 0; } }
.drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); flex: none; }
.x { background: none; border: 0; font-size: 26px; line-height: 1; color: var(--muted); width: 34px; height: 34px; border-radius: 6px; flex: none; }
.x:hover { color: var(--text); background: rgba(255, 255, 255, .06); }
.crumbs { font-size: 12.5px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 2px 6px; align-items: center; }
.crumbs button { background: none; border: 0; padding: 0; color: var(--muted); text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; font-size: 12.5px; }
.crumbs button:hover { color: var(--text); }
.crumbs .here { color: var(--text); }

.panel-body { padding: 18px 20px 28px; overflow-y: auto; flex: 1; }
.panel-body h2 { margin: 0 0 10px; font-size: 24px; font-weight: 600; line-height: 1.2; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.chip { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; border: 1px solid var(--line-2); border-radius: 999px; padding: 3px 11px 3px 8px; }
.chip svg { flex: none; }
.chip.req { padding-left: 10px; }
.chip.req-required { border-color: #cfd8ea; }
.chip.req-conditional { border-color: var(--e-conditional); border-style: dashed; }
.chip.req-consider { border-color: var(--e-consider); border-style: dotted; border-width: 2px; }
.chip.req-informational { border-color: var(--e-informational); }
.chip.req-tbv { border-color: var(--e-tbv); border-style: dashed; }
.lead { font-size: 17px; line-height: 1.5; margin: 0 0 18px; color: #f2f5fb; }
.sec { margin: 0 0 18px; }
.sec h3 { margin: 0 0 5px; font-size: 11.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.sec p { margin: 0; }
.sec ul { margin: 0; padding-left: 20px; } .sec li { margin: 3px 0; }
.ask-box { border: 1px solid var(--line-2); border-left: 3px solid var(--c-decision); border-radius: 6px; padding: 12px 14px; margin: 0 0 18px; background: rgba(198, 146, 230, .06); }
.ask-box h3 { margin: 0 0 4px; font-size: 11.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.ask-box .q { font-size: 17px; font-weight: 600; }
.yn { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0 0 18px; }
.yn > div { border: 1px solid var(--line-2); border-radius: 6px; padding: 10px 12px; font-size: 14.5px; }
.yn b { display: block; font-size: 11.5px; letter-spacing: .14em; margin-bottom: 3px; }
.yn .y { border-top: 3px solid var(--c-action); } .yn .n { border-top: 3px solid #e58a8a; }
.linklist { list-style: none; margin: 0; padding: 0; }
.linklist li { margin: 0 0 6px; }
.linkbtn { width: 100%; text-align: left; display: block; background: rgba(18, 27, 44, .6); border: 1px solid var(--line-2); border-radius: 7px; padding: 8px 11px; }
.linkbtn:hover { border-color: var(--accent); background: rgba(30, 44, 72, .7); }
.linkbtn .lb-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.linkbtn .lb-name { font-weight: 600; }
.linkbtn .lb-why { display: block; font-size: 13px; color: var(--muted); margin-top: 2px; }
.mini { font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; border: 1px solid var(--line-2); border-radius: 4px; padding: 0 6px; color: var(--muted); }
.mini.req-required { border-color: #cfd8ea; color: var(--text); }
.mini.req-conditional { border-color: var(--e-conditional); border-style: dashed; color: var(--e-conditional); }
.mini.req-consider { border-color: var(--e-consider); border-style: dotted; }
.mini.req-informational { border-color: var(--e-informational); }
.mini.req-tbv { border-color: var(--e-tbv); border-style: dashed; color: var(--e-tbv); }
.vchip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; border: 1px solid var(--line-2); border-radius: 999px; padding: 2px 10px 2px 7px; }
.vchip b { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; border: 1.4px solid var(--e-consider); font-size: 11px; }
.vchip.ver-verified b { border-color: var(--c-action); }
.vchip.ver-inferred b { border-style: dashed; }
.vchip.ver-needs b { border-color: var(--e-conditional); }
.linkbtn .vg { display: inline-grid; place-items: center; width: 15px; height: 15px; border-radius: 50%; border: 1.3px solid var(--e-consider); font-size: 10px; font-weight: 700; }
.linkbtn .vg.ver-verified { border-color: var(--c-action); } .linkbtn .vg.ver-needs { border-color: var(--e-conditional); } .linkbtn .vg.ver-inferred { border-style: dashed; }
.rel-chip { font-size: 11.5px; letter-spacing: .04em; color: var(--accent); }
.btn-small { background: rgba(18, 27, 44, .7); border: 1px solid var(--line-2); border-radius: 7px; padding: 4px 11px; font-size: 13px; margin: 0 0 14px; }
.btn-small:hover { border-color: var(--accent); }
.sys-chip { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; border: 1px solid var(--line-2); border-radius: 6px; padding: 2px 9px; margin: 0 6px 6px 0; }
.sys-chip i { font-style: normal; color: var(--muted); font-size: 11px; }
.edge-flow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 0 14px; }
.edge-flow button { background: rgba(18, 27, 44, .7); border: 1px solid var(--line-2); border-radius: 7px; padding: 6px 11px; font-weight: 600; }
.edge-flow button:hover { border-color: var(--accent); }
.edge-flow .arrow { color: var(--muted); }
details.maint { margin: 0 0 18px; border: 1px dashed var(--line-2); border-radius: 8px; padding: 8px 12px; color: var(--muted); font-size: 14px; }
details.maint summary { cursor: pointer; font-size: 11.5px; letter-spacing: .14em; text-transform: uppercase; }
.where { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; background: rgba(8, 12, 20, .5); margin: 0 0 18px; }
.where h3 { margin: 0 0 8px; font-size: 11.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.where dl { margin: 0; display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; }
.where dt { color: var(--muted); font-size: 13.5px; } .where dd { margin: 0; }
.where dd button { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; text-underline-offset: 3px; margin-right: 8px; }
.placeholder-note { margin-top: 22px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); }

.outline-list { list-style: none; margin: 0; padding: 8px 8px 24px; overflow-y: auto; flex: 1; }
.outline-list button { width: 100%; text-align: left; background: none; border: 0; border-radius: 6px; padding: 5px 8px; display: flex; gap: 8px; align-items: baseline; }
.outline-list button:hover { background: rgba(141, 182, 255, .12); }
.outline-list button[aria-current="true"] { background: rgba(141, 182, 255, .2); }
.outline-list .o-type { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); min-width: 96px; }
.outline-list .locked .o-name { color: var(--muted); }

/* ---- legend / hint / tooltip ---- */
.legend { position: absolute; left: 14px; bottom: 14px; z-index: 10; background: rgba(9, 14, 24, .88); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px 10px; backdrop-filter: blur(6px); font-size: 12px; max-width: 520px; max-height: calc(100% - 28px); overflow: auto; }
.legend-title { font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.legend-grid { display: grid; grid-template-columns: auto auto; gap: 8px 26px; }
.legend-sub { color: var(--muted); font-size: 11px; margin-bottom: 3px; }
.legend ul { list-style: none; margin: 0; padding: 0; }
.legend li { display: flex; align-items: center; gap: 8px; margin: 2px 0; white-space: nowrap; }
.legend li button { display: flex; align-items: center; gap: 8px; background: none; border: 1px solid transparent; border-radius: 6px; padding: 1px 6px 1px 2px; margin-left: -2px; color: inherit; font-size: 12px; }
.legend li button:hover { border-color: var(--line-2); }
.legend li button[aria-pressed="true"] { border-color: var(--accent); background: rgba(48, 74, 128, .4); }
.legend li button:disabled { opacity: .55; cursor: default; }
.legend li small { color: var(--muted); }
.legend svg { flex: none; }
.legend-foot { margin-top: 6px; color: var(--muted); font-size: 11.5px; }
.hint { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 9; font-size: 12.5px; color: var(--muted); background: rgba(9, 14, 24, .7); border: 1px solid var(--line); border-radius: 999px; padding: 4px 14px; transition: opacity 1s; pointer-events: none; white-space: nowrap; }
.hint.gone { opacity: 0; }
.tip { position: absolute; z-index: 25; max-width: 290px; pointer-events: none; background: #0b111c; border: 1px solid var(--line-2); border-radius: 8px; padding: 8px 11px; font-size: 13.5px; box-shadow: 0 10px 30px rgba(0, 0, 0, .55); }
.tip b { display: block; margin-bottom: 2px; }
.tip small { display: block; color: var(--muted); margin-top: 3px; font-size: 12px; }

/* ---- about ---- */
dialog { color: var(--text); background: #0d1420; border: 1px solid var(--line-2); border-radius: 12px; padding: 0; width: min(520px, calc(100% - 32px)); box-shadow: 0 30px 80px rgba(0, 0, 0, .7); }
dialog::backdrop { background: rgba(3, 5, 10, .72); }
.about-inner { padding: 22px 26px 24px; position: relative; }
.about-inner .x { position: absolute; right: 12px; top: 10px; }
.about-inner h2 { margin: 0; font-weight: 600; letter-spacing: .02em; }
.about-sub { margin: 0 0 14px; color: var(--muted); }
.about-inner h3 { margin: 18px 0 6px; font-size: 11.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.about-inner ul { margin: 0; padding-left: 20px; } .about-inner li { margin: 4px 0; }
.about-meta { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 0; }
.about-meta dt { color: var(--muted); } .about-meta dd { margin: 0; }
.about-counts { margin: 0; font-size: 14px; color: var(--muted); }
.about-check { margin: 8px 0 0; font-size: 12.5px; color: var(--muted); }
.about-check.bad { color: #ffb4b4; }

/* ---- small screens ---- */
@media (max-width: 900px) {
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .topbar { flex-wrap: wrap; height: auto; padding: 8px 10px; gap: 8px; }
  :root { --topbar-h: 96px; }
  .topbar .search-wrap { order: 5; flex-basis: 100%; max-width: none; }
  .legend { display: none; }
  .drawer.right { width: 100%; top: 38%; border-left-width: 0; border-top-width: 1px; }
}


/* ===== v0.3: pathway layout, practice-lead evidence, links, credit ===== */
.stage-line { stroke: var(--line-2); stroke-width: 1; stroke-dasharray: 2 7; opacity: .55; }
.stage-head { fill: var(--muted); font-size: calc(11px * var(--ls, 1)); letter-spacing: .2em; text-anchor: middle; font-weight: 600; }
.link.ver-lead .ev circle { stroke: var(--accent); }
.vchip.ver-lead b { border-color: var(--accent); }
.linkbtn .vg.ver-lead { border-color: var(--accent); }
.outline-list .o-stage { margin: 12px 0 2px; padding: 0 10px; font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.outline-list .mini { margin-left: auto; white-space: nowrap; }
.sec ul.linksec { list-style: none; padding-left: 0; }
.sec ul.linksec a { color: var(--accent); }
.urltext { font-size: 12px; color: var(--muted); word-break: break-all; margin-top: 2px; }
.foot-credit { margin: 4px 0 0; font-size: 11px; color: #67738a; letter-spacing: .04em; }
.about-author { margin: 0 0 6px; font-size: 14px; color: var(--muted); line-height: 1.6; }
.about-author a { color: var(--accent); }

/* pinned nodes: stay where you drop them. Double-click to unpin; Reset unpins all. */
.node .pin { display: none; pointer-events: none; }
.node.pinned .pin { display: block; }
.node .pin-bg { fill: var(--bg); stroke: var(--accent); stroke-width: 1.2; }
.node .pin-icon { fill: none; stroke: var(--accent); stroke-width: 1.4; stroke-linecap: round; }

/* ===== v0.4: tickable checklist (in memory only) ===== */
.outline-tools { padding: 10px 14px 8px; border-bottom: 1px solid var(--line); }
.pg-text { font-size: 13.5px; margin-bottom: 6px; }
.pg-bar { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.pg-fill { height: 100%; background: var(--accent); transition: width .3s; }
.pg-fill.full { background: var(--c-action); }
.tool-row { display: flex; gap: 8px; margin-top: 10px; }
.tool-row .btn-small { margin: 0; }
.tool-note { margin: 8px 0 0; font-size: 11.5px; color: var(--muted); line-height: 1.4; }
.outline-list li.oi { display: flex; align-items: center; gap: 4px; }
.outline-list li.oi button { flex: 1; width: auto; min-width: 0; }
.outline-list .cb { flex: none; width: 18px; height: 18px; margin: 0 0 0 6px; accent-color: var(--c-action); cursor: pointer; }
.outline-list .cb-spacer { flex: none; width: 18px; margin-left: 6px; }
.outline-list li.done .o-name { color: var(--muted); text-decoration: line-through; }
.outline-list li.done .o-type, .outline-list li.done .mini { opacity: .5; }
.btn-small.tick.on { border-color: var(--c-action); color: var(--c-action); }
.node .check { display: none; pointer-events: none; }
.node.done .check { display: block; }
.node .check circle { fill: var(--bg); stroke: var(--c-action); stroke-width: 1.6; }
.node .check path { fill: none; stroke: var(--c-action); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.node.done .core { display: none; }
.node.done .body { opacity: .5; }
.node.done .halo { opacity: .07; }
.node.done .label { fill: var(--muted); text-decoration: line-through; }
.node.done .label .tag { text-decoration: none; }
.node.ready .halo { opacity: .75; }
.node.ready .body { stroke-width: 4; }

/* collapse badge: a minus on a step whose options are all showing */
.node .badge { cursor: pointer; }
.node .badge.collapse circle { stroke-dasharray: none; fill: var(--bg); }
.node .badge.collapse text { font-size: 15px; font-weight: 700; }

/* ===== v0.4 polish: top bar can grow instead of clipping; outline rows keep their chips ===== */
.topbar { height: auto; min-height: var(--topbar-h); padding-top: 8px; padding-bottom: 8px; flex-wrap: wrap; row-gap: 8px; }
.evtitle strong { white-space: nowrap; }
.topbar .search-wrap { flex: 1 1 180px; min-width: 150px; }
.outline-list li.oi button { display: grid; grid-template-columns: 92px 1fr; column-gap: 6px; row-gap: 3px; align-items: baseline; }
.outline-list li.oi .o-type { min-width: 0; }
.outline-list li.oi .mini { grid-column: 2; justify-self: start; margin-left: 0; }

/* ===== privacy warning: shown only if the content check finds possible personal information ===== */
.privacy-banner { position: sticky; top: 0; z-index: 50; width: 100%; padding: 10px 16px; margin: -28px -24px 14px; background: #4a1218; color: #ffd9d9; border-bottom: 1px solid #a33; font-size: 14px; text-align: center; }

/* ===== v0.6: maintainer editor (only appears with START.html#edit) ===== */
body.edit-mode { padding-top: 42px; }
#editBar { position: fixed; top: 0; left: 0; right: 0; z-index: 90; height: 42px; display: flex; align-items: center; gap: 10px; padding: 0 14px; background: #3a2c0a; border-bottom: 1px solid #8a6a1c; color: #ffe9b0; font-size: 13.5px; }
#editBar .eb-tag { letter-spacing: .14em; font-size: 11.5px; padding: 2px 8px; border: 1px solid #b8912a; border-radius: 4px; color: #ffd37a; }
.eb-spacer { flex: 1; }
.eb-btn { background: rgba(255, 255, 255, .06); border: 1px solid #8a6a1c; color: inherit; border-radius: 6px; padding: 4px 11px; font-size: 13px; }
.eb-btn:hover:not(:disabled) { border-color: #ffd37a; background: rgba(255, 211, 122, .14); }
.eb-btn.primary { background: #b8912a; color: #1d1500; border-color: #b8912a; font-weight: 600; }
.eb-btn.danger { border-color: #a33; color: #ffb4b4; }
.eb-btn:disabled { opacity: .45; cursor: not-allowed; }
.eb-status.dirty { color: #ffd37a; } .eb-status.clean { color: #9fe0b0; } .eb-status.bad { color: #ffb4b4; }
.eb-check.ok { color: #9fe0b0; } .eb-check.warn { color: #ffd37a; } .eb-check.bad { color: #ffb4b4; font-weight: 600; }
.ef-toolbar { display: flex; gap: 8px; margin: 0 0 14px; }
.ef-form { display: block; }
.ef-id { margin: 0 0 10px; font-size: 12.5px; color: var(--muted); }
.ef-warn { margin: 0 0 12px; padding: 8px 10px; border: 1px solid #a33; border-radius: 6px; background: #3a1216; color: #ffd9d9; font-size: 13.5px; }
.ef-group { border: 1px solid var(--line); border-radius: 8px; margin: 0 0 10px; padding: 0 12px 6px; background: rgba(8, 12, 20, .45); }
.ef-group > summary { cursor: pointer; padding: 9px 0; font-size: 11.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.ef { display: block; margin: 0 0 11px; }
.ef-l { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 3px; }
.ef-h { display: block; font-size: 11.5px; color: #7d8aa1; margin-top: 3px; }
.ef input[type="text"], .ef input[type="date"], .ef select, .ef textarea, .ed-inner input[type="text"], .ed-inner select, .ed-inner textarea {
  width: 100%; font: inherit; font-size: 14px; color: var(--text); background: rgba(8, 12, 20, .9); border: 1px solid var(--line-2); border-radius: 6px; padding: 7px 9px; }
.ef textarea, .ed-inner textarea { resize: vertical; line-height: 1.45; }
.ef input:focus, .ef select:focus, .ef textarea:focus, .ed-inner input:focus, .ed-inner select:focus, .ed-inner textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(141, 182, 255, .2); }
.ef-checks { display: grid; gap: 4px; }
.ef-check { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.ef-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 4px 0 8px; }
.ef-links { list-style: none; margin: 0 0 6px; padding: 0; }
.ef-link { display: flex; justify-content: space-between; gap: 8px; align-items: center; padding: 5px 0; border-bottom: 1px dashed var(--line); font-size: 13.5px; }
.ef-link-btns { display: flex; gap: 6px; flex: none; }
.ef-danger { margin: 16px 0 6px; padding-top: 12px; border-top: 1px solid var(--line); }
dialog.ed-dialog { width: min(560px, calc(100% - 32px)); }
.ed-inner { padding: 20px 24px 22px; max-height: 85vh; overflow: auto; }
.ed-inner h2 { margin: 0 0 14px; font-weight: 600; }
.ed-help p { margin: 0 0 10px; color: #cfd8ea; }

/* ===== v0.7: exact locations, migration status, coverage ===== */
.node .sysring.ring-dash { stroke-dasharray: 4 3; stroke-width: 1.5; }
.loc-block { border-color: var(--line-2); background: rgba(14, 22, 38, .6); }
.loc-banner { margin: 0 0 10px; padding: 8px 10px; border-radius: 6px; font-size: 13.5px; border: 1px solid var(--line-2); }
.loc-banner.migrated { border-color: #7a5cc4; background: rgba(122, 92, 196, .12); color: #ddd0ff; }
.loc-banner.historical { border-color: #8a6a1c; background: rgba(184, 145, 42, .1); color: #ffe3a3; }
.loc-h { font-size: 11.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: 0 0 3px; }
.loc-cur { margin: 0 0 12px; }
.loc-path { display: block; font-size: 14px; color: var(--text); word-break: break-word; }
.loc-path.big { font-size: 15.5px; font-weight: 600; margin-bottom: 4px; }
.loc-path.dim { font-weight: 400; color: var(--muted); font-style: italic; }
.loc-note { display: block; font-size: 13px; color: var(--muted); margin-top: 2px; }
.loc-chip { display: inline-block; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; border: 1px solid var(--line-2); border-radius: 999px; padding: 1px 9px; margin: 2px 0; }
.loc-chip.mig-current { border-color: var(--c-action); color: var(--c-action); }
.loc-chip.mig-migrated { border-color: #9b7be0; color: #cdbcff; }
.loc-chip.mig-historical, .loc-chip.mig-archive { border-color: #b8912a; color: #ffd37a; }
.loc-chip.mig-external { border-color: var(--e-consider); color: var(--e-consider); }
.loc-sub { margin: 0 0 10px; }
.loc-item { margin: 0 0 6px; padding-left: 10px; border-left: 2px solid var(--line-2); }
.loc-dl { margin: 6px 0; display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; }
.loc-dl dt { color: var(--muted); font-size: 13px; } .loc-dl dd { margin: 0; font-size: 14px; }
.loc-sys { margin-top: 8px; }
.about-coverage { list-style: none; padding: 0; margin: 0; }
.about-coverage li { margin: 3px 0; font-size: 14px; }
.cov-s { display: inline-block; min-width: 108px; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; border-radius: 4px; padding: 1px 7px; margin-right: 6px; border: 1px solid var(--line-2); color: var(--muted); }
.cov-s.cov-mapped { border-color: var(--c-action); color: var(--c-action); } .cov-s.cov-partly-mapped, .cov-s.cov-ongoing { border-color: #b8912a; color: #ffd37a; }
.about-note { margin: 6px 0 0; font-size: 12.5px; color: var(--muted); }

/* ===== v0.8: record lifecycle, process/quality guidance, evidence, guided thinking aid ===== */
.lc-block { border-color: #3d4f7a; background: rgba(16, 26, 46, .7); }
.lc-via { margin: 0 0 10px; font-size: 13.5px; color: var(--muted); }
.lc-card { border: 1px solid var(--line-2); border-left: 3px solid var(--accent); border-radius: 8px; padding: 9px 12px; background: rgba(8, 12, 20, .55); }
.lc-card.st-create { border-left-color: var(--c-action); } .lc-card.st-review, .lc-card.st-approve { border-left-color: #c692e6; } .lc-card.st-final-storage { border-left-color: #7a5cc4; } .lc-card.st-support, .lc-card.st-index { border-left-color: var(--e-consider); }
.lc-top { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 4px; }
.lc-stage { font-size: 11.5px; letter-spacing: .16em; text-transform: uppercase; font-weight: 700; color: var(--text); }
.lc-plain { font-size: 12px; color: var(--muted); font-style: italic; }
.lc-loc { font-size: 14px; font-weight: 600; margin: 2px 0; }
.lc-act { font-size: 14px; } .lc-act b { font-weight: 600; }
.lc-note { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.lc-arrow { text-align: center; color: var(--muted); font-size: 18px; line-height: 1.1; margin: 2px 0; }
.lc-qa { margin: 12px 0 2px; display: grid; grid-template-columns: max-content 1fr; gap: 5px 14px; }
.lc-qa dt { color: var(--muted); font-size: 13px; } .lc-qa dd { margin: 0; font-size: 14px; }
.es-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; border: 1px solid var(--line-2); border-radius: 999px; padding: 1px 8px 1px 5px; color: var(--muted); }
.es-chip b { font-weight: 700; width: 14px; text-align: center; }
.es-chip.es-verified-by-current-practice, .es-chip.es-current { border-color: var(--c-action); color: var(--c-action); }
.es-chip.es-current-looking { border-color: var(--accent); color: var(--accent); }
.es-chip.es-needs-verification, .es-chip.es-unknown { border-color: var(--e-conditional); color: var(--e-conditional); }
.es-chip.es-historical, .es-chip.es-superseded { border-color: #b8912a; color: #ffd37a; }
.gd-h { margin: 10px 0 4px; font-size: 11.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.gd-note { margin: 0 0 6px; font-size: 12.5px; color: var(--muted); }
.guide ul { margin: 0 0 6px; padding-left: 20px; } .guide li { margin: 4px 0; }
.basis { display: inline-block; font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; border: 1px solid var(--line-2); border-radius: 4px; padding: 0 6px; margin-left: 4px; white-space: nowrap; vertical-align: 1px; }
.basis.b-req { border-color: var(--c-action); color: var(--c-action); } .basis.b-lead { border-color: var(--accent); color: var(--accent); } .basis.b-prac { color: var(--muted); } .basis.b-nv { border-color: var(--e-conditional); color: var(--e-conditional); }
.gd-ex { margin: 4px 0 8px; padding: 8px 10px; border-left: 3px solid var(--c-document); background: rgba(122, 167, 238, .07); border-radius: 0 6px 6px 0; font-size: 14px; }
details.evid { margin: 0 0 18px; border: 1px solid var(--line); border-radius: 8px; padding: 0 12px 8px; }
details.evid > summary { cursor: pointer; padding: 9px 0; font-size: 11.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.ev-list { list-style: none; margin: 0; padding: 0; }
.ev-item { padding: 8px 0; border-top: 1px dashed var(--line); }
.ev-top { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ev-est { font-weight: 600; font-size: 13.5px; }
.ev-src { font-size: 12.5px; color: var(--muted); margin-top: 2px; } .ev-note { font-size: 13.5px; margin-top: 3px; } .ev-where { font-size: 12px; color: #7d8aa1; margin-top: 2px; word-break: break-word; }
.ev-item.es-needs-verification, .ev-item.es-superseded { border-left: 3px solid var(--e-conditional); padding-left: 9px; }
dialog.guided { width: min(620px, calc(100% - 32px)); }
.gd-intro { color: var(--muted); font-size: 14px; margin: 0 0 12px; }
.gd-prog { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.gd-bar { height: 5px; border-radius: 3px; background: var(--line); overflow: hidden; margin-bottom: 14px; } .gd-bar div { height: 100%; background: var(--accent); }
.gd-step { margin: 0 0 6px; font-size: 21px; font-weight: 600; } .gd-prompt { font-size: 16.5px; margin: 0 0 14px; }
.gd-lead { margin: 0 0 10px; } .gd-grp { margin: 0 0 12px; } .gd-grp ul { list-style: none; padding: 0; margin: 6px 0 0; } .gd-grp li { margin: 0 0 6px; }
.gd-disc { margin: 14px 0 6px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); }
.gd-foot { justify-content: flex-end; margin-top: 8px; }
.btn.primary { background: var(--accent); color: #07101f; border-color: var(--accent); font-weight: 600; }

details.more { margin: 6px 0 18px; border-top: 1px solid var(--line); padding-top: 10px; }
details.more > summary { cursor: pointer; color: var(--muted); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; margin-bottom: 10px; }
details.more[open] > summary { margin-bottom: 14px; }
.more-tools { margin: 0 0 16px; }

.jdg-box { border: 1px solid var(--accent); border-left-width: 4px; border-radius: 8px; padding: 12px 14px; background: rgba(8, 12, 20, .55); margin: 0 0 18px; }
.jdg-box h3 { margin: 0 0 4px; font-size: 11.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }
.jdg-box .jdg-lead { margin: 0 0 8px; color: var(--muted); font-size: 14px; }
.jdg-box ul { margin: 4px 0 8px; padding-left: 20px; }
.jdgmark circle { fill: var(--bg, #0a0f1a); stroke: var(--accent); stroke-width: 1.5; }
.jdgmark path { fill: none; stroke: var(--accent); stroke-width: 1.3; stroke-linejoin: round; stroke-linecap: round; pointer-events: none; }
.pg-note { margin-top: 6px; font-size: 12.5px; color: var(--muted); }
