/* KADGIS user guide — the same register world as the apps (web/common/theme.css), set for reading:
   a navy rail with the seal, white ruled sheets on register paper, amber only for screenshot pointers. */

body { font-size: 15px; line-height: 1.62; }
.skip { position: absolute; left: -9999px; top: 8px; z-index: 50; background: var(--navy); color: #fff; padding: 8px 14px; border-radius: var(--radius); }
.skip:focus { left: 8px; }

/* ---------------------------------------------------------------- shell */
.shell { display: grid; grid-template-columns: 268px minmax(0, 1fr); min-height: 100vh; }
.rail {
  background: var(--navy); color: var(--navy-100); position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; overflow-y: auto;
}
.rail .brand { display: flex; gap: 11px; align-items: center; padding: 18px 18px 14px; color: #fff; text-decoration: none; }
.rail .brand img { width: 42px; height: 42px; }
.rail .brand b { display: block; font-size: 15px; letter-spacing: .06em; }
.rail .brand small { display: block; color: var(--navy-300); font-size: 12px; }
.rail nav { padding: 2px 0 20px 10px; }
.rail h6 { margin: 18px 8px 4px; font-size: 10.5px; letter-spacing: .14em; color: var(--navy-300); font-weight: 700; text-transform: uppercase; }
.rail nav a {
  display: flex; gap: 10px; align-items: center; padding: 6px 12px; margin-right: 0;
  color: var(--navy-100); text-decoration: none; font-size: 14px; border-radius: var(--radius) 0 0 var(--radius);
}
.rail nav a:hover { background: var(--navy-700); color: #fff; }
.rail nav a[aria-current='page'] { background: var(--ground); color: var(--navy); font-weight: 700; }
.rail nav a .tag { margin-left: auto; margin-right: 8px; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--navy-300); font-weight: 700; }
.rail nav a[aria-current='page'] .tag { color: var(--ink-3); }
.rail .foot { margin-top: auto; padding: 14px 18px 18px; font-size: 12px; color: var(--navy-300); border-top: 1px solid var(--navy-700); }
.rail .foot a { color: var(--navy-100); }

.col { min-width: 0; display: flex; flex-direction: column; }
.top {
  position: sticky; top: 0; z-index: 20; height: 56px; display: flex; gap: 14px; align-items: center; padding: 0 28px;
  background: rgba(238, 240, 246, .88); backdrop-filter: blur(8px); border-bottom: var(--hair);
}
.top .crumbs { font-size: 13px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .crumbs b { color: var(--ink); }
.top .menu { display: none; }
.top .spacer { flex: 1; }
.top .apps { display: flex; gap: 6px; }
.top .apps a { font-size: 13px; font-weight: 600; text-decoration: none; color: var(--navy-700); padding: 5px 9px; border-radius: var(--radius); }
.top .apps a:hover { background: var(--navy-50); }

/* search */
.search { position: relative; width: min(360px, 40vw); }
.search input {
  width: 100%; height: 36px; border: var(--hair); border-radius: var(--radius); background: var(--sheet);
  padding: 0 34px 0 34px; font-size: 14px;
}
.search input:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px var(--navy-100); }
.search .ico { position: absolute; left: 10px; top: 10px; width: 16px; height: 16px; color: var(--ink-3); }
.search kbd { position: absolute; right: 8px; top: 8px; }
.results {
  position: absolute; right: 0; top: 42px; width: min(560px, 92vw); max-height: 70vh; overflow-y: auto; background: var(--sheet);
  border: var(--hair); border-radius: var(--radius); box-shadow: var(--shadow-pop); padding: 6px; z-index: 30;
}
.results a { display: block; padding: 9px 12px; border-radius: var(--radius); text-decoration: none; color: var(--ink); }
.results a[aria-selected='true'], .results a:hover { background: var(--navy-50); }
.results a b { display: block; color: var(--navy); font-size: 14px; }
.results a small { display: block; color: var(--ink-3); font-size: 12px; }
.results a span { display: block; color: var(--ink-2); font-size: 13px; margin-top: 2px; }
.results mark { background: var(--amber-100); color: inherit; border-radius: 2px; }
.results .none { padding: 14px 12px; color: var(--ink-3); }

.page { display: grid; grid-template-columns: minmax(0, 860px) 220px; gap: 36px; padding: 28px 28px 64px; justify-content: center; }

/* ---------------------------------------------------------------- the document */
.doc {
  background: var(--sheet); border: var(--hair); border-radius: var(--radius); box-shadow: var(--shadow-sheet);
  padding: 40px 52px 52px; min-width: 0;
}
.doc > :first-child { margin-top: 0; }
.doc h1 { font-size: 30px; font-weight: 800; letter-spacing: -.02em; color: var(--ink); }
.doc .lede { font-size: 17px; color: var(--ink-2); margin-top: 10px; max-width: 64ch; }
.doc h2 {
  font-size: 21px; font-weight: 800; letter-spacing: -.01em; margin: 44px 0 12px; padding-top: 24px;
  border-top: 1px solid var(--rule-strong); scroll-margin-top: 72px;
}
.doc h3 { font-size: 16.5px; font-weight: 700; margin: 28px 0 8px; scroll-margin-top: 72px; }
.doc h4 { font-size: 13px; font-weight: 700; margin: 20px 0 6px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-2); }
.doc p, .doc ul, .doc ol, .doc dl, .doc table, .doc .callout, .doc figure, .doc details { margin: 0 0 14px; }
.doc p, .doc li { max-width: 72ch; }
.doc ul, .doc ol { padding-left: 22px; }
.doc li { margin: 4px 0; }
.doc li > ul, .doc li > ol { margin: 4px 0 6px; }
.doc strong, .doc b { font-weight: 700; }
.doc .anchor { margin-left: 8px; color: var(--rule); text-decoration: none; font-weight: 400; opacity: 0; }
.doc h2:hover .anchor, .doc h3:hover .anchor, .doc .anchor:focus { opacity: 1; }
.doc .anchor:hover { color: var(--navy); }
code { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: .88em; background: var(--navy-50); color: var(--navy-900); padding: 1px 5px; border-radius: 2px; }
pre { background: var(--navy-950); color: var(--navy-100); padding: 14px 16px; border-radius: var(--radius); overflow-x: auto; font-size: 13px; line-height: 1.55; }
pre code { background: none; color: inherit; padding: 0; }
kbd { font: 600 11px var(--font); border: var(--hair); border-bottom-width: 2px; border-radius: 3px; padding: 1px 5px; background: var(--sheet-2); color: var(--ink-2); }
.ui { font-weight: 700; color: var(--navy-900); }
.ui::before { content: '‹'; color: var(--ink-3); font-weight: 400; margin-right: 1px; }
.ui::after { content: '›'; color: var(--ink-3); font-weight: 400; margin-left: 1px; }

/* who can do this */
.who { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 4px 0 14px; font-size: 13px; color: var(--ink-3); }
.role, .perm {
  display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 2px; font-size: 10.5px; font-weight: 700;
  letter-spacing: .07em; text-transform: uppercase; border: 1px solid var(--info-line); background: var(--info-bg); color: var(--info); white-space: nowrap;
}
.perm { text-transform: none; letter-spacing: 0; font-family: ui-monospace, Consolas, monospace; font-weight: 600; border-color: var(--mute-line); background: var(--mute-bg); color: var(--mute); }
.stamp {
  display: inline-flex; align-items: center; height: 21px; padding: 0 7px; border-radius: 2px; font-size: 10.5px; font-weight: 700;
  letter-spacing: .07em; text-transform: uppercase; border: 1px solid var(--mute-line); background: var(--mute-bg); color: var(--mute); white-space: nowrap; vertical-align: 1px;
}
.stamp.ok { border-color: var(--ok-line); background: var(--ok-bg); color: var(--ok); }
.stamp.info { border-color: var(--info-line); background: var(--info-bg); color: var(--info); }
.stamp.warn { border-color: var(--warn-line); background: var(--warn-bg); color: var(--warn); }
.stamp.bad { border-color: var(--bad-line); background: var(--bad-bg); color: var(--bad); }

/* callouts */
.callout { border: 1px solid var(--info-line); background: var(--info-bg); border-radius: var(--radius); padding: 12px 16px; }
.callout > b:first-child { display: block; font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--info); margin-bottom: 2px; }
.callout p:last-child, .callout ul:last-child { margin-bottom: 0; }
.callout.tip { border-color: var(--ok-line); background: var(--ok-bg); }
.callout.tip > b:first-child { color: var(--ok); }
.callout.warn { border-color: var(--warn-line); background: var(--warn-bg); }
.callout.warn > b:first-child { color: var(--warn); }
.callout.bad { border-color: var(--bad-line); background: var(--bad-bg); }
.callout.bad > b:first-child { color: var(--bad); }

/* numbered procedures, numbered like minutes */
.doc ol.steps { list-style: none; padding: 0; counter-reset: step; }
ol.steps > li { counter-increment: step; position: relative; padding: 2px 0 6px 44px; margin: 0 0 6px; }
ol.steps > li::before {
  content: counter(step); position: absolute; left: 0; top: 1px; width: 28px; height: 28px; border-radius: 50%;
  border: 1.5px solid var(--navy); color: var(--navy); font-weight: 800; font-size: 13px; display: grid; place-items: center;
}
ol.steps > li:not(:last-child)::after { content: ''; position: absolute; left: 14px; top: 32px; bottom: -4px; width: 1px; background: var(--rule); }

/* tables, ruled like the register */
.doc .tbl { overflow-x: auto; border: var(--hair); border-radius: var(--radius); margin: 0 0 14px; }
.doc table { width: 100%; border-collapse: collapse; font-size: 14px; margin: 0; }
.doc th { background: var(--sheet-2); text-align: left; font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); padding: 9px 12px; border-bottom: var(--hair); }
.doc td { padding: 9px 12px; border-bottom: 1px solid var(--rule-2); vertical-align: top; }
.doc tr:last-child td { border-bottom: 0; }
.doc td.c, .doc th.c { text-align: center; }
.doc td .yes { color: var(--ok); font-weight: 800; }
.doc td .no { color: var(--rule); }
.matrix th:not(:first-child), .matrix td:not(:first-child) { text-align: center; width: 92px; }
.matrix th:not(:first-child) { font-size: 9.5px; letter-spacing: .04em; }
.matrix tr.group td { background: var(--sheet-2); font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }

/* key / value */
dl.kv { display: grid; grid-template-columns: 180px minmax(0, 1fr); border-top: 1px solid var(--rule-2); }
dl.kv dt, dl.kv dd { margin: 0; padding: 8px 0; border-bottom: 1px solid var(--rule-2); }
dl.kv dt { color: var(--ink-3); font-size: 13.5px; }

/* role cards on the home page: a ledger, not tiles */
.doc .ledger { list-style: none; padding: 0; border-top: 1px solid var(--rule-strong); }
.ledger li { max-width: none; margin: 0; border-bottom: 1px solid var(--rule-2); }
.ledger a { display: grid; grid-template-columns: 210px minmax(0, 1fr) auto; gap: 16px; align-items: baseline; padding: 12px 4px; text-decoration: none; color: var(--ink); }
.ledger a:hover { background: var(--navy-50); }
.ledger a b { color: var(--navy); font-size: 15.5px; }
.ledger a span { color: var(--ink-2); }
.ledger a i { font-style: normal; color: var(--navy-700); font-weight: 600; font-size: 13px; white-space: nowrap; }

/* the process, as a ruled flow */
.doc .flow { display: flex; flex-wrap: wrap; gap: 0; margin: 16px 0 20px; padding: 0; list-style: none; }
.flow li { flex: 1 1 0; min-width: 120px; max-width: none; margin: 0; border-top: 3px solid var(--navy); padding: 8px 12px 4px 0; position: relative; }
.flow li b { display: block; font-size: 14px; color: var(--navy); }
.flow li span { display: block; font-size: 12.5px; color: var(--ink-3); line-height: 1.4; }
.flow li small { display: block; margin-top: 6px; }
.flow li.side { border-top-color: var(--bad-line); border-top-style: dashed; }

/* ---------------------------------------------------------------- screenshots with pointers */
.shot { margin: 18px 0 26px; }
.shot .frame { position: relative; border: var(--hair); border-radius: var(--radius); box-shadow: var(--shadow-sheet); overflow: hidden; background: var(--sheet-2); line-height: 0; cursor: zoom-in; }
.shot.phone .frame { max-width: 340px; border: 8px solid var(--navy-950); border-radius: 26px; box-shadow: var(--shadow-pop); }
.shot.phone { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 28px; align-items: start; }
.shot img { width: 100%; height: auto; display: block; }
.mk-box { position: absolute; border: 2px solid var(--amber); border-radius: 3px; pointer-events: none; transition: opacity .15s, border-color .15s, box-shadow .15s; }
.mk {
  position: absolute; width: 24px; height: 24px; margin: -12px 0 0 -12px; border-radius: 50%;
  background: var(--amber); color: var(--ink); font: 800 12.5px/24px var(--font); text-align: center;
  box-shadow: 0 0 0 2px #fff, 0 2px 6px rgba(0, 0, 0, .3); pointer-events: none;
}
.shot.focus .mk-box { opacity: .25; }
.shot.focus .mk { opacity: .35; }
.shot.focus .mk-box.on { opacity: 1; border-color: var(--navy); box-shadow: 0 0 0 9999px rgba(0, 0, 40, .28); }
.shot.focus .mk.on { opacity: 1; background: var(--navy); color: #fff; }
.doc .legend { list-style: none; padding: 0; margin: 12px 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 2px 20px; }
.doc .shot.phone .legend { grid-template-columns: 1fr; margin-top: 0; }
.legend li { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 10px; padding: 6px 6px; border-radius: var(--radius); margin: 0; font-size: 14px; line-height: 1.45; cursor: default; max-width: none; }
.legend li:hover, .legend li.on { background: var(--amber-50); }
.legend li i { width: 22px; height: 22px; border-radius: 50%; background: var(--amber); font: 800 11.5px/22px var(--font); text-align: center; font-style: normal; color: var(--ink); }
.legend li b { display: block; }
.legend li span { display: block; color: var(--ink-2); font-size: 13.5px; }
.shot figcaption { font-size: 13px; color: var(--ink-3); margin-top: 8px; line-height: 1.5; }
.shot .missing { line-height: 1.5; padding: 20px; font-size: 13px; color: var(--ink-3); }

dialog.zoom { border: 0; padding: 0; background: transparent; max-width: 96vw; max-height: 96vh; overflow: auto; }
dialog.zoom::backdrop { background: rgba(0, 0, 40, .72); }
dialog.zoom .frame { cursor: zoom-out; width: min(1600px, 94vw); }
dialog.zoom.phone .frame { width: min(430px, 90vw); }
dialog.zoom .mk { width: 24px; height: 24px; line-height: 24px; }

/* ---------------------------------------------------------------- troubleshooting */
.filter { display: flex; gap: 10px; align-items: center; margin: 16px 0 6px; }
.filter input { flex: 1; height: 40px; border: var(--hair); border-radius: var(--radius); padding: 0 12px; font-size: 15px; background: var(--sheet); }
.filter input:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px var(--navy-100); }
.filter span { color: var(--ink-3); font-size: 13px; white-space: nowrap; }
details.ts { border: var(--hair); border-radius: var(--radius); margin: 0 0 8px; background: var(--sheet); scroll-margin-top: 72px; }
details.ts > summary { list-style: none; cursor: pointer; padding: 11px 14px 11px 40px; position: relative; display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: baseline; }
details.ts > summary::-webkit-details-marker { display: none; }
details.ts > summary::before { content: ''; position: absolute; left: 16px; top: 18px; width: 7px; height: 7px; border-right: 2px solid var(--navy); border-bottom: 2px solid var(--navy); transform: rotate(-45deg); transition: transform .15s; }
details.ts[open] > summary::before { transform: rotate(45deg); }
details.ts > summary .msg { font-weight: 700; color: var(--ink); }
details.ts > summary .where { font-size: 12.5px; color: var(--ink-3); }
details.ts[open] { border-color: var(--navy-300); }
details.ts .body { padding: 2px 16px 14px 40px; }
details.ts dl { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 0; margin: 0; }
details.ts dt, details.ts dd { margin: 0; padding: 7px 0; border-top: 1px solid var(--rule-2); }
details.ts dt { font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; font-weight: 700; color: var(--ink-3); padding-top: 10px; }
details.ts dd p:last-child, details.ts dd ul:last-child, details.ts dd ol:last-child { margin-bottom: 0; }
.ts-empty { padding: 18px; border: 1px dashed var(--rule); border-radius: var(--radius); color: var(--ink-3); text-align: center; }

/* ---------------------------------------------------------------- on this page, prev / next */
.toc { position: sticky; top: 84px; align-self: start; font-size: 13px; max-height: calc(100vh - 110px); overflow-y: auto; }
.toc b { display: block; font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 8px; padding-bottom: 6px; border-bottom: 1px solid var(--rule-strong); }
.toc a { display: block; padding: 4px 0 4px 10px; color: var(--ink-2); text-decoration: none; border-left: 2px solid transparent; line-height: 1.35; }
.toc a.h3 { padding-left: 22px; font-size: 12.5px; color: var(--ink-3); }
.toc a:hover { color: var(--navy); }
.toc a.on { color: var(--navy); border-left-color: var(--navy); font-weight: 600; }
.pn { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 40px; }
.pn a { border: var(--hair); border-radius: var(--radius); padding: 12px 16px; text-decoration: none; color: var(--ink); display: block; }
.pn a:hover { border-color: var(--navy-300); background: var(--navy-50); }
.pn a small { display: block; font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); font-weight: 700; }
.pn a b { color: var(--navy); }
.pn .next { text-align: right; grid-column: 2; }
.updated { margin-top: 26px; font-size: 12.5px; color: var(--ink-3); }

/* ---------------------------------------------------------------- narrow screens */
@media (max-width: 1240px) {
  .page { grid-template-columns: minmax(0, 860px); }
  .toc { display: none; }
}
@media (max-width: 960px) {
  .shot.phone { grid-template-columns: minmax(0, 1fr); justify-items: center; }
  .shot.phone .legend { justify-self: stretch; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .rail { position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); z-index: 40; transform: translateX(-100%); transition: transform .2s var(--ease); }
  .rail.open { transform: none; box-shadow: var(--shadow-pop); }
  .scrim { position: fixed; inset: 0; background: rgba(0, 0, 40, .4); z-index: 35; }
  .top { padding: 0 16px; gap: 10px; }
  .top .menu { display: inline-flex; align-items: center; gap: 6px; border: var(--hair); background: var(--sheet); border-radius: var(--radius); height: 36px; padding: 0 10px; font-weight: 600; cursor: pointer; }
  .top .crumbs, .top .apps, .search kbd { display: none; }
  .search { width: auto; flex: 1; }
  .page { padding: 16px 16px 48px; }
  .doc { padding: 26px 20px 32px; }
  .doc h1 { font-size: 26px; }
  .ledger a { grid-template-columns: 1fr; gap: 2px; }
  dl.kv, details.ts dl { grid-template-columns: 1fr; }
  dl.kv dt { border-bottom: 0; padding-bottom: 0; }
  details.ts dt { border-top: 1px solid var(--rule-2); }
  details.ts dd { border-top: 0; padding-top: 0; }
  details.ts .body { padding-left: 16px; }
  .pn { grid-template-columns: 1fr; }
  .pn .next { grid-column: 1; }
}

@media print {
  body { background: #fff; font-size: 11pt; }
  .rail, .top, .toc, .pn, .filter, .skip { display: none !important; }
  .shell, .page { display: block; padding: 0; }
  .doc { border: 0; box-shadow: none; padding: 0; }
  .shot, details.ts, table, .callout { break-inside: avoid; }
  details.ts > .body { display: block !important; }
  .shot .frame { box-shadow: none; }
  a { color: inherit; }
}
