:root {
  --bg: #eef1f5; --panel: #0B2A55; --card: #ffffff; --card-2: #f3f5f9; --line: #e1e6ed; --line-2: #cfd7e2;
  --text: #17212f; --text-2: #4a5668; --muted: #7b8696; --brand: #0B3B75; --brand-600: #14539C;
  --sage: #1f5fbf; --sage-2: #5b93d6; --sage-bg: #dce8f8; --sage-ink: #12305a;
  --sand: #d9a866; --sand-bg: #f4e7d1; --sand-ink: #5a3b12;
  --lilac: #a493c7; --red: #c0392b; --red-bg: #fdecea; --ok-bg: #e3edfb;
  --radius: 12px; --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14.5px/1.5 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
button, input, select, textarea { font: inherit; color: inherit; }
.app { display: grid; grid-template-columns: 290px 1fr; height: 100vh; }

/* sidebar */
.side { --card: #123A6E; --card-2: #174683; --line: #1d3f70; --line-2: #2a5490; --text: #ffffff; --text-2: #d3e0f2; --muted: #8fa8cc; --sage: #8fbcf2;
  background: var(--panel); color: var(--text); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.logo { color: inherit; text-decoration: none; display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; }
.logo .bars { display: flex; gap: 3px; align-items: flex-end; height: 22px; } .logo .bars i { width: 5px; border-radius: 2px; background: var(--sage); }
.logo .bars i:nth-child(1) { height: 9px; opacity: .6; } .logo .bars i:nth-child(2) { height: 15px; opacity: .8; } .logo .bars i:nth-child(3) { height: 22px; }
.logo b { font-size: 16px; } .logo span { display: block; font-size: 11.5px; color: var(--muted); }
.side .new { margin: 0 14px 10px; }
.search { margin: 0 14px 10px; }
.tree { overflow-y: auto; overflow-x: hidden; padding: 0 8px 12px; flex: 1; scrollbar-width: thin; scrollbar-color: transparent transparent; }
.tree:hover { scrollbar-color: rgba(255,255,255,.18) transparent; }
.tree::-webkit-scrollbar { width: 6px; } .tree::-webkit-scrollbar-track { background: transparent; }
.tree::-webkit-scrollbar-button { display: none; height: 0; }
.tree::-webkit-scrollbar-thumb { background: transparent; border-radius: 6px; } .tree:hover::-webkit-scrollbar-thumb { background: rgba(255,255,255,.18); }
.tree .grp { font-size: 11px; text-transform: uppercase; letter-spacing: 1.1px; color: var(--muted); margin: 12px 10px 4px; }
.tree details > summary { list-style: none; cursor: pointer; padding: 6px 10px; border-radius: 8px; color: var(--text-2); display: flex; gap: 8px; align-items: center; font-size: 13.5px; }
.tree details > summary::-webkit-details-marker { display: none; }
.tree details > summary::before { content: "›"; color: var(--muted); width: 10px; transition: transform .15s; }
.tree details[open] > summary::before { transform: rotate(90deg); }
.tree summary:hover, .tree a:hover { background: var(--card); }
.tree .code { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.tree .occ { padding-left: 14px; } .tree .occ > summary { font-size: 13px; }
.tree a { display: block; color: var(--text-2); text-decoration: none; padding: 5px 10px 5px 34px; border-radius: 8px; font-size: 13px; }
.tree a.on { background: var(--card-2); color: var(--text); }
.side-foot { border-top: 1px solid var(--line); padding: 10px 14px; font-size: 12.5px; color: var(--muted); display: flex; justify-content: space-between; }
.side-foot a { color: var(--text-2); }

/* main */
main { min-width: 0; overflow: auto; }
.head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 22px 28px 0; }
.head h1 { margin: 0; font-size: 22px; font-weight: 650; } .head .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; background: var(--card-2); border: 1px solid var(--line-2); font-size: 12.5px; color: var(--text-2); white-space: nowrap; }
.chip.sage { background: var(--ok-bg); border-color: #bcd3f2; color: #1b4f9c; } .chip.sand { background: #fbf1e2; border-color: #ecd3a8; color: #8a5a17; } .chip.red { background: var(--red-bg); border-color: #f3c1bc; color: #b42318; }
.tabs { display: flex; gap: 8px; padding: 16px 28px 0; flex-wrap: wrap; }
.tab { padding: 7px 16px; border-radius: 999px; border: 1px solid var(--line-2); background: #fff; color: var(--text-2); cursor: pointer; font-weight: 550; }
.tab.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.body { padding: 18px 28px 40px; }
.grid { display: grid; gap: 14px; } .g2 { grid-template-columns: 1fr 1fr; } .g3 { grid-template-columns: repeat(3, 1fr); } .g4 { grid-template-columns: repeat(4, 1fr); }
.card { background: var(--card); border: 1px solid var(--line); box-shadow: 0 1px 2px rgba(16,24,40,.04); border-radius: var(--radius); padding: 16px 18px; min-width: 0; }
.card h2 { margin: 0 0 10px; font-size: 15.5px; font-weight: 650; } .card h3 { margin: 0 0 6px; font-size: 14px; }
.muted { color: var(--muted); } .small { font-size: 12.5px; }
.stat .v { font-size: 24px; font-weight: 700; } .stat .l { color: var(--muted); font-size: 12.5px; }
.rows .r { display: flex; gap: 12px; padding: 9px 0; align-items: flex-start; border-bottom: 1px solid var(--line); } .rows .r:last-child { border-bottom: 0; }
.ic { width: 30px; height: 30px; border-radius: 8px; background: var(--card-2); display: grid; place-items: center; flex: none; color: var(--sage); font-size: 14px; }
.rows .k { font-weight: 600; } .rows .d { color: var(--text-2); font-size: 13.5px; }
button.btn { padding: 7px 13px; border-radius: 9px; border: 1px solid var(--line-2); background: #fff; color: var(--text); cursor: pointer; white-space: nowrap; }
button.btn:hover { border-color: var(--muted); } button.btn:disabled { opacity: .45; cursor: default; }
button.primary { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 650; } button.primary:hover { background: var(--brand-600); }
.side button.btn { background: var(--card); color: var(--text); }
.side button.primary { background: #fff; border-color: #fff; color: var(--panel); box-shadow: 0 1px 2px rgba(0,0,0,.15); } .side button.primary:hover { background: #e8f0fb; border-color: #e8f0fb; }
button.ghost { background: transparent; } button.danger { color: #b42318; border-color: #f3c1bc; background: #fff; }
button.sm { padding: 4px 9px; font-size: 12.5px; border-radius: 7px; }
input, select, textarea { background: #fff; border: 1px solid var(--line-2); border-radius: 9px; padding: 8px 10px; width: 100%; }
input:focus, select:focus, textarea:focus, button:focus-visible, .pm:focus-visible { outline: 2px solid var(--sage); outline-offset: 1px; }
.side input, .side select { background: rgba(255,255,255,.07); border-color: rgba(255,255,255,.14); color: #fff; } .side input::placeholder { color: #9fb4d3; }
.side input:focus { outline: 2px solid rgba(255,255,255,.35); outline-offset: 0; }
textarea { min-height: 84px; resize: vertical; }
label.f { display: block; font-size: 12.5px; color: var(--text-2); margin: 10px 0 4px; font-weight: 550; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; } .spread { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { text-align: left; color: var(--muted); font-weight: 550; font-size: 12px; text-transform: uppercase; letter-spacing: .6px; padding: 8px; border-bottom: 1px solid var(--line); }
td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
td input, td textarea { padding: 6px 8px; font-size: 13px; } td textarea { min-height: 40px; }
.err { color: var(--red); font-size: 13px; margin-top: 6px; min-height: 18px; }
.mono { font-family: var(--mono); font-size: 12px; }

/* home */
.hero { max-width: 980px; margin: 0 auto; padding: 36px 28px; }
.hero h1 { font-size: 28px; margin: 0 0 6px; } .hero p.lead { color: var(--text-2); margin: 0 0 22px; }
.hero { max-width: 760px; }
.spec { padding: 22px 24px; }
.spec label.f:first-child { margin-top: 0; font-size: 14px; color: var(--text); }
input.big { font-size: 17px; padding: 12px 14px; }
.matches .match { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px; margin-top: 6px; text-decoration: none; color: var(--text); font-size: 14px; }
.matches .match:hover { border-color: var(--sage); background: var(--ok-bg); }
.matches .code { font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.linkbtn { background: none; border: 0; padding: 0; margin-top: 14px; color: var(--sage); font-weight: 550; cursor: pointer; font-size: 13.5px; }
.linkbtn:hover { text-decoration: underline; }
#stepsBox textarea { margin-top: 10px; }
.examples { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 16px; }
a.chip.ex { text-decoration: none; background: #fff; padding: 5px 12px; font-size: 13px; color: var(--text-2); } a.chip.ex:hover { border-color: var(--sage); color: var(--sage); }

/* process editor */
.editor { display: grid; grid-template-columns: 1fr 300px; gap: 14px; }
.canvas { background: #f8fafc; border: 1px solid var(--line); border-radius: var(--radius); height: 560px; position: relative; overflow: hidden; }
.canvas .hint { position: absolute; left: 12px; bottom: 10px; font-size: 12px; color: var(--muted); pointer-events: none; }
.canvas .mode { position: absolute; left: 50%; top: 10px; transform: translateX(-50%); background: var(--sand-bg); color: var(--sand-ink); padding: 4px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 600; display: none; }
.canvas .mode.show { display: block; }
.toolbar { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; align-items: center; }
.toolbar .sep { width: 1px; height: 22px; background: var(--line-2); margin: 0 4px; }
svg.pm { width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; user-select: none; }
svg.pm.panning { cursor: grabbing; }
.pm-node { cursor: pointer; } .pm-node .shape { stroke-width: 1.5; transition: filter .15s; }
.pm-node.sel .shape { stroke: var(--brand) !important; stroke-width: 2.5; } .pm-node.src .shape { stroke: var(--sand) !important; stroke-width: 3; stroke-dasharray: 5 3; }
.pm-node.on .shape { filter: drop-shadow(0 0 8px rgba(31,95,191,.6)); stroke: var(--brand) !important; stroke-width: 2.5; }
.pm-node.bad .shape { stroke: var(--red) !important; stroke-width: 2.5; }
.t-agent .shape { fill: var(--sage-bg); stroke: #86ade0; } .pm-label { font-size: 13px; font-weight: 600; text-anchor: middle; fill: var(--sage-ink); pointer-events: none; }
.pm-owner { font-size: 11px; text-anchor: middle; fill: #4f6a8f; pointer-events: none; }
.t-human .shape { fill: var(--sand-bg); stroke: #c99a5b; } .t-human .pm-label { fill: var(--sand-ink); } .t-human .pm-owner { fill: #8a6232; }
.t-decision .shape { fill: #ece6f5; stroke: var(--lilac); } .t-decision .pm-label { fill: #3b2d5c; } .t-decision .pm-owner { fill: #6b5c8f; }
.t-start .shape, .t-end .shape { fill: #e6ebf2; stroke: #a3afbf; } .t-start .pm-label, .t-end .pm-label { fill: #25303f; }
.pm-lock { fill: #d0683c; }
.pm-edge { cursor: pointer; } .pm-edge .hit { stroke: transparent; stroke-width: 14; fill: none; } .pm-edge .line { stroke: #8796ab; stroke-width: 1.6; fill: none; }
.pm-edge.sel .line { stroke: var(--brand); stroke-width: 2.4; } .pm-elabel { font-size: 12px; fill: #4a5668; font-weight: 600; }
.inspector .empty { color: var(--muted); font-size: 13px; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); margin-top: 10px; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; border: 1px solid var(--line-2); vertical-align: -2px; margin-right: 5px; }
.tools-list label { display: flex; align-items: center; gap: 7px; font-size: 13px; padding: 2px 0; } .tools-list input { width: auto; }

/* checks, runs */
.check { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--line); } .check:last-child { border-bottom: 0; }
.dot { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 800; flex: none; margin-top: 1px; }
.dot.ok { background: var(--ok-bg); color: var(--sage); } .dot.no { background: var(--red-bg); color: var(--red); }
.log { font-size: 13px; max-height: 420px; overflow: auto; } .log div { padding: 5px 0; border-bottom: 1px dashed var(--line); }
.log .h { color: #9a6a1f; } .log .x { color: #b42318; } .log .a { color: #1b4f9c; }
.skill h3 { display: flex; justify-content: space-between; align-items: center; }
.skill ol { margin: 6px 0 10px 18px; padding: 0; color: var(--text-2); } .skill li { margin: 2px 0; }
.ask { background: var(--sand-bg); color: var(--sand-ink); border-radius: 10px; padding: 12px 14px; margin-top: 10px; }
.ask b { display: block; margin-bottom: 8px; } .ask button.btn { background: #fff8ec; color: var(--sand-ink); border-color: #d7b27a; }
.ask button.primary { background: var(--sage-2); color: #fff; border-color: var(--sage-2); }
#toast { position: fixed; right: 18px; bottom: 18px; background: var(--text); color: var(--bg); padding: 9px 14px; border-radius: 9px; font-size: 13.5px; opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 10; }
#toast.show { opacity: 1; }
.spin { display: inline-block; width: 13px; height: 13px; border: 2px solid var(--line-2); border-top-color: var(--sage); border-radius: 50%; animation: s .8s linear infinite; vertical-align: -2px; }
@keyframes s { to { transform: rotate(360deg); } }
@media (max-width: 1100px) { .editor { grid-template-columns: 1fr; } .g4 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 860px) { .app { grid-template-columns: 1fr; height: auto; } .side { max-height: 340px; } .g2, .g3, .g4 { grid-template-columns: 1fr; } }

/* modals */
.modal { position: fixed; inset: 0; background: rgba(11,42,85,.35); display: grid; place-items: center; z-index: 20; padding: 20px; }
.sheet { background: #fff; border-radius: 14px; padding: 20px 22px; width: min(620px, 100%); max-height: 90vh; overflow: auto; box-shadow: 0 20px 50px rgba(11,42,85,.25); }
.sheet h2 { margin: 0 0 8px; font-size: 18px; }
.sheet a.btn { text-decoration: none; display: inline-block; color: var(--text); padding: 7px 13px; border-radius: 9px; border: 1px solid var(--line-2); background: #fff; font-size: 14px; }
.sheet a.btn:hover { border-color: var(--muted); } .sheet a.btn.ghost { background: transparent; }
.sheet a.btn.primary { background: var(--brand); border-color: var(--brand); }
.sheet a.btn.primary { color: #fff; }
.divider { height: 1px; background: var(--line); margin: 18px 0; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

/* public results page */
.pub { max-width: 1100px; margin: 0 auto; padding: 30px 28px 50px; }
.pub .eyebrow { font-size: 12px; letter-spacing: 1.4px; text-transform: uppercase; color: var(--sage); font-weight: 650; }
.pub h1 { font-size: 34px; margin: 6px 0 4px; color: var(--brand); letter-spacing: -.6px; }
.pub-task { font-size: 18px; font-weight: 600; margin-bottom: 18px; }
.pub-grid { grid-template-columns: 1.3fr 1fr 0.8fr; }
.verdict { border-left: 4px solid var(--sage); } .verdict.t-s { border-left-color: var(--sand); } .verdict.t-a { border-left-color: var(--lilac); }
.vl { font-size: 22px; font-weight: 700; color: var(--brand); margin: 4px 0 6px; }
ul.plain { margin: 8px 0 0; padding: 0 0 0 18px; } ul.plain li { margin: 4px 0; font-size: 13.5px; }
.pub-cta { margin-top: 18px; display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; background: var(--ok-bg); border-color: #bcd3f2; }
@media (max-width: 900px) { .pub-grid { grid-template-columns: 1fr; } }
