/* ============================================================
   C-ERP — Handboek + Uitleg-modus (hover-help)
   ============================================================ */
.hb {
  --hb-green: #1F8A5B;
  --hb-blue: var(--brand);
  --hb-steel: var(--steel, #5B7A99);
  --hb-navy: var(--navy, #2A3F66);
  --hb-amber: var(--amber, #B07A1E);
  --hb-grey: var(--text-3);
  --hb-ink: var(--text-2);
  --hb-edge: color-mix(in srgb, var(--text) 30%, transparent);
  --hb-dot: color-mix(in srgb, var(--text) 9%, transparent);
}

/* ---- kop + tools ---------------------------------------- */
.hb-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; margin-bottom: var(--gap); }
.hb-top__title { font-size: 25px; font-weight: 600; letter-spacing: -0.01em; margin: 3px 0 5px; }
.hb-top__sub { font-size: 13px; color: var(--text-2); max-width: 640px; line-height: 1.5; }
.hb-top__tools { display: flex; align-items: center; gap: 10px; flex-shrink: 0; flex-wrap: wrap; max-width: 100%; }
.hb-search { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border: 1px solid var(--line-strong); border-radius: 11px; background: var(--surface); min-width: 230px; color: var(--text-3); }
.hb-search:focus-within { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }
.hb-search input { border: none; background: none; outline: none; font: inherit; font-size: 13px; color: var(--text); flex: 1; min-width: 0; }
.hb-search__x { display: flex; color: var(--text-3); padding: 2px; border-radius: 6px; }
.hb-search__x:hover { background: var(--bg-2); color: var(--text); }
.hb-rolesel { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-3); padding: 7px 12px; border: 1px solid var(--line-strong); border-radius: 11px; background: var(--surface); }
.hb-rolesel select { border: none; background: none; outline: none; font: inherit; font-size: 13px; font-weight: 500; color: var(--text); cursor: pointer; }
/* h159 (Q117): de projectkeuze is zo breed als de langste projectnaam; zonder deze grenzen duwde hij
   de hele werkbalk op telefoonbreedte tot 1086 px buiten beeld. */
.hb-rolesel { max-width: 100%; min-width: 0; }
.hb-rolesel select { min-width: 0; max-width: 100%; text-overflow: ellipsis; }

/* ---- layout: sticky zijbalk + flow ---------------------- */
.hb-layout { display: grid; grid-template-columns: 268px 1fr; gap: var(--gap); align-items: start; }
.hb-side { position: sticky; top: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 15px; box-shadow: var(--shadow); padding: 10px; max-height: calc(100vh - 90px); overflow-y: auto; scrollbar-width: thin; }
.hb-side__count { font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); padding: 6px 8px 8px; }
.hb-side__grp { margin-bottom: 8px; }
.hb-side__cat { display: flex; align-items: center; gap: 7px; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--text-3); padding: 8px 8px 5px; }
.hb-side__cat svg { color: var(--brand); }
.hb-side__item { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; border-radius: 9px; font-size: 13px; color: var(--text-2); text-align: left; transition: background .12s, color .12s; }
.hb-side__item:hover { background: var(--bg-2); color: var(--text); }
.hb-side__item.is-on { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.hb-side__nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hb-side__n { flex-shrink: 0; font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 999px; background: color-mix(in srgb, var(--text) 8%, transparent); color: var(--text-3); }
.hb-side__item.is-on .hb-side__n { background: color-mix(in srgb, var(--brand) 18%, transparent); color: var(--brand); }

.hb-main { min-width: 0; }

/* ---- proceskop ------------------------------------------ */
.hb-proc__head { display: flex; align-items: flex-start; gap: 14px; }
.hb-proc__icon { flex-shrink: 0; width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; background: var(--brand-soft); color: var(--brand); }
.hb-proc__ht { flex: 1; min-width: 0; }
.hb-proc__title { font-size: 21px; font-weight: 600; letter-spacing: -0.01em; margin: 1px 0 4px; }
.hb-proc__doel { font-size: 13.5px; color: var(--text-2); line-height: 1.5; }
.hb-proc__roles { display: flex; flex-wrap: wrap; gap: 5px; justify-content: flex-end; max-width: 230px; }
.hb-rolchip { font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: color-mix(in srgb, var(--steel) 14%, transparent); color: var(--steel); white-space: nowrap; }

.hb-proc__meta { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0; }
.hb-meta { font-size: 13px; color: var(--text); line-height: 1.45; padding: 11px 14px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); }
.hb-meta span { display: block; font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); margin-bottom: 3px; }

/* ---- legenda -------------------------------------------- */
.hb-legend { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; padding: 9px 4px 12px; }
.hb-legend__it { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--text-2); }
.hb-legend__it i { width: 10px; height: 10px; border-radius: 3px; }
.hb-legend__hint { display: inline-flex; align-items: center; gap: 5px; margin-left: auto; font-size: 11.5px; color: var(--text-3); }
.hb-legend__hint svg { color: var(--brand); }

/* ISO-borging per proces */
.hb-iso { display: flex; flex-wrap: wrap; align-items: center; gap: 9px 18px; margin: 0 0 4px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 11px; background: var(--bg-2); }
.hb-iso__it { font-size: 12px; color: var(--text); }
.hb-iso__it span { font-size: 9.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--text-3); margin-right: 6px; }
.hb-iso__norm { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; font-size: 11px; font-weight: 600; color: var(--brand); background: var(--brand-soft); padding: 4px 10px; border-radius: 999px; }
.hb-iso__norm svg { color: var(--brand); }
.hb-iso-note { display: flex; align-items: flex-start; gap: 7px; margin-top: 8px; font-size: 12px; color: var(--text-2); line-height: 1.45; max-width: 700px; }
.hb-iso-note svg { color: var(--brand); flex-shrink: 0; margin-top: 2px; }

/* ---- flow-canvas (n8n-stijl) ---------------------------- */
.hb-canvaswrap { border: 1px solid var(--line); border-radius: 15px; background: var(--bg); overflow: auto; box-shadow: inset 0 1px 0 var(--edge); scrollbar-width: thin; }
.hb-canvas { position: relative; background-image: radial-gradient(circle, var(--hb-dot) 1.2px, transparent 1.2px); background-size: 22px 22px; background-position: 13px 13px; min-width: 100%; }
.hb-edges { position: absolute; inset: 0; pointer-events: none; overflow: visible; }
.hb-elabel { position: absolute; transform: translate(-50%, -50%); font-size: 10.5px; font-weight: 700; color: var(--text-2); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 999px; padding: 1px 8px; white-space: nowrap; pointer-events: none; box-shadow: 0 1px 3px rgba(0,0,0,.08); }

/* ---- node-kaartje --------------------------------------- */
.hbnode { position: absolute; display: flex; align-items: center; gap: 11px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 13px; background: var(--surface); box-shadow: 0 1px 3px rgba(0,0,0,.06), inset 0 1px 0 var(--edge); text-align: left; transition: box-shadow .14s, border-color .14s, transform .14s; cursor: pointer; }
.hbnode:hover { border-color: color-mix(in srgb, var(--brand) 45%, var(--line-strong)); box-shadow: 0 6px 18px rgba(0,0,0,.12); transform: translateY(-1px); }
.hbnode.is-sel { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft), 0 6px 18px rgba(0,0,0,.12); }
.hbnode__badge { flex-shrink: 0; width: 34px; height: 34px; border-radius: 9px; display: flex; align-items: center; justify-content: center; color: #fff; box-shadow: inset 0 1px 0 rgba(255,255,255,.25); }
.hbnode__body { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.hbnode__kind { font-size: 9.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbnode__title { font-size: 13px; font-weight: 600; color: var(--text); line-height: 1.2; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.hbnode__open { position: absolute; top: -8px; right: -8px; width: 22px; height: 22px; border-radius: 7px; display: flex; align-items: center; justify-content: center; background: var(--brand); color: #fff; opacity: 0; transform: scale(.7); transition: opacity .14s, transform .14s; box-shadow: 0 2px 6px rgba(0,0,0,.25); }
.hbnode.has-link:hover .hbnode__open, .hbnode.is-sel .hbnode__open { opacity: 1; transform: scale(1); }
.hbnode--start .hbnode__badge, .hbnode--einde .hbnode__badge { border-radius: 50%; }
.hbnode--beslissing { border-style: dashed; }

/* ---- onder de flow: detail + context -------------------- */
.hb-proc__below { display: grid; grid-template-columns: 1.25fr 1fr; gap: var(--gap); margin-top: var(--gap); align-items: stretch; }
.hb-detail { border: 1px solid var(--line); border-radius: 15px; background: var(--surface); box-shadow: var(--shadow); padding: 16px; }
.hb-detail__h { display: flex; align-items: center; gap: 11px; margin-bottom: 11px; }
.hb-detail__ht { flex: 1; min-width: 0; }
.hb-detail__kind { display: block; font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
.hb-detail__ht b { font-size: 15.5px; font-weight: 600; }
.hb-detail__oms { font-size: 13.5px; color: var(--text); line-height: 1.55; }
.hb-velden { margin-top: 13px; border-top: 1px solid var(--line); padding-top: 12px; }
.hb-velden__h { display: block; font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); margin-bottom: 8px; }
.hb-velden ul { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; }
.hb-velden li { font-size: 12px; font-weight: 500; color: var(--text-2); padding: 5px 10px; border-radius: 8px; background: var(--bg-2); border: 1px solid var(--line); }
.hb-detail__tip { display: flex; align-items: flex-start; gap: 7px; margin-top: 12px; font-size: 12px; color: var(--text-2); background: color-mix(in srgb, var(--amber) 9%, transparent); border: 1px solid color-mix(in srgb, var(--amber) 22%, transparent); border-radius: 9px; padding: 8px 11px; }
.hb-detail__tip svg { color: var(--amber); flex-shrink: 0; margin-top: 1px; }
.hb-stake { margin-top: 13px; }
.hb-stake__h { display: block; font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); margin-bottom: 7px; }
.hb-stake__chips { display: flex; flex-wrap: wrap; gap: 6px; }
.hb-stakechip { font-size: 11.5px; font-weight: 500; color: var(--hb-navy, #2A3F66); background: color-mix(in srgb, var(--hb-navy, #2A3F66) 10%, transparent); border: 1px solid color-mix(in srgb, var(--hb-navy, #2A3F66) 20%, transparent); padding: 4px 10px; border-radius: 999px; }
.hb-risk { display: flex; align-items: flex-start; gap: 8px; margin-top: 12px; font-size: 12.5px; color: var(--text-2); line-height: 1.5; background: color-mix(in srgb, var(--signal) 8%, transparent); border: 1px solid color-mix(in srgb, var(--signal) 24%, transparent); border-radius: 10px; padding: 9px 12px; }
.hb-risk svg { color: var(--signal); flex-shrink: 0; margin-top: 2px; }
.hb-risk span { display: block; font-size: 9.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--signal); margin-bottom: 2px; }
.hb-io { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.hb-io__row { font-size: 12.5px; color: var(--text); line-height: 1.45; padding: 8px 11px; border: 1px solid var(--line); border-radius: 9px; background: var(--bg-2); }
.hb-io__row span { display: inline-block; min-width: 54px; font-size: 9.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); margin-right: 8px; }
.hb-docs { margin-top: 12px; }
.hb-docs__h { display: block; font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); margin-bottom: 7px; }
.hb-docs__chips { display: flex; flex-wrap: wrap; gap: 6px; }
.hb-docchip { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 500; color: var(--hb-steel, #5B7A99); background: color-mix(in srgb, var(--hb-steel, #5B7A99) 10%, transparent); border: 1px solid color-mix(in srgb, var(--hb-steel, #5B7A99) 22%, transparent); padding: 4px 9px; border-radius: 8px; }
.hb-docchip svg { color: var(--hb-steel, #5B7A99); }
.hb-docchip--link { border: 1px solid color-mix(in srgb, var(--hb-steel, #5B7A99) 34%, transparent); cursor: pointer; font: inherit; font-size: 11.5px; font-weight: 500; transition: background .12s, border-color .12s, transform .1s; }
.hb-docchip--link:hover { background: color-mix(in srgb, var(--hb-steel, #5B7A99) 18%, transparent); border-color: var(--hb-steel, #5B7A99); transform: translateY(-1px); }
.hb-docchip--link svg:last-child { margin-left: 1px; opacity: .7; }
.hb-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.hb-open--doc { background: var(--surface); color: var(--brand); border: 1px solid var(--brand); box-shadow: none; }
.hb-open--doc svg { color: var(--brand); }
.hb-open--doc:hover { background: var(--brand-soft); filter: none; }
.hb-norm { display: inline-flex; align-items: center; gap: 6px; margin-top: 12px; font-size: 11px; font-weight: 600; color: var(--brand); background: var(--brand-soft); padding: 4px 10px; border-radius: 999px; }
.hb-norm svg { color: var(--brand); }
.hb-open { display: inline-flex; align-items: center; gap: 7px; margin-top: 14px; padding: 9px 15px; border-radius: 10px; background: var(--brand); color: #fff; font-size: 13px; font-weight: 600; box-shadow: 0 2px 8px var(--brand-soft); transition: filter .12s, transform .12s; }
.hb-open:hover { filter: brightness(1.06); transform: translateY(-1px); }
.hb-detail__nolink { display: inline-block; margin-top: 14px; font-size: 12px; color: var(--text-3); font-style: italic; }

.hb-context { display: flex; flex-direction: column; gap: var(--gap); }
.hb-block { border: 1px solid var(--line); border-radius: 15px; background: var(--surface); box-shadow: var(--shadow); padding: 14px 16px; }
.hb-block__h { display: flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-2); margin-bottom: 11px; }
.hb-block__h svg { color: var(--brand); }
.hb-commlist { display: flex; flex-direction: column; gap: 9px; }
.hb-comm { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding-bottom: 9px; border-bottom: 1px solid var(--line); }
.hb-comm:last-child { border-bottom: none; padding-bottom: 0; }
.hb-comm b { font-size: 12.5px; font-weight: 600; color: var(--text); }
.hb-comm span { font-size: 12px; color: var(--text-2); grid-column: 1 / -1; line-height: 1.45; }
.hb-comm i { font-size: 10.5px; font-style: normal; font-weight: 600; color: var(--text-3); white-space: nowrap; }
.hb-checks { display: flex; flex-direction: column; gap: 3px; }
.hb-check { display: flex; align-items: flex-start; gap: 9px; padding: 6px 4px; font-size: 12.5px; color: var(--text-2); text-align: left; border-radius: 7px; transition: background .12s, color .12s; }
.hb-check:hover { background: var(--bg-2); }
.hb-check__box { flex-shrink: 0; width: 17px; height: 17px; border-radius: 5px; border: 1.5px solid var(--line-strong); display: flex; align-items: center; justify-content: center; color: #fff; margin-top: 1px; transition: background .12s, border-color .12s; }
.hb-check.is-done { color: var(--text-3); text-decoration: line-through; }
.hb-check.is-done .hb-check__box { background: var(--hb-green, #1F8A5B); border-color: var(--hb-green, #1F8A5B); }
.hb-check:disabled { opacity: .55; pointer-events: none; }
.hb-checks__hint { margin: 8px 4px 0; font-size: 11.5px; color: var(--text-3); line-height: 1.4; }
.hb-checks__hint i { font-style: normal; }


@media (max-width: 760px) {
  .hb-layout { grid-template-columns: 1fr; }
  .hb-top__tools { flex: 1 1 100%; min-width: 0; }
  .hb-search, .hb-rolesel { flex: 1 1 100%; min-width: 0; }
  .hb-rolesel select { flex: 1 1 auto; }
  .hb-side { position: static; max-height: none; }
  .hb-proc__below { grid-template-columns: 1fr; }
}

/* ============================================================
   Uitleg-modus — hover-tooltip + banner + markering
   ============================================================ */
html[data-help-mode] [data-help] { outline: 1.5px dashed color-mix(in srgb, var(--brand) 48%, transparent); outline-offset: 2px; border-radius: 7px; cursor: help; }
html[data-help-mode] .tb__navitem[data-help], html[data-help-mode] .tb__icon[data-help], html[data-help-mode] .tb__avatar[data-help] { outline-color: rgba(255,255,255,.5); }
html[data-help-mode] [data-help]:hover { outline-color: var(--brand); outline-style: solid; }

.help-tip { position: fixed; z-index: 9999; max-width: 320px; background: var(--surface, #fff); color: var(--text, #14202A); border: 1px solid var(--line-strong, #d8dee3); border-radius: 13px; box-shadow: 0 12px 34px rgba(0,0,0,.22); padding: 13px 15px; opacity: 0; transform: translateY(4px); transition: opacity .12s, transform .12s; pointer-events: none; }
.help-tip.is-on { opacity: 1; transform: translateY(0); }
.help-tip__h { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }
.help-tip__h b { font-size: 14px; font-weight: 600; }
.help-tip__rol { margin-left: auto; font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--brand); background: var(--brand-soft); padding: 2px 7px; border-radius: 999px; }
.help-tip__row { font-size: 12px; color: var(--text-2); line-height: 1.45; margin-top: 6px; }
.help-tip__row span { display: block; font-size: 9.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); margin-bottom: 1px; }

.tb__help.is-on { background: rgba(255,255,255,.16); color: #fff; box-shadow: inset 0 0 0 1px rgba(255,255,255,.25); }

.help-banner { position: fixed; left: 50%; bottom: 18px; transform: translate(-50%, 16px); z-index: 9998; display: flex; align-items: center; gap: 10px; background: #0C1A24; color: #fff; border: 1px solid rgba(255,255,255,.14); border-radius: 999px; padding: 9px 10px 9px 16px; box-shadow: 0 10px 30px rgba(0,0,0,.3); opacity: 0; transition: opacity .18s, transform .18s; font-size: 12.5px; }
.help-banner.is-on { opacity: 1; transform: translate(-50%, 0); }
.help-banner__dot { width: 8px; height: 8px; border-radius: 50%; background: #4ED7A8; box-shadow: 0 0 0 4px rgba(78,215,168,.22); }
.help-banner b { font-weight: 600; }
.help-banner__txt { color: rgba(255,255,255,.62); }
.help-banner__x { margin-left: 4px; padding: 5px 12px; border-radius: 999px; background: rgba(255,255,255,.12); color: #fff; font-size: 12px; font-weight: 600; transition: background .12s; }
.help-banner__x:hover { background: rgba(255,255,255,.22); }
