/* Ask Compass Studio
   Layout: fixed top bar, procedure sidebar (a drawer on small screens),
   and a single working column. Shares the homepage palette and type. */
:root {
  --navy: #10284C; --deep: #173F73; --blue: #2F6FE0; --blue-soft: #E7F0FD;
  --gold: #F4B544; --gold-deep: #B97A0E; --gold-soft: #FDF3DD;
  --bg: #FCFCFA; --bg-blue: #F1F6FC; --surface: #FFFFFF;
  --ink: #14243B; --ink-2: #5D6B80; --ink-3: #8592A6; --line: #E4EAF2; --line-strong: #CFD9E6;
  --success: #169B62; --success-soft: #E3F4EC; --warning: #B45F06; --warning-soft: #FDF0DD; --danger: #C2362B; --danger-soft: #FCE8E6;
  --on-navy: #F3F6FB;
  --font: "Geist", "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "Geist Mono", ui-monospace, Menlo, Consolas, monospace;
  --top: 60px; --side: 272px;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15.5px/1.55 var(--font); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { margin: 0; letter-spacing: -.02em; text-wrap: balance; }
p { margin: 0; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--navy); color: var(--on-navy); padding: 8px 12px; border-radius: 8px; }
.skip:focus { top: 10px; }
.muted { color: var(--ink-2); }
.small { font-size: 13px; }
.eyebrow, .mini-label { font-family: var(--mono); font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.eyebrow { color: var(--deep); }
.mini-label { margin-bottom: 8px; display: block; }
.text-link { color: var(--blue); font-weight: 600; text-decoration: none; }
.text-link:hover { text-decoration: underline; }
.h3 { font-size: 17px; margin-bottom: 12px; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: 9px; border: 1px solid transparent; font-weight: 600; font-size: 14.5px; cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--navy); color: var(--on-navy); }
.btn-primary:hover:not(:disabled) { background: var(--deep); }
.btn-quiet { background: var(--surface); border-color: var(--line-strong); }
.btn-quiet:hover:not(:disabled) { border-color: var(--deep); }
.btn-danger { background: var(--surface); border-color: #E7B3AE; color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); }
.text-btn { border: 0; background: none; padding: 4px 0; color: var(--blue); font-weight: 600; font-size: 14px; cursor: pointer; }
.text-btn:hover { text-decoration: underline; }
.text-btn.danger { color: var(--danger); }
.icon-btn { width: 34px; height: 34px; flex: none; border: 1px solid var(--line-strong); background: var(--surface); border-radius: 8px; cursor: pointer; font-size: 18px; line-height: 1; color: var(--ink-2); }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.pill { display: inline-block; font-family: var(--mono); font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--bg-blue); color: var(--deep); white-space: nowrap; }
.pill-amber { background: var(--warning-soft); color: var(--warning); }
.pill-green { background: var(--success-soft); color: var(--success); }
.count { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--gold); color: var(--navy); font-size: 11px; font-weight: 700; }

/* top bar */
.top { position: sticky; top: 0; z-index: 30; height: calc(var(--top) + env(safe-area-inset-top, 0px)); padding: env(safe-area-inset-top, 0px) max(16px, env(safe-area-inset-right, 0px)) 0 max(16px, env(safe-area-inset-left, 0px)); display: flex; align-items: center; gap: 16px; background: rgba(252, 252, 250, .92); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; font-weight: 650; letter-spacing: -.03em; color: var(--navy); white-space: nowrap; }
.brand svg, .brand img { width: 30px; height: 30px; object-fit: contain; }
.brand em { font-style: normal; font-weight: 500; color: var(--ink-2); }
.search { flex: 1; min-width: 0; max-width: 520px; display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); margin-left: 12px; }
.search:focus-within { border-color: var(--blue); }
.search svg { width: 18px; height: 18px; fill: none; stroke: var(--ink-3); stroke-width: 1.8; stroke-linecap: round; flex: none; }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.bell { position: relative; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; color: var(--ink-2); }
.bell:hover { background: var(--bg-blue); color: var(--ink); }
.bell svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linejoin: round; }
.bell .count { position: absolute; top: 3px; right: 2px; }
.role { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); }
.role { flex-direction: row; }
.role select { width: auto; height: 36px; border: 1px solid var(--line-strong); border-radius: 8px; padding: 0 8px; background: var(--surface); font-weight: 600; color: var(--ink); }
.drawer-btn { display: none; width: 40px; height: 40px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); position: relative; cursor: pointer; flex: none; }
.drawer-btn span { position: absolute; left: 11px; right: 11px; height: 1.5px; background: var(--ink); }
.drawer-btn span:nth-child(1) { top: 13px; } .drawer-btn span:nth-child(2) { top: 19px; } .drawer-btn span:nth-child(3) { top: 25px; }

/* layout */
.layout { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: calc(100vh - var(--top)); }
.side { position: sticky; top: calc(var(--top) + env(safe-area-inset-top, 0px)); height: calc(100vh - var(--top) - env(safe-area-inset-top, 0px)); overflow-y: auto; border-right: 1px solid var(--line); background: var(--bg-blue); padding: 16px 12px max(16px, env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px)); display: flex; flex-direction: column; gap: 16px; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-nav a, .side-proc { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; border-radius: 8px; text-decoration: none; font-size: 14.5px; color: var(--ink-2); }
.side-nav a { font-weight: 600; }
.side-nav a:hover, .side-proc:hover { background: var(--surface); color: var(--ink); }
.side-nav a.is-active, .side-proc.is-active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(16, 40, 76, .06); }
.side-folder { font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); padding: 12px 10px 4px; }
.dot-draft { width: 7px; height: 7px; border-radius: 50%; background: var(--gold); flex: none; }
.side-foot { margin-top: auto; padding: 12px 10px 0; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; font-size: 12.5px; color: var(--ink-3); }
.scrim { display: none; }
main { padding: 28px max(20px, env(safe-area-inset-right, 0px)) 80px 32px; max-width: 1080px; width: 100%; outline: none; display: flex; flex-direction: column; gap: 20px; }

/* page heads, tabs */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; }
.page-head h1 { font-size: clamp(26px, 3vw, 34px); line-height: 1.15; margin-top: 4px; }
.proc-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 8px; font-size: 13.5px; color: var(--ink-2); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs a { padding: 10px 12px; text-decoration: none; font-weight: 600; font-size: 14.5px; color: var(--ink-2); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--gold); }

/* library */
.folder { display: flex; flex-direction: column; gap: 12px; }
.folder-title { font-size: 15px; display: flex; align-items: center; gap: 8px; }
.folder-title span { font-family: var(--mono); font-size: 12px; color: var(--ink-3); font-weight: 400; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.card { display: flex; flex-direction: column; gap: 6px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); text-decoration: none; transition: border-color .15s, box-shadow .15s; }
.card:hover { border-color: var(--deep); box-shadow: 0 6px 18px rgba(16, 40, 76, .07); }
.card-title { font-weight: 600; }
.card-sum { font-size: 14px; color: var(--ink-2); }
.card-meta { display: flex; flex-wrap: wrap; gap: 6px 12px; margin-top: 4px; font-size: 12.5px; color: var(--ink-3); }
.feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.feed li { display: flex; flex-direction: column; gap: 2px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.feed li.is-unread { padding-left: 12px; border-left: 3px solid var(--gold); }
.feed a { text-decoration: none; font-weight: 600; }
.feed a:hover { color: var(--blue); }
.results { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.results a { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); text-decoration: none; }
.results a:hover { border-color: var(--deep); }
.r-type { font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
mark { background: var(--gold-soft); color: inherit; border-radius: 3px; padding: 0 2px; }
.empty { padding: 32px; border: 1px dashed var(--line-strong); border-radius: 14px; background: var(--surface); display: flex; flex-direction: column; align-items: flex-start; gap: 10px; max-width: 640px; }
.empty h2 { font-size: 19px; }
.empty p { color: var(--ink-2); }

/* run */
.crumbs { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 4px; font-size: 13.5px; }
.crumbs li { display: flex; align-items: center; gap: 4px; }
.crumbs li + li::before { content: "›"; color: var(--ink-3); margin-right: 2px; }
.crumbs button { border: 0; background: none; padding: 0; cursor: pointer; color: var(--ink-2); max-width: 15rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crumbs button:hover { color: var(--blue); text-decoration: underline; }
.crumbs b { max-width: 18rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crumb-choice { font-size: 12px; background: var(--gold-soft); color: var(--gold-deep); padding: 1px 6px; border-radius: 5px; font-weight: 600; }
.sub-flow { font-size: 14px; padding: 10px 12px; border-radius: 10px; background: var(--blue-soft); color: var(--deep); }
.step { position: relative; display: flex; flex-direction: column; gap: 14px; padding: 24px 24px 24px 28px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: 0 8px 28px rgba(16, 40, 76, .06); max-width: 760px; }
.step::before { content: ""; position: absolute; left: 0; top: 18px; bottom: 18px; width: 3px; border-radius: 0 3px 3px 0; background: var(--deep); }
.step-decision::before { background: var(--gold); }
.step-note::before { background: var(--ink-3); }
.step-link::before { background: var(--blue); }
.step-end::before { background: var(--success); }
.step-type { font-family: var(--mono); font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.step h2 { font-size: clamp(21px, 2.4vw, 26px); line-height: 1.25; outline: none; }
.step-body { color: var(--ink-2); font-size: 16px; max-width: 62ch; }
.exception { font-size: 14.5px; padding: 10px 12px; border-radius: 10px; background: var(--warning-soft); color: #6B3A04; }
.checks { display: flex; flex-direction: column; gap: 8px; }
.checks label { flex-direction: row; align-items: center; gap: 10px; cursor: pointer; font-weight: 400; font-size: 15px; }
.checks input { width: 18px; height: 18px; accent-color: var(--deep); }
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px; }
.choice { padding: 14px 16px; border-radius: 12px; border: 1.5px solid var(--line-strong); background: var(--surface); text-align: left; font-weight: 600; cursor: pointer; }
.choice:hover { border-color: var(--blue); background: var(--blue-soft); }
.done-box { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 14px 16px; border-radius: 12px; background: var(--success-soft); color: #0E6A43; font-weight: 600; }
.warn { padding: 12px; border-radius: 10px; background: var(--danger-soft); color: var(--danger); font-size: 14px; }
.source { font-family: var(--mono); font-size: 12px; color: var(--deep); padding-top: 12px; border-top: 1px solid var(--line); }
.run-controls { max-width: 760px; }
.flag-btn { margin-left: auto; }
.flag-form { display: flex; flex-direction: column; gap: 8px; max-width: 760px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.flag-form[hidden] { display: none; }
textarea, input:not([type="checkbox"]):not([type="search"]), select { width: 100%; border: 1px solid var(--line-strong); border-radius: 8px; padding: 9px 11px; background: var(--surface); }
textarea:focus, input:focus, select:focus { border-color: var(--blue); outline: 0; box-shadow: 0 0 0 3px var(--blue-soft); }
label { display: flex; flex-direction: column; gap: 5px; font-size: 13.5px; font-weight: 600; color: var(--ink); }

/* map */
.map-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: radial-gradient(circle at 1px 1px, var(--line) 1px, transparent 0) 0 0 / 18px 18px, var(--surface); padding: 8px; }
.map { display: block; height: auto; max-width: none; margin: 0 auto; }
.m-edge { fill: none; stroke: var(--ink-3); stroke-width: 1.4; }
.m-arrow { fill: var(--ink-3); }
.m-lbl rect { fill: var(--surface); stroke: var(--line-strong); }
.m-lbl text { font: 500 11px var(--font); fill: var(--ink-2); }
.m-node rect { fill: var(--surface); stroke: var(--line-strong); stroke-width: 1.4; }
.m-node .m-kind { font: 500 9.5px var(--mono); letter-spacing: .08em; fill: var(--ink-3); }
.m-node .m-title { font: 600 13px var(--font); fill: var(--ink); }
.m-decision rect { fill: var(--gold-soft); stroke: var(--gold-deep); }
.m-decision .m-kind { fill: var(--gold-deep); }
.m-link rect { fill: var(--blue-soft); stroke: var(--blue); }
.m-end rect { fill: var(--success-soft); stroke: #8FCDB0; }
.m-note rect { stroke-dasharray: 4 3; }
.m-node.is-start rect { stroke: var(--navy); stroke-width: 2; }
.m-node[tabindex] { cursor: pointer; }
.m-node[tabindex]:hover rect, .m-node[tabindex]:focus-visible rect { stroke: var(--blue); stroke-width: 2.4; }
.m-node:focus-visible { outline: none; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 13px; color: var(--ink-2); }
.lg::before { content: ""; display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; border: 1.4px solid var(--line-strong); background: var(--surface); }
.lg-decision::before { background: var(--gold-soft); border-color: var(--gold-deep); }
.lg-link::before { background: var(--blue-soft); border-color: var(--blue); }
.lg-end::before { background: var(--success-soft); border-color: #8FCDB0; border-radius: 6px; }
.lg-note::before { border-style: dashed; }

/* editor */
.banner { padding: 12px 14px; border-radius: 10px; background: var(--blue-soft); color: var(--deep); font-size: 14.5px; }
.banner-amber { background: var(--warning-soft); color: var(--warning); }
.banner-red { background: var(--danger-soft); color: var(--danger); }
.edit-bar { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.edit-bar .wide { grid-column: span 3; }
.edit-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 380px); gap: 20px; align-items: start; }
.edit-steps { display: flex; flex-direction: column; gap: 8px; align-items: stretch; }
.edit-steps > .btn { align-self: flex-start; }
.ed-step { border: 1px solid var(--line); border-left: 3px solid var(--deep); border-radius: 10px; background: var(--surface); }
.ed-decision { border-left-color: var(--gold); }
.ed-note { border-left-color: var(--ink-3); }
.ed-link { border-left-color: var(--blue); }
.ed-end { border-left-color: var(--success); }
.ed-step summary { display: flex; align-items: center; gap: 10px; padding: 12px 14px; cursor: pointer; list-style: none; }
.ed-step summary::-webkit-details-marker { display: none; }
.ed-step summary::after { content: ""; margin-left: auto; width: 7px; height: 7px; border-right: 1.5px solid var(--ink-3); border-bottom: 1.5px solid var(--ink-3); transform: rotate(45deg); flex: none; }
.ed-step[open] summary::after { transform: rotate(225deg); }
.ed-kind { font-family: var(--mono); font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); flex: none; width: 74px; }
.ed-title { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ed-body { display: flex; flex-direction: column; gap: 12px; padding: 4px 14px 16px; align-items: stretch; }
.ed-body > .text-btn { align-self: flex-start; }
.ed-row { display: flex; gap: 10px; }
.ed-row .grow { flex: 1; }
.answers { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.answer-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 8px; width: 100%; }
.edit-side { display: flex; flex-direction: column; gap: 12px; position: sticky; top: calc(var(--top) + 16px); }
.panel { padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); display: flex; flex-direction: column; gap: 10px; }
.issues { margin: 0; padding-left: 18px; color: var(--danger); font-size: 14px; display: flex; flex-direction: column; gap: 4px; }
.ok { color: var(--success); font-size: 14px; font-weight: 600; }
.edit-side .map-scroll { max-height: 420px; overflow: auto; }

/* history, review */
.versions { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.versions li { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.changes { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.ch { padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); display: flex; flex-direction: column; gap: 6px; }
.ch .pill { align-self: flex-start; }
.ch-added { border-left: 3px solid var(--success); }
.ch-added .pill { background: var(--success-soft); color: var(--success); }
.ch-removed { border-left: 3px solid var(--danger); }
.ch-removed .pill { background: var(--danger-soft); color: var(--danger); }
.ch-changed { border-left: 3px solid var(--gold); }
.ch-changed .pill { background: var(--warning-soft); color: var(--warning); }
.cmp { display: grid; grid-template-columns: 140px minmax(0, 1fr) minmax(0, 1fr); gap: 8px; font-size: 14px; align-items: start; }
.cmp-f { font-family: var(--mono); font-size: 11.5px; color: var(--ink-3); padding-top: 3px; }
.cmp del { text-decoration: line-through; color: var(--danger); background: var(--danger-soft); padding: 4px 8px; border-radius: 6px; }
.cmp ins { text-decoration: none; color: #0E6A43; background: var(--success-soft); padding: 4px 8px; border-radius: 6px; }
.compare { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.compare .map-scroll { max-height: 520px; overflow: auto; }
.decide { max-width: 760px; }

/* insights */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.stats div { padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); display: flex; flex-direction: column; }
.stats b { font-size: 28px; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.stats span { font-size: 13px; color: var(--ink-2); }
.bars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.bars li { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) 36px; gap: 12px; align-items: center; font-size: 14px; }
.bar { height: 8px; border-radius: 99px; background: var(--bg-blue); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--gold); border-radius: 99px; }
.bars b { text-align: right; font-variant-numeric: tabular-nums; }
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 640px; }
.table th { text-align: left; font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); font-weight: 500; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.table tr:last-child td { border-bottom: 0; }
.table a { font-weight: 600; text-decoration: none; }
.table a:hover { color: var(--blue); }
.mini-bar { display: inline-block; width: 60px; height: 6px; border-radius: 99px; background: var(--bg-blue); margin-right: 8px; vertical-align: middle; overflow: hidden; }
.mini-bar i { display: block; height: 100%; background: var(--deep); }

.toast { position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 60; background: var(--navy); color: var(--on-navy); padding: 12px 16px; border-radius: 10px; font-size: 14.5px; box-shadow: 0 12px 30px rgba(16, 40, 76, .25); max-width: calc(100vw - 32px); }

/* responsive */
@media (max-width: 1100px) {
  .edit-grid { grid-template-columns: minmax(0, 1fr); }
  .edit-side { position: static; }
  .compare { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .drawer-btn { display: block; }
  .side { position: fixed; left: 0; top: calc(var(--top) + env(safe-area-inset-top, 0px)); bottom: 0; width: min(300px, 86vw); height: auto; z-index: 40; transform: translateX(-102%); transition: transform .25s ease; box-shadow: 10px 0 40px rgba(16, 40, 76, .12); }
  .drawer-open .side { transform: none; }
  .drawer-open .scrim { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(16, 40, 76, .25); }
  main { padding: 20px max(16px, env(safe-area-inset-right, 0px)) 72px max(16px, env(safe-area-inset-left, 0px)); }
  .edit-bar { grid-template-columns: 1fr 1fr; }
  .edit-bar .wide { grid-column: 1 / -1; }
  .stats { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .top { gap: 10px; }
  .brand span { display: none; }
  .search { margin-left: 0; }
  .role span { display: none; }
  .step { padding: 20px 18px 20px 22px; }
  .edit-bar { grid-template-columns: 1fr; }
  .ed-row { flex-direction: column; }
  .answer-row { grid-template-columns: 1fr auto; }
  .answer-row select { grid-column: 1; }
  .cmp { grid-template-columns: 1fr; }
  .flag-btn { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition-duration: .001ms !important; animation-duration: .001ms !important; } }

/* ── Guided run: one question at a time ── */
.q-wrap { display: flex; flex-direction: column; gap: 14px; max-width: 720px; }
.q-progress { display: flex; align-items: center; gap: 12px; font: 500 12.5px var(--mono); color: var(--ink-2); }
.q-progress i { flex: 1; height: 6px; border-radius: 3px; background: #e6edf7; overflow: hidden; }
.q-progress b { display: block; height: 100%; border-radius: 3px; background: linear-gradient(90deg, #2563EB, #0E8A80); transition: width .5s cubic-bezier(.16, 1, .3, 1); }
.qcard { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; padding: 28px 30px 26px; border-radius: 22px; background: #fff; border: 1px solid #e3e9f3; box-shadow: 0 24px 50px rgba(16, 40, 76, .09); animation: qIn .45s cubic-bezier(.16, 1, .3, 1) both; }
@keyframes qIn { from { opacity: 0; transform: translateX(28px); } }
.q-badge { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px; font-size: 13px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; }
.q-badge::before { content: ""; width: 8px; height: 8px; background: currentColor; transform: rotate(45deg); }
.q-decision { background: #fff3cf; color: #9a5a00; border: 1px solid #f3d27a; }
.q-action { background: #e3f0ff; color: #1d4fa8; border: 1px solid #b9d3f7; }
.q-note { background: #eef1f6; color: #4a5670; border: 1px solid #d6dce7; }
.q-link { background: #efe9ff; color: #5b32c9; border: 1px solid #d4c6fa; }
.q-end { background: #e3f4ec; color: #0e7a4c; border: 1px solid #b8e2cc; }
.q-title { font-size: clamp(21px, 2.4vw, 26px); font-weight: 750; line-height: 1.3; letter-spacing: -.015em; color: #0f1d36; outline: none; }
.q-body { margin: -4px 0 0; color: var(--ink-2); font-size: 16px; line-height: 1.6; max-width: 62ch; }
.q-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.q-chip { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; background: #eaf3ff; border: 1px solid #c6dcfa; font-size: 14.5px; font-weight: 600; color: #2563EB; }
.q-chip svg, .q-flow svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.q-sel { margin: 4px 0 -4px; font-size: 12.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: #9aa6bd; }
.q-opts { align-self: stretch; display: flex; flex-direction: column; gap: 10px; }
.q-opt { width: 100%; padding: 17px 22px; border-radius: 14px; background: #f3f6fd; border: 1.5px solid #e1e7f3; text-align: left; font: 500 17px var(--font); color: #3a4762; cursor: pointer; transition: background .2s, border-color .2s, box-shadow .2s, transform .15s; }
.q-opt:hover { background: #e9f1fe; border-color: #9fc0f0; color: var(--navy); }
.q-opt:active { transform: scale(.99); }
.q-opt:focus-visible { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(47, 111, 224, .18); outline: none; }
.q-check { display: flex; flex-direction: row; align-items: center; gap: 14px; padding: 15px 18px; border-radius: 14px; background: #f3f6fd; border: 1.5px solid #e1e7f3; font-weight: 500; font-size: 16px; color: #3a4762; cursor: pointer; transition: background .2s, border-color .2s; }
.q-check input { width: 20px; height: 20px; accent-color: var(--success); flex: none; }
.q-check.is-on { background: #e8f6ef; border-color: #a9dcc1; color: var(--navy); }
.q-check:focus-within { border-color: var(--blue); }
.q-foot { align-self: stretch; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 6px; }
.q-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 46px; padding: 0 20px; border-radius: 999px; border: 1.5px solid #dfe5f0; background: #fff; font: 600 15px var(--font); color: #4a5670; cursor: pointer; transition: border-color .2s, color .2s; }
.q-btn:hover { border-color: var(--deep); color: var(--navy); }
.q-flow { border: 2px solid #b49cf0; color: #5b32c9; }
.q-flow:hover { border-color: #7c5cff; color: #4a22b8; background: #f6f3ff; }
.q-next { margin-left: auto; display: inline-flex; align-items: center; min-height: 46px; padding: 0 22px; border-radius: 999px; border: 1px solid rgba(185, 122, 14, .35); background: linear-gradient(180deg, #F5C35E, #EBAA3C); font: 700 15px var(--font); color: var(--navy); cursor: pointer; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5), 0 8px 20px rgba(212, 150, 40, .28); }
.q-next:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.q-done { align-self: stretch; display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-radius: 14px; background: var(--success-soft); color: #0E6A43; font-weight: 600; }
.q-done span { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--success); color: #fff; font-size: 20px; flex: none; }
.q-path { font-size: 14px; color: var(--ink-2); }
.q-path summary { cursor: pointer; font-weight: 600; color: var(--deep); }
.q-path .crumbs { margin-top: 10px; }
.run-controls { gap: 18px; }

/* SOP sheet */
.flow-sheet { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 24px; background: rgba(10, 20, 45, .45); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); opacity: 0; transition: opacity .25s; }
.flow-sheet.is-open { opacity: 1; }
.flow-card { width: min(1000px, 100%); max-height: calc(100vh - 48px); overflow: auto; padding: 22px 24px; border-radius: 20px; background: #fff; box-shadow: 0 40px 90px rgba(10, 20, 45, .35); transform: translateY(14px); transition: transform .35s cubic-bezier(.16, 1, .3, 1); }
.flow-sheet.is-open .flow-card { transform: none; }
.flow-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.flow-head h2 { font-size: 22px; }
.m-node.is-done rect { stroke: var(--success) !important; stroke-width: 2 !important; }
.m-node.is-current rect { stroke: var(--gold) !important; stroke-width: 3 !important; filter: drop-shadow(0 0 8px rgba(244, 181, 68, .6)); }
.lg-cur::before { background: var(--gold) !important; } .lg-done::before { background: var(--success) !important; }

@media (max-width: 640px) {
  .qcard { padding: 22px 18px 20px; border-radius: 18px; }
  .q-next { margin-left: 0; width: 100%; justify-content: center; }
  .q-opt { padding: 15px 18px; font-size: 16px; }
  .flow-sheet { padding: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .qcard { animation: none; }
  .flow-sheet, .flow-card, .q-progress b { transition: none; }
}
