/* Legal Dependency Explorer
   A reference tool, so it reads like a document: paper background, serif headings,
   and a citation reference (section and paragraph) next to every statement. */

:root {
  --paper: #faf8f4;
  --surface: #ffffff;
  --sunk: #f2efe8;
  --ink: #12203a;
  --muted: #55627a;
  --rule: #d9d6cd;
  --navy: #002855;
  --navy-deep: #001a3a;
  --blue: #005fa8;
  --blue-soft: #e6f0f9;
  --amber-ink: #6b4500;
  --amber-bg: #fdf3d3;
  --amber-rule: #e4b53a;
  --yes: #17603b;
  --yes-bg: #e3f2e8;
  --no: #8a2a2a;
  --no-bg: #f8e6e4;
  --open-bg: #ecebe6;
  --focus: #c2410c;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --k1: #005fa8; --k2: #a03d1b; --k3: #1d6b52; --k4: #6a3d9a; --k5: #8a6a00; --k6: #456070;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0d1522; --surface: #141f31; --sunk: #0a111c; --ink: #e7ebf2; --muted: #9eabbf;
    --rule: #2b3a52; --navy: #0a1424; --navy-deep: #060d18; --blue: #6db4ff; --blue-soft: #16304d;
    --amber-ink: #f3d68a; --amber-bg: #2e2610; --amber-rule: #8a6a10;
    --yes: #7fd3a2; --yes-bg: #133324; --no: #f0a39b; --no-bg: #3a1b1a; --open-bg: #1d2a3f; --focus: #ffb37a;
    --k1: #6db4ff; --k2: #f09a75; --k3: #74cba9; --k4: #c0a0ee; --k5: #e0c060; --k6: #a8bccb;
  }
}
:root[data-theme="dark"] {
  --paper: #0d1522; --surface: #141f31; --sunk: #0a111c; --ink: #e7ebf2; --muted: #9eabbf;
  --rule: #2b3a52; --navy: #0a1424; --navy-deep: #060d18; --blue: #6db4ff; --blue-soft: #16304d;
  --amber-ink: #f3d68a; --amber-bg: #2e2610; --amber-rule: #8a6a10;
  --yes: #7fd3a2; --yes-bg: #133324; --no: #f0a39b; --no-bg: #3a1b1a; --open-bg: #1d2a3f; --focus: #ffb37a;
  --k1: #6db4ff; --k2: #f09a75; --k3: #74cba9; --k4: #c0a0ee; --k5: #e0c060; --k6: #a8bccb;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 16px/1.55 var(--sans); min-height: 100vh; display: flex; flex-direction: column;
}
.wrap { width: 100%; max-width: 78rem; margin: 0 auto; padding: 0 1.25rem; }
a { color: var(--blue); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; background: var(--surface); color: var(--ink); padding: .5rem 1rem; z-index: 100; }
.skip:focus { left: .5rem; top: .5rem; }
[hidden] { display: none !important; }

h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.2; margin: 0; text-wrap: balance; }
h1 { font-size: clamp(1.7rem, 2.4vw + 1rem, 2.4rem); letter-spacing: -.01em; }
h2 { font-size: 1.35rem; margin-top: 2.4rem; padding-bottom: .35rem; border-bottom: 1px solid var(--rule); }
h3 { font-size: 1.08rem; }
p { margin: .6rem 0; max-width: 72ch; }
.lede { font-family: var(--serif); font-size: 1.18rem; line-height: 1.5; max-width: 66ch; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
code, .mono { font-family: var(--mono); font-size: .86em; }
ul, ol { padding-left: 1.2rem; }
li { margin: .25rem 0; }

/* --- header ------------------------------------------------------------ */
.topbar { background: var(--navy-deep); color: #fff; font-size: .72rem; letter-spacing: .09em; text-transform: uppercase; font-weight: 600; }
.topbar .wrap { display: flex; justify-content: space-between; gap: 1rem; padding-top: .45rem; padding-bottom: .45rem; }
.topbar a { color: rgba(255,255,255,.85); text-decoration: none; }
.topbar a:hover { color: #fff; text-decoration: underline; }
.topbar span { color: rgba(255,255,255,.55); }

.masthead { background: var(--surface); border-bottom: 1px solid var(--rule); }
.masthead > .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem 2rem; flex-wrap: wrap; padding-top: .9rem; padding-bottom: .8rem; }
.brand { display: flex; align-items: center; gap: 1rem; color: inherit; text-decoration: none; min-width: 0; }
.brand img { height: 2.25rem; width: auto; flex: none; }
:root[data-theme="dark"] .brand img { filter: brightness(0) invert(1); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .brand img { filter: brightness(0) invert(1); } }
.brand-text { display: flex; flex-direction: column; min-width: 0; border-left: 1px solid var(--rule); padding-left: 1rem; }
.brand-name { font-family: var(--serif); font-size: 1.3rem; font-weight: 600; color: var(--ink); line-height: 1.15; }
.brand-sub { font-size: .8rem; color: var(--muted); }
.tools { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.search { position: relative; }
.search input { width: 17rem; max-width: 100%; font: inherit; font-size: .9rem; padding: .45rem .7rem; border: 1px solid var(--rule); border-radius: 4px; background: var(--paper); color: var(--ink); }
.search-results { position: absolute; z-index: 40; right: 0; top: calc(100% + 4px); width: min(34rem, 92vw); max-height: 60vh; overflow: auto; margin: 0; padding: .25rem; list-style: none; background: var(--surface); border: 1px solid var(--rule); border-radius: 6px; box-shadow: 0 12px 30px rgba(0,0,0,.18); }
.search-results li { margin: 0; }
.search-results a { display: block; padding: .45rem .6rem; border-radius: 4px; color: var(--ink); text-decoration: none; font-size: .9rem; }
.search-results a:hover, .search-results a[aria-selected="true"] { background: var(--blue-soft); }
.search-results .kind { font-family: var(--mono); font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); display: block; }
.search-results .none { padding: .5rem .6rem; color: var(--muted); font-size: .9rem; }

button { font: inherit; cursor: pointer; }
.ghost, .seg button, .btn { border: 1px solid var(--rule); background: var(--surface); color: var(--ink); border-radius: 4px; padding: .4rem .7rem; font-size: .85rem; }
.ghost:hover, .seg button:hover, .btn:hover { border-color: var(--blue); }
.seg { display: inline-flex; }
.seg button { border-radius: 0; margin-left: -1px; }
.seg button:last-child { border-radius: 0 4px 4px 0; }
.seg button[aria-pressed="true"] { background: var(--navy); color: #fff; border-color: var(--navy); }
:root[data-theme="dark"] .seg button[aria-pressed="true"] { background: var(--blue); color: #06101e; border-color: var(--blue); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .seg button[aria-pressed="true"] { background: var(--blue); color: #06101e; border-color: var(--blue); } }
.btn.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
:root[data-theme="dark"] .btn.primary { background: var(--blue); border-color: var(--blue); color: #06101e; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn.primary { background: var(--blue); border-color: var(--blue); color: #06101e; } }

.tabs { border-top: 1px solid var(--rule); background: var(--surface); }
.tabs .wrap { display: flex; gap: .25rem; overflow-x: auto; scrollbar-width: thin; }
.tabs a { flex: none; padding: .7rem .8rem; color: var(--muted); text-decoration: none; font-size: .92rem; font-weight: 500; border-bottom: 3px solid transparent; }
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--blue); font-weight: 600; }

.notice { background: var(--amber-bg); color: var(--amber-ink); border-bottom: 1px solid var(--amber-rule); font-size: .85rem; }
.notice .wrap { padding-top: .5rem; padding-bottom: .5rem; }

main.wrap { flex: 1; padding-top: 2.2rem; padding-bottom: 4.5rem; outline: none; }
main:focus, main:focus-visible { outline: none; }
.loading { color: var(--muted); }
.error { border: 1px solid var(--no); background: var(--no-bg); padding: 1rem; border-radius: 6px; }

.foot { border-top: 1px solid var(--rule); background: var(--surface); color: var(--muted); font-size: .82rem; }
.foot .wrap { padding-top: 1.1rem; padding-bottom: 1.3rem; }
.foot p { max-width: none; margin: .2rem 0; }

/* --- shared pieces ------------------------------------------------------- */
.card { background: var(--surface); border: 1px solid var(--rule); border-radius: 6px; padding: 1rem 1.1rem; }
.cards { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); margin-top: 1rem; }
.kicker { font-family: var(--mono); font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }

/* The citation reference: section and paragraph of the analysis, like a marginal note. */
.src { display: inline-flex; align-items: center; gap: .35rem; min-height: 24px; font-family: var(--mono); font-size: .74rem; letter-spacing: .01em;
  color: var(--blue); background: transparent; border: 0; border-bottom: 1px dotted currentColor; border-radius: 0; padding: 0 0 1px; white-space: nowrap; }
/* A link to another legal act. It selects the act; it is not a citation reference. */
.act-link { display: inline; font: inherit; color: var(--blue); background: transparent; border: 0; padding: 0; text-align: left; text-decoration: underline; text-underline-offset: 2px; white-space: normal; }
.act-link:hover { text-decoration-thickness: 2px; }
.src:hover { border-bottom-style: solid; }
.src .more { color: var(--muted); }

.chip { display: inline-block; max-width: 100%; font-size: .72rem; font-weight: 600; letter-spacing: .02em; padding: .1rem .5rem; border-radius: .7rem; border: 1px solid var(--rule); background: var(--sunk); color: var(--muted); white-space: normal; }
.chip.yes { background: var(--yes-bg); color: var(--yes); border-color: transparent; }
.chip.no { background: var(--no-bg); color: var(--no); border-color: transparent; }
.chip.cond { background: var(--amber-bg); color: var(--amber-ink); border-color: transparent; }
.chip.blue { background: var(--blue-soft); color: var(--blue); border-color: transparent; }
/* A finished result has a solid outline and a leading mark, so it does not look like an untouched scheme. */
.chip.final { border: 1px solid currentColor; }
.chip.final::before { content: "\2192\00a0"; }
.chip.skip { border-style: dashed; font-weight: 400; }

table { border-collapse: collapse; width: 100%; font-size: .92rem; }
th, td { text-align: left; vertical-align: top; padding: .5rem .7rem .5rem 0; border-bottom: 1px solid var(--rule); }
th { font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
td.num { font-family: var(--mono); text-align: right; white-space: nowrap; }
.table-wrap { overflow-x: auto; }
.ta-r { text-align: right; }
.mt-s { margin-top: .8rem; } .mt-m { margin-top: 1rem; } .mt-l { margin-top: 1.4rem; }
.sr-h { position: absolute; }

[lang="de"] { hyphens: auto; }

/* --- overview ------------------------------------------------------------- */
.figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); gap: 0; margin: 1.5rem 0 0; border-top: 2px solid var(--ink); border-bottom: 1px solid var(--rule); }
.figures div { display: flex; flex-direction: column-reverse; justify-content: flex-end; padding: .8rem .8rem .8rem 0; border-right: 1px solid var(--rule); margin-right: .8rem; }
.figures div:last-child { border-right: 0; }
.figures dd { margin: 0; font-family: var(--serif); font-size: 2rem; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; }
.figures dt { font-size: .82rem; color: var(--muted); line-height: 1.4; margin-top: .25rem; }
.three { list-style: none; padding: 0; margin: 1.1rem 0; display: grid; gap: .6rem; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); }
.three li { margin: 0; padding: .7rem .9rem; background: var(--surface); border: 1px solid var(--rule); border-left: 3px solid var(--blue); border-radius: 4px; font-size: .94rem; }
.flash { background: var(--amber-bg); color: var(--amber-ink); border: 1px solid var(--amber-rule); border-radius: 4px; padding: .5rem .8rem; max-width: none; margin: 0 0 1.2rem; }
a.btn { display: inline-block; text-decoration: none; }
.ways { list-style: none; padding: 0; display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); margin-top: 1rem; }
.ways li { margin: 0; }
.ways a { display: block; height: 100%; padding: .9rem 1rem; border: 1px solid var(--rule); border-radius: 6px; background: var(--surface); color: var(--ink); text-decoration: none; }
.ways a:hover { border-color: var(--blue); }
.ways strong { font-family: var(--serif); font-size: 1.05rem; display: block; color: var(--blue); }
.ways span { font-size: .9rem; color: var(--muted); }

/* --- check my product -------------------------------------------------------- */
.check { display: grid; grid-template-columns: 18rem minmax(0, 1fr); gap: 2rem; margin-top: 1.25rem; align-items: start; }
.check > nav { position: sticky; top: 1rem; align-self: start; }
.steps { list-style: none; padding: 0; margin: 0; max-height: calc(100vh - 2rem); overflow-y: auto; }
.step-nav { display: none; }
.steps button.skipped .name, .steps button.skipped .act { color: var(--muted); }
.steps button.skipped { border-left-style: dashed; }
.steps .why { font-size: .78rem; color: var(--muted); }
.scheme-h { margin-top: .2rem; }
.scheme-h:focus { outline: none; }
.scheme-h:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; }
.leads { font-size: .82rem; color: var(--muted); margin: .5rem 0 0; }
.path { font-size: .9rem; }
.path-h { font-family: var(--mono); font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.caveat { font-size: .82rem; border-top: 1px solid var(--rule); margin-top: .6rem !important; padding-top: .5rem; max-width: 60rem; }
.q-alt-label { font-family: var(--mono); font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; }
.plain-list { list-style: none; padding: 0; }
.answers button.derived { box-shadow: inset 0 0 0 2px var(--blue); }
.steps li { margin: 0; }
.steps button { width: 100%; text-align: left; background: transparent; border: 0; border-left: 3px solid var(--rule); padding: .55rem .75rem; color: var(--ink); display: flex; flex-direction: column; gap: .2rem; }
.steps button:hover { background: var(--sunk); }
.steps button[aria-current="step"] { border-left-color: var(--blue); background: var(--blue-soft); }
.steps .act { font-size: .72rem; color: var(--muted); font-family: var(--mono); text-transform: uppercase; letter-spacing: .06em; }
.steps .name { font-size: .92rem; line-height: 1.3; }
.steps .chip { align-self: flex-start; text-align: left; }
.q { border: 1px solid var(--rule); border-radius: 6px; background: var(--surface); padding: 1rem 1.1rem; margin: .8rem 0; }
.q.done { background: transparent; }
.q.active { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }
.q-head { display: flex; gap: .75rem; align-items: baseline; }
.q-n { font-family: var(--mono); font-size: .8rem; color: var(--muted); flex: none; }
.q-text { font-family: var(--serif); font-size: 1.1rem; line-height: 1.35; margin: 0; }
.q-alt { font-size: .85rem; color: var(--muted); margin: .2rem 0 0; }
.q-meta { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; margin-top: .7rem; }
.answers { display: inline-flex; flex-wrap: wrap; }
.answers button { border: 1px solid var(--rule); background: var(--surface); color: var(--ink); padding: .35rem .8rem; font-size: .88rem; margin-left: -1px; }
.answers button:first-child { border-radius: 4px 0 0 4px; margin-left: 0; }
.answers button:last-child { border-radius: 0 4px 4px 0; }
.answers button[aria-pressed="true"] { background: var(--navy); border-color: var(--navy); color: #fff; position: relative; }
:root[data-theme="dark"] .answers button[aria-pressed="true"] { background: var(--blue); border-color: var(--blue); color: #06101e; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .answers button[aria-pressed="true"] { background: var(--blue); border-color: var(--blue); color: #06101e; } }
.subs { list-style: none; margin: .8rem 0 0; padding: .2rem 0 0 0; border-top: 1px dashed var(--rule); }
.subs > li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .5rem 1rem; align-items: center; padding: .5rem 0; border-bottom: 1px dashed var(--rule); margin: 0; }
.subs > li:last-child { border-bottom: 0; }
.subs .answers button { padding: .22rem .6rem; font-size: .8rem; }
.sub-text { font-size: .93rem; }
.rule-note { font-size: .82rem; color: var(--muted); margin: .6rem 0 0; }
.ed-note { font-size: .85rem; color: var(--ink); background: var(--amber-bg); border-left: 3px solid var(--amber-ink); border-radius: 3px; padding: .45rem .7rem; margin: .5rem 0 0; max-width: 46rem; }
.q-prov { margin: .3rem 0 0; }
.leaf.permission .mark { color: var(--yes); font-weight: 700; }
.outcome { border-left: 4px solid var(--muted); background: var(--open-bg); padding: .9rem 1.1rem; border-radius: 0 6px 6px 0; margin: 1rem 0; }
.outcome.yes { border-left-color: var(--yes); background: var(--yes-bg); }
.outcome.no { border-left-color: var(--no); background: var(--no-bg); }
.outcome.cond { border-left-color: var(--amber-rule); background: var(--amber-bg); }
.outcome.blue { border-left-color: var(--blue); background: var(--blue-soft); }
.outcome.plain { border-left-color: var(--rule); background: var(--sunk); }
.outcome p { margin: .3rem 0; }
.outcome h3 { margin-bottom: .2rem; }
.duty-list { list-style: none; padding: 0; margin: .5rem 0 0; }
.duty-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .2rem 1rem; padding: .55rem 0; border-bottom: 1px solid var(--rule); margin: 0; align-items: baseline; }
.duty-list .tags { display: flex; gap: .35rem; flex-wrap: wrap; margin-top: .2rem; grid-column: 1; }
.toolbar { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; margin-top: 1rem; }

/* --- duty tree ------------------------------------------------------------- */
.filters { display: flex; flex-wrap: wrap; gap: .8rem 1.2rem; align-items: end; margin: 1.1rem 0 .5rem; padding: .8rem 1rem; background: var(--surface); border: 1px solid var(--rule); border-radius: 6px; }
.filters label { display: flex; flex-direction: column; font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; gap: .25rem; }
.filters select { font: inherit; font-size: .9rem; text-transform: none; letter-spacing: 0; font-weight: 400; padding: .35rem .5rem; border: 1px solid var(--rule); border-radius: 4px; background: var(--paper); color: var(--ink); max-width: 16rem; }
.filters .checks { display: flex; gap: 1rem; flex-wrap: wrap; }
.filters .checks label { flex-direction: row; align-items: center; text-transform: none; letter-spacing: 0; font-size: .9rem; font-weight: 400; color: var(--ink); gap: .4rem; }
.count { font-size: .88rem; color: var(--muted); margin-left: auto; }
.split { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 2rem; align-items: start; margin-top: 1rem; }
.tree details { border-left: 1px solid var(--rule); margin-left: .35rem; padding-left: .9rem; }
.tree > details { border-left: 0; margin-left: 0; padding-left: 0; margin-top: .6rem; }
.tree summary { cursor: pointer; padding: .3rem .2rem; min-height: 24px; list-style-position: outside; margin-left: 1rem; }
.tree summary:hover { color: var(--blue); }
.tree .lvl-cluster > summary { font-family: var(--serif); font-size: 1.15rem; font-weight: 600; border-bottom: 1px solid var(--rule); }
.tree .lvl-act > summary { font-weight: 600; }
.tree .lvl-role > summary { font-weight: 500; }
.tree .lvl-kind > summary { color: var(--muted); font-size: .92rem; }
.tree summary .n { font-family: var(--mono); font-size: .74rem; color: var(--muted); margin-left: .4rem; font-weight: 400; }
.tree ul { list-style: none; margin: .1rem 0 .5rem; padding: 0 0 0 1rem; }
.tree li { margin: 0; }
.leaf { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .5rem; width: 100%; text-align: left; background: transparent; border: 0; border-radius: 4px; padding: .38rem .5rem; color: var(--ink); font-size: .93rem; line-height: 1.4; }
.leaf:hover { background: var(--sunk); }
.leaf[aria-pressed="true"] { background: var(--blue-soft); }
.leaf .mark { font-family: var(--mono); font-size: .7rem; color: var(--muted); padding-top: .15rem; width: 1.1rem; }
.leaf.prohibition .mark { color: var(--no); font-weight: 700; }
.detail { position: sticky; top: 1rem; background: var(--surface); border: 1px solid var(--rule); border-radius: 6px; padding: 1.1rem 1.2rem; max-height: calc(100vh - 2rem); overflow: auto; }
.detail h3 { font-size: 1.2rem; line-height: 1.35; margin: .3rem 0 .4rem; }
.detail dl { display: grid; grid-template-columns: 8.2rem minmax(0, 1fr); gap: .45rem .8rem; margin: 1rem 0 0; font-size: .92rem; }
.detail dt { color: var(--muted); font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; padding-top: .15rem; }
.detail dd { margin: 0; }
.detail .srcs { display: flex; flex-wrap: wrap; gap: .3rem .9rem; }
.empty { color: var(--muted); padding: 1rem 0; }

/* --- dependency map --------------------------------------------------------- */
.map-wrap { display: grid; grid-template-columns: minmax(0, 1.9fr) minmax(18rem, 1fr); gap: 1.5rem; align-items: start; margin-top: 1rem; }
.map-svg { width: 100%; height: auto; background: var(--surface); border: 1px solid var(--rule); border-radius: 6px; }
.map-svg text { font-family: var(--sans); fill: var(--ink); }
.map-svg .lbl { font-size: 13px; }
.map-svg .lbl.minor { fill: var(--muted); font-size: 12px; }
.map-svg .cluster-lbl { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; fill: var(--muted); font-weight: 600; paint-order: stroke; stroke: var(--surface); stroke-width: 6px; stroke-linejoin: round; pointer-events: none; }
.map-svg .arc { fill: none; stroke: var(--rule); stroke-width: 4; }
.map-svg .edge { fill: none; stroke-width: 2.2; opacity: .85; }
.map-svg .edge.hit-area { stroke: transparent; stroke-width: 14; opacity: 1; cursor: pointer; }
.map-svg .edge.k1 { stroke: var(--k1); } .map-svg .edge.k2 { stroke: var(--k2); } .map-svg .edge.k3 { stroke: var(--k3); }
.map-svg .edge.k4 { stroke: var(--k4); } .map-svg .edge.k5 { stroke: var(--k5); } .map-svg .edge.k6 { stroke: var(--k6); }
.map-readout { font-size: .88rem; min-height: 1.4rem; margin: .4rem 0; color: var(--muted); }
.map-svg .link { fill: none; stroke: var(--muted); stroke-width: 1.2; stroke-dasharray: 4 4; opacity: .8; }
.map-svg .node circle { fill: var(--surface); stroke: var(--muted); stroke-width: 1.5; }
.map-svg .node.major circle { fill: var(--ink); stroke: var(--ink); }
.map-svg .node { cursor: pointer; }
.map-svg .node:hover circle, .map-svg .node.sel circle { stroke: var(--focus); stroke-width: 3; }
.map-svg .node.dim, .map-svg .edge.dim, .map-svg .link.dim { opacity: .18; }
.map-svg .centre circle { fill: var(--navy); stroke: var(--navy); }
:root[data-theme="dark"] .map-svg .centre circle { fill: var(--blue); stroke: var(--blue); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .map-svg .centre circle { fill: var(--blue); stroke: var(--blue); } }
.map-svg .centre text { fill: #fff; font-family: var(--serif); font-size: 22px; font-weight: 600; }
:root[data-theme="dark"] .map-svg .centre text { fill: #06101e; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .map-svg .centre text { fill: #06101e; } }
.legend { display: flex; flex-wrap: wrap; gap: .35rem .5rem; margin: .8rem 0 0; padding: 0; list-style: none; }
.legend li { margin: 0; }
.legend button { display: inline-flex; align-items: center; gap: .4rem; border: 1px solid var(--rule); background: var(--surface); color: var(--ink); border-radius: 999px; padding: .2rem .6rem; font-size: .8rem; }
.legend button[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.legend i { width: 1.4rem; height: 0; border-top: 3px solid; display: inline-block; }
.legend i.k1 { border-color: var(--k1); } .legend i.k2 { border-color: var(--k2); } .legend i.k3 { border-color: var(--k3); }
.legend i.k4 { border-color: var(--k4); } .legend i.k5 { border-color: var(--k5); } .legend i.k6 { border-color: var(--k6); }
.legend i.dash { border-top-style: dashed; } .legend i.dot { border-top-style: dotted; }
.act-list { list-style: none; padding: 0; margin: .5rem 0 0; }
.act-list li { margin: 0; border-bottom: 1px solid var(--rule); }
.act-list button { width: 100%; text-align: left; background: transparent; border: 0; padding: .55rem .2rem; color: var(--ink); display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .2rem 1rem; }
.act-list button:hover { background: var(--sunk); }
.act-list .nm { font-weight: 600; }
.act-list .ds { grid-column: 1 / -1; font-size: .88rem; color: var(--muted); }

/* --- product passport -------------------------------------------------------- */
.lettered { list-style: none; padding: 0; margin: .6rem 0 0; }
.lettered > li { display: grid; grid-template-columns: 2rem minmax(0, 1fr) auto; gap: .2rem .8rem; padding: .6rem 0; border-bottom: 1px solid var(--rule); margin: 0; align-items: baseline; }
.lettered .letter { font-family: var(--serif); font-size: 1.15rem; font-weight: 600; color: var(--blue); }
.lettered details { grid-column: 2 / -1; font-size: .9rem; }
.lettered details summary { cursor: pointer; color: var(--muted); }
.lettered details ul { margin: .3rem 0 0; }
.tiers { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 0; border: 1px solid var(--rule); border-radius: 6px; overflow: hidden; margin-top: 1rem; background: var(--surface); }
.tiers > div { padding: 1rem 1.1rem; border-right: 1px solid var(--rule); }
.tiers > div:last-child { border-right: 0; }
.tiers .lvl { font-family: var(--mono); font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.flow { list-style: none; padding: 0; margin: .8rem 0 0; counter-reset: flow; }
.flow > li { counter-increment: flow; position: relative; padding: .2rem 0 1rem 2.6rem; margin: 0; border-left: 1px solid var(--rule); margin-left: .9rem; }
.flow > li::before { content: counter(flow); position: absolute; left: -.95rem; top: 0; width: 1.9rem; height: 1.9rem; border-radius: 50%; background: var(--surface); border: 1px solid var(--rule); display: grid; place-items: center; font-family: var(--mono); font-size: .8rem; }
.flow .branch { font-size: .9rem; color: var(--muted); margin: .25rem 0 0; }
.watch-list { list-style: none; padding: 0; margin: 0; }
.watch-item { margin: 0; display: grid; grid-template-columns: 9rem minmax(0, 1fr) auto; gap: .2rem 1rem; padding: .7rem 0; border-bottom: 1px solid var(--rule); align-items: baseline; }
.watch-item .date { font-family: var(--mono); font-size: .85rem; }
.watch-item .past { color: var(--muted); }

/* --- source drawer --------------------------------------------------------- */
.scrim { position: fixed; inset: 0; background: rgba(8, 14, 26, .45); z-index: 60; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(34rem, 100vw); background: var(--surface); border-left: 1px solid var(--rule); z-index: 70; display: flex; flex-direction: column; box-shadow: -16px 0 40px rgba(0,0,0,.2); }
.drawer-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 1rem 1.2rem; border-bottom: 1px solid var(--rule); }
.drawer-head h2 { margin: 0; border: 0; padding: 0; font-size: 1.2rem; }
.drawer-body { padding: 1rem 1.2rem 2rem; overflow: auto; }
.passage { padding: .9rem 0; border-bottom: 1px solid var(--rule); }
.passage .ref { font-family: var(--mono); font-size: .8rem; color: var(--ink); font-weight: 600; margin: 0; }
.passage .rests-h { font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; margin: .8rem 0 .2rem; }
.passage .rests { list-style: none; padding: 0; margin: 0; font-size: .9rem; }
.passage .rests li { margin: .25rem 0; }
.passage .rests .kind { font-family: var(--mono); font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.no-scroll { overflow: hidden; }
.hit { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 3px; }
.seg { align-items: center; }
.seg-label { font-size: .78rem; color: var(--muted); margin-right: .4rem; white-space: nowrap; }
.seg .seg-label + button { border-radius: 4px 0 0 4px; margin-left: 0; }
.lettered details summary { min-height: 24px; }
.detail details summary { min-height: 24px; cursor: pointer; }
.passage .ttl { font-size: .88rem; color: var(--muted); margin: .1rem 0 0; }
.passage blockquote { margin: .6rem 0 0; padding: 0 0 0 .9rem; border-left: 3px solid var(--rule); font-family: var(--serif); font-size: 1rem; line-height: 1.55; }
.passage .cites { margin: .5rem 0 0; padding: 0; list-style: none; font-size: .84rem; color: var(--muted); }
.passage .cites li::before { content: "cites "; font-family: var(--mono); font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; }

/* --- small screens --------------------------------------------------------- */
@media (max-width: 62rem) {
  .check, .split, .map-wrap { grid-template-columns: minmax(0, 1fr); }
  .check > nav, .detail { position: static; max-height: none; }
  .steps { display: none; }
  .step-nav { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; padding-bottom: .8rem; border-bottom: 1px solid var(--rule); }
  .step-nav select { flex: 1 1 12rem; min-width: 0; font: inherit; font-size: .9rem; padding: .4rem .5rem; border: 1px solid var(--rule); border-radius: 4px; background: var(--paper); color: var(--ink); }
  .step-nav .btn { min-width: 2.4rem; min-height: 2.4rem; font-size: 1.1rem; }
  .step-nav .btn[disabled] { opacity: .45; cursor: default; }
  .tabs .wrap { flex-wrap: wrap; overflow-x: visible; }
  .tree li > .detail { margin: .4rem 0 .8rem; }
}
@media (max-width: 44rem) {
  .map-svg { display: none; }
  .brand-sub { display: none; }
  .brand img { height: 1.8rem; }
  .brand-name { font-size: 1.1rem; }
  .tools { width: 100%; }
  .search { flex: 1; }
  .search input { width: 100%; }
  .search-results { left: 0; right: auto; }
  .subs > li, .duty-list li, .watch-item, .lettered > li { grid-template-columns: minmax(0, 1fr); }
  .lettered > li { grid-template-columns: 1.6rem minmax(0, 1fr); }
  .lettered > li > .src, .lettered details { grid-column: 2; }
  .detail dl { grid-template-columns: minmax(0, 1fr); gap: .1rem; }
  .detail dd { margin-bottom: .5rem; }
  .figures div { border-right: 0; }
  .tiers > div { border-right: 0; border-bottom: 1px solid var(--rule); }
}
@media (prefers-reduced-motion: no-preference) {
  .drawer { animation: slide .18s ease-out; }
  @keyframes slide { from { transform: translateX(1.5rem); opacity: 0; } to { transform: none; opacity: 1; } }
}
@media print {
  .topbar, .tabs, .tools, .drawer, .scrim, .skip { display: none !important; }
  body { background: #fff; }
}

@media (max-width: 44rem) {
  .table-wrap table { min-width: 38rem; }
  .detail .table-wrap table, .detail table { min-width: 0; }
  .seg-label { display: none; }
}
/* Windows high-contrast mode: a pressed answer must stay distinguishable. */
@media (forced-colors: active) {
  [aria-pressed="true"] { background: Highlight; color: HighlightText; forced-color-adjust: none; }
  .answers button.derived { outline: 2px dashed Highlight; }
  .chip.final { border: 2px solid CanvasText; }
}
