/* ===== v3: left-hand navigation, mobile drawer, integration pages, profiles ===== */
html { scroll-padding-top: 20px; }
@media (max-width: 899px) { html { scroll-padding-top: 72px; } }
body { overflow-x: hidden; }
.app { display: grid; grid-template-columns: 296px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--panel); border-right: 1px solid var(--line);
  padding: max(16px, env(safe-area-inset-top, 0px)) 14px 48px max(16px, env(safe-area-inset-left, 0px)); font-size: 14px; z-index: 30; }
.sb-top { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.brand { font-weight: 800; letter-spacing: -.01em; font-size: 17px; flex: 1; }
.brand i { font-style: normal; color: var(--accent); }
.sb-close { display: none; }
.sidebar select { width: 100%; margin-bottom: 12px; }
.nav-h { margin: 18px 0 6px; padding: 0 8px; font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.nav-s { margin: 10px 0 2px; padding: 0 8px; font-size: 12.5px; font-weight: 600; color: var(--text); }
.nav a.pg { display: block; padding: 6px 8px; border-radius: 8px; color: var(--text); text-decoration: none; }
.nav a.pg:hover { background: var(--accent-soft); }
.nav a.pg[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.toc { margin: 2px 0 6px 12px; padding-left: 8px; border-left: 1px solid var(--line); }
.toc a { display: block; padding: 3px 8px; font-size: 13px; color: var(--muted); text-decoration: none; border-radius: 6px; }
.toc a:hover { color: var(--accent); background: var(--accent-soft); }
.mbar { display: none; }
.backdrop { display: none; }
.content { min-width: 0; padding: 32px max(16px, env(safe-area-inset-right, 0px)) 96px 44px; }
.content > main { max-width: 900px; }
@media (max-width: 899px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .mbar { display: flex; position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; align-items: center; gap: 10px; height: 52px;
    padding: 0 max(16px, env(safe-area-inset-right, 0px)) 0 max(8px, env(safe-area-inset-left, 0px)); background: color-mix(in srgb, var(--bg) 92%, transparent);
    backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
  .mbtn { width: 44px; height: 44px; border: 0; background: none; color: var(--text); font-size: 22px; cursor: pointer; border-radius: 10px; }
  .mbtn:hover { background: var(--accent-soft); }
  .mtitle { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; height: auto; width: min(86vw, 320px); transform: translateX(-105%); transition: transform .25s ease; box-shadow: none; }
  .app.open .sidebar { transform: none; box-shadow: 0 0 40px rgba(0, 0, 0, .3); }
  .app.open .backdrop { display: block; position: fixed; inset: 0; z-index: 25; background: rgba(0, 0, 0, .4); }
  .sb-close { display: block; width: 40px; height: 40px; border: 0; background: none; color: var(--text); font-size: 20px; cursor: pointer; border-radius: 10px; }
  .content { padding: 0 max(16px, env(safe-area-inset-right, 0px)) 80px max(16px, env(safe-area-inset-left, 0px)); }
  .mbar { margin: 0 calc(-1 * max(16px, env(safe-area-inset-right, 0px))) 0 calc(-1 * max(16px, env(safe-area-inset-left, 0px))); padding-left: max(8px, env(safe-area-inset-left, 0px)); }
  .content > main { padding-top: 20px; }
  h1 { font-size: 26px; }
}
@media (prefers-reduced-motion: reduce) { .sidebar { transition: none; } }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 18px; }
.btn { font: inherit; font-size: 13.5px; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 9px; padding: 8px 13px; cursor: pointer; min-height: 38px; }
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn:focus-visible, .nav a:focus-visible, .mbtn:focus-visible, .sb-close:focus-visible, .cbtn:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn.primary { background: var(--accent); color: var(--bg); border-color: var(--accent); font-weight: 600; }
.btn.primary:hover { color: var(--bg); opacity: .9; }
.btn.danger:hover { border-color: #c2410c; color: #c2410c; }
.btn[disabled] { opacity: .55; cursor: default; }

/* sections and cards */
.sec { margin-top: 34px; }
.sec > h2 { margin-top: 0; display: flex; align-items: center; gap: 8px; }
.sec h2 a.anchor, .sec h3 a.anchor { opacity: 0; color: var(--accent); text-decoration: none; font-size: 15px; }
.sec h2:hover a.anchor, .sec h3:hover a.anchor, a.anchor:focus { opacity: 1; }
@media (hover: none) { .sec h2 a.anchor, .sec h3 a.anchor { opacity: .6; } }
.sec:target > h2, .sec.flash > h2 { background: var(--flash); border-radius: 6px; }
.steps3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 10px 0 0; padding: 0; list-style: none; }
.steps3 li { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.steps3 b { display: block; margin-bottom: 4px; }
.steps3 .n { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: var(--bg); font: 600 12px var(--mono); margin-bottom: 8px; }
.steps3 span.d { color: var(--muted); font-size: 13.5px; }
@media (max-width: 700px) { .steps3 { grid-template-columns: minmax(0, 1fr); } }
.pills { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; padding: 0; list-style: none; }
.pills li { background: var(--accent-soft); color: var(--accent); border-radius: 99px; padding: 3px 11px; font-size: 13px; }
.list { margin: 8px 0 0; padding-left: 20px; } .list li { margin: 3px 0; }
.res a { color: var(--accent); }
.res li { margin: 6px 0; }
.hint { background: var(--accent-soft); border-radius: 10px; padding: 10px 14px; font-size: 13.5px; margin: 10px 0 0; }
.cols2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 700px) { .cols2 { grid-template-columns: minmax(0, 1fr); } }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; }
.kv { display: grid; grid-template-columns: minmax(150px, 220px) minmax(0, 1fr); gap: 4px 18px; margin: 8px 0 0; }
.kv > div { padding: 9px 0; border-bottom: 1px solid var(--line); }
.kv > div:nth-child(odd) { font-family: var(--mono); font-size: 13px; font-weight: 600; word-break: break-word; }
@media (max-width: 700px) { .kv { grid-template-columns: minmax(0, 1fr); } .kv > div:nth-child(odd) { border-bottom: 0; padding-bottom: 0; } }
.state-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.st { font: 600 12px var(--mono); padding: 3px 10px; border-radius: 6px; border: 1px solid var(--line); }
.st.APPROVE { color: var(--ok); } .st.DECLINE { color: #c2410c; } .st.REVIEW { color: var(--warn); }

/* code block */
.code { margin: 12px 0 0; }
.code-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--muted); }
.code-h b { font-weight: 600; color: var(--text); }
.cbtn { font: inherit; font-size: 12px; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 7px; padding: 4px 10px; cursor: pointer; min-height: 30px; }
.cbtn:hover { border-color: var(--accent); color: var(--accent); }
.code pre { margin: 6px 0 0; max-height: 460px; }

/* field rows on touchpoint pages */
.tpf { display: grid; grid-template-columns: minmax(190px, 270px) minmax(120px, 210px) minmax(0, 1fr); gap: 4px 16px; padding: 10px 8px; border-bottom: 1px solid var(--line); border-radius: 8px; align-items: baseline; }
.tpf .fname { font-size: 13px; }
.tpf .ex { font-family: var(--mono); font-size: 12px; color: var(--muted); word-break: break-all; }
.tpf .nt { font-size: 13.5px; }
.tpf.off { opacity: .45; }
.tpf label { display: flex; gap: 8px; align-items: baseline; cursor: pointer; }
.tpf .acts { display: inline-flex; gap: 4px; }
.tpf .mini { border: 0; background: none; cursor: pointer; color: var(--muted); font: inherit; padding: 0 4px; border-radius: 5px; min-width: 24px; }
.tpf .mini:hover { color: var(--accent); background: var(--accent-soft); }
.tpf.flash, .tpf:target { animation: flash 2.4s ease; }
@media (max-width: 760px) { .tpf { grid-template-columns: minmax(0, 1fr); } }
.tp-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.apilink { font-size: 13px; color: var(--accent); }

/* sequence diagram */
.seq { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); padding: 8px; }
.seq svg { display: block; min-width: 660px; width: 100%; height: auto; }
.seq text { fill: var(--text); font: 12px var(--font); }
.seq .lane-box { fill: var(--code); stroke: var(--line); }
.seq .life { stroke: var(--line); stroke-dasharray: 4 5; }
.seq .arrow { stroke: var(--accent); stroke-width: 1.6; fill: none; }
.seq .ret { stroke-dasharray: 6 4; }
.seq .head { fill: var(--accent); }
.seq .num { fill: var(--accent); }
.seq .numt { fill: var(--bg); font-weight: 700; font-size: 11px; }
.seq .m { opacity: 0; animation: seqin .5s ease forwards; animation-delay: calc(var(--i) * .32s); }
.seq.static .m { opacity: 1; animation: none; }
@keyframes seqin { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .seq .m { opacity: 1; animation: none; } }
.seq-bar { display: flex; justify-content: flex-end; margin: 0 0 6px; }

/* inputs */
input[type="text"], input[type="search"], textarea { font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px; width: 100%; }
textarea { min-height: 84px; resize: vertical; }
label.fl { display: block; font-size: 13px; font-weight: 600; margin: 14px 0 5px; }
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.checks label { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); background: var(--panel); border-radius: 9px; padding: 8px 12px; cursor: pointer; font-size: 14px; min-height: 40px; }
.checks input { width: 17px; height: 17px; accent-color: var(--accent); }
.checks label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
input[type="checkbox"] { accent-color: var(--accent); width: 17px; height: 17px; }

/* profiles */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin: 14px 0; }
.pf-list { display: grid; gap: 8px; margin: 8px 0 0; padding: 0; list-style: none; }
.pf-list li { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.pf-list .t { flex: 1 1 200px; min-width: 0; } .pf-list .t b { display: block; overflow-wrap: anywhere; } .pf-list .t span { color: var(--muted); font-size: 13px; }
.share { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.share input { flex: 1 1 260px; min-width: 0; font: 12.5px var(--mono); }
.meta-line { color: var(--muted); font-size: 13px; margin: 4px 0 0; }
.cmt { border-top: 1px solid var(--line); padding: 12px 2px; }
.cmt-h { display: flex; gap: 8px; flex-wrap: wrap; align-items: baseline; font-size: 13px; color: var(--muted); }
.cmt-h b { color: var(--text); }
.cmt p { margin: 4px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.cmt.done p { opacity: .6; }
.tag { font: 600 11px var(--mono); border-radius: 5px; padding: 1px 7px; background: var(--accent-soft); color: var(--accent); }
.tag.q { color: var(--warn); }
.tag.ok { color: var(--ok); }
.composer { display: grid; gap: 8px; margin-top: 12px; }
.composer .row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.composer .row input[type="text"] { flex: 1 1 160px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.seg label { padding: 8px 12px; cursor: pointer; font-size: 13.5px; color: var(--muted); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:checked) { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.seg label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: -2px; }

/* PDF sheet (rendered off-screen, always light) */
.pdf-sheet { position: fixed; left: -12000px; top: 0; width: 794px; padding: 36px 40px; background: #fff; color: #1c1917; font: 13px/1.5 var(--font);
  --bg: #fff; --panel: #fff; --text: #1c1917; --muted: #6b6560; --line: #e0dcd8; --accent: #4b30d8; --accent-soft: #efecff; --code: #f4f2f0; --flash: #fff; --ok: #0f7b4f; --warn: #a15c00; }
.pdf-sheet * { animation: none !important; transition: none !important; }
.pdf-sheet details > summary::before { display: none; }
.pdf-sheet .noprint { display: none !important; }
.pdf-sheet pre { max-height: none; overflow: visible; white-space: pre-wrap; word-break: break-word; font-size: 11px; }
.pdf-sheet .seq { overflow: visible; } .pdf-sheet .seq svg { min-width: 0; }
.pdf-sheet .tpf { grid-template-columns: 220px 150px minmax(0, 1fr); }
.pdf-sheet h1 { font-size: 24px; }

/* sandbox guide canvas additions */
.gsb .gscene { padding-top: 58px; }
.gtop { position: absolute; right: 14px; top: 10px; z-index: 3; display: flex; }
.guser { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); font-weight: 600; }
.gav { width: 20px; height: 20px; border-radius: 50%; background: var(--accent); display: inline-block; }
.gmenu { position: absolute; right: 14px; top: 50px; width: 210px; z-index: 4; display: flex; flex-direction: column; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); box-shadow: 0 10px 30px rgba(0, 0, 0, .18); opacity: 0; transform: translateY(-6px); pointer-events: none; transition: opacity .25s ease, transform .25s ease; }
.gmenu.on { opacity: 1; transform: none; }
.gsw { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; margin-top: 6px; }
.gsw span { text-align: center; padding: 8px 4px; font-size: 12px; color: var(--muted); }
.gsw span.sel { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.ggold { position: absolute; left: 0; right: 0; top: 0; height: 22px; z-index: 6; background: #d4a017; color: #2a1d00; font: 700 11px/22px var(--mono); letter-spacing: .14em; text-align: center; transform: translateY(-100%); transition: transform .35s ease; }
.gapp { transition: padding-top .35s ease; overflow: hidden; }
.gapp.gold { padding-top: 22px; }
.gapp.gold .ggold { transform: none; }
@media (prefers-reduced-motion: reduce) { .gmenu, .ggold, .gapp { transition: none; } }

/* ---- dictionary refinements ---- */
.dictview .toolbar{position:sticky;top:0;z-index:5;background:var(--bg);padding:10px 0;border-bottom:1px solid var(--line,var(--line,rgba(128,128,128,.25)))}
.dictview .grp.sub{margin-left:12px}
.dictview .grp.inner{margin-left:10px}
.dictview .grp.inner>summary{font-size:13px}
.dictview .gsum{color:var(--muted);margin:0 0 12px;max-width:68ch}
.fdef{margin:6px 0 4px;line-height:1.55;max-width:74ch}
.fnote{margin:2px 0;color:var(--muted);font-size:12.5px}
.fref{margin:4px 0 0;font-size:12.5px}
.drow .fmeta{margin-top:2px}
.checks label.chk,label.chk{display:flex;gap:8px;align-items:center}
.dictview table.dict td{vertical-align:top}
@media (max-width:640px){.dictview .grp.sub{margin-left:4px}.dictview .toolbar{flex-wrap:wrap}}
.dictview .grp>summary{flex-wrap:wrap;row-gap:2px}
.dictview .grp>summary .gt{min-width:0;overflow-wrap:anywhere}
.dictview .fname,.dictview .fdesc{overflow-wrap:anywhere}

.dictview .dtree>.grp>summary .gt{font-family:inherit;font-weight:650;font-size:15px}
.dictview .dtree>.grp{margin-bottom:10px}
.dstats{display:flex;flex-wrap:wrap;gap:10px;margin:4px 0 18px}
.dstats div{display:flex;flex-direction:column;padding:10px 16px;border:1px solid var(--line,rgba(128,128,128,.25));border-radius:10px;min-width:96px}
.dstats b{font-size:22px;line-height:1.1;letter-spacing:-.01em}
.dstats span{font-size:12px;color:var(--muted);margin-top:2px}
.dictview .fdef{font-size:14.5px}
.dictview .drow{padding-top:12px;padding-bottom:12px}

/* admin area */
.fs-bar{display:flex;gap:8px;align-items:center;flex-wrap:wrap;position:sticky;top:0;z-index:5;background:var(--bg);padding:10px 0;margin:6px 0 10px;border-bottom:1px solid var(--line)}
.fs-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(210px,1fr));gap:10px 14px;margin-bottom:6px}
.fs-grid label{min-width:0}.fs-grid input,.fs-grid select{width:100%}
.fs-fields{display:grid;grid-template-columns:repeat(auto-fill,minmax(230px,1fr));gap:4px 14px;margin-top:10px}
.fs-f{display:flex;align-items:center;gap:8px;min-width:0;padding:4px 0}
.fs-f code{overflow-wrap:anywhere;font-size:12.5px}
.fs-f.off code{text-decoration:line-through;color:var(--muted)}
