#decision-tools { display:flex; gap:8px; flex-wrap:wrap; margin:8px 0; }
#decision-tools button,.decision-dialog button { color:var(--ink); background:var(--panel); border:1px solid var(--line); border-radius:12px; padding:10px 14px; min-height:44px; cursor:pointer; }
.decision-dialog { color:var(--ink); background:var(--surface); border:1px solid var(--line); border-radius:18px; width:min(520px,calc(100vw - 24px)); max-height:85dvh; padding:22px; overflow:auto; }
.decision-dialog::backdrop { background:#0008; }
.decision-dialog p { line-height:1.65; }
.decision-dialog form,.decision-dialog section { display:grid; gap:12px; margin:16px 0; }
.decision-dialog label { display:grid; gap:6px; }
.decision-dialog textarea,.decision-dialog select,.decision-dialog input { width:100%; padding:10px; color:var(--ink); background:var(--panel); border:1px solid var(--line); border-radius:8px; font:inherit; }
.decision-dialog small { color:var(--muted); }
.decision-dialog button:disabled { opacity:.5; cursor:wait; }
.decision-marker { cursor:pointer; fill:var(--accent); stroke:var(--ink); stroke-width:1; }
.decision-marker:focus { outline:2px solid var(--accent); }
#scenario-editor { font-size:12px; color:var(--muted); margin:8px 0; }
#scenario-input { width:100%; background:var(--panel); color:var(--ink); border:1px solid var(--line); padding:10px; border-radius:8px; }
#decision-tools small { flex-basis:100%; color:var(--muted); line-height:1.5; }
/* Keep the canvas primary; contextual content opens on demand. */
.page #bar,.page #summary { display:none !important; }
#decision-tools { position:relative; margin:0; min-height:0; justify-content:flex-end; z-index:12; }
#decision-tools > button:first-child,#decision-tools > small { display:none; }
#decision-tools > button:not([hidden]),#graph-filters { margin-bottom:6px; }
#graph-filters { position:relative; font-size:13px; }
#graph-filters > summary { cursor:pointer; padding:10px 14px; min-height:44px; }
#graph-filters .cats { position:absolute; right:0; top:100%; width:min(340px,calc(100vw - 32px)); max-height:60dvh; overflow:auto; padding:12px; background:var(--surface); border:1px solid var(--line); border-radius:14px; display:flex; flex-wrap:wrap; z-index:20; }
.page[data-state="idle"] #graph-filters { display:none; }
.page #panel-top { position:absolute; bottom:12px; left:12px; z-index:5; padding:0; }
#panel-top .status { display:none; }
#panel-top .generate { padding:10px 14px; font-size:11px; letter-spacing:0; box-shadow:none; }
.root-question { color:var(--ink); text-align:center; font-size:16px; font-weight:600; line-height:1.45; overflow-wrap:anywhere; display:-webkit-box; -webkit-line-clamp:3; -webkit-box-orient:vertical; overflow:hidden; }
#mock-badge { position:absolute; top:75px; left:24px; font-size:11px !important; z-index:2; }
.page[data-state="result"] #scenario-editor { display:none; }
@media(max-width:640px) { .page[data-state="result"] .panel { min-height:380px; flex:1; } #mock-badge { top:8px; left:auto; right:16px; } }

/* Graph controls share one bottom toolbar. */
.page #panel-top { justify-content:flex-start; align-items:center; gap:8px; flex-wrap:nowrap; }
#panel-top #graph-filters { margin:0; }
#panel-top #graph-filters > summary { border:1px solid var(--line); border-radius:22px; background:var(--surface); white-space:nowrap; }
#panel-top #graph-filters .cats { top:auto; bottom:calc(100% + 10px); right:0; width:min(340px,calc(100vw - 48px)); }
@media(max-width:640px) { #panel-top #graph-filters .cats { position:fixed; left:16px; right:16px; bottom:150px; width:auto; max-height:50dvh; } }

/* Inline category strip and top-right generation action. */
.page #panel-top { position:relative; inset:auto; width:100%; display:flex; justify-content:space-between; gap:12px; padding:0 0 10px; flex-wrap:nowrap; }
#panel-top #graph-filters { order:0; flex:1; min-width:0; overflow:hidden; }
#panel-top .generate { order:1; flex-shrink:0; margin-left:auto; }
#panel-top #graph-filters .cats { position:static; display:flex; flex-wrap:nowrap; width:100%; max-height:none; overflow-x:auto; padding:0; border:0; border-radius:0; background:transparent; gap:8px; }
#panel-top #graph-filters .chip { flex-shrink:0; }
@media(max-width:640px) { .page #panel-top { flex-wrap:wrap; } #panel-top .generate { order:0; } #panel-top #graph-filters { order:1; flex-basis:100%; } }
.decision-options button { text-align:left; padding:16px; }
.decision-options button:hover { background:var(--hover); border-color:var(--accent); }
#decision-next-action { display:flex; flex-wrap:wrap; align-items:center; justify-content:center; gap:10px; padding:10px 0; font-size:13px; }
#decision-next-action[hidden] { display:none; }
#decision-next-action button { color:var(--ink); background:var(--panel); border:1px solid var(--line); border-radius:20px; padding:10px 14px; min-height:44px; cursor:pointer; }
#decision-next-action button:first-of-type { border-color:var(--accent); }
.decision-dialog details { margin:8px 0; }
.decision-dialog details summary { cursor:pointer; min-height:44px; padding:10px 0; }
#history-sidebar { position:fixed; top:0; right:0; bottom:0; width:340px; max-width:calc(100vw - 24px); padding:22px; overflow-y:auto; background:var(--surface); color:var(--ink); border-left:1px solid var(--line); z-index:100; }
#history-sidebar[hidden] { display:none; }
.history-top { display:flex; align-items:center; justify-content:space-between; margin-bottom:20px; }
#history-sidebar button { background:var(--panel); color:var(--ink); border:1px solid var(--line); border-radius:10px; padding:10px 12px; min-height:44px; cursor:pointer; font:inherit; }
#history-sidebar small { display:block; font-size:12px; color:var(--muted); line-height:1.6; }
#history-sidebar .history-nav { display:grid; gap:8px; margin-bottom:16px; }
#history-sidebar .history-nav button { text-align:left; }
#history-sidebar button[aria-pressed="true"] { border-color:var(--accent); background:var(--hover); }
.history-content h2 { font-size:20px; margin:24px 0 16px; }
.history-content h3 { font-size:14px; margin-top:24px; }
.history-content p { font-size:14px; line-height:1.65; }
.history-content input { width:100%; background:var(--panel); color:var(--ink); border:1px solid var(--line); padding:12px; border-radius:10px; }
#history-sidebar .history-row { display:block; width:100%; text-align:left; margin:10px 0; }
.history-row strong { display:block; font-size:14px; margin-bottom:6px; }
.history-stats { display:grid; grid-template-columns:repeat(3,1fr); gap:8px; margin:20px 0; }
.history-stats strong { font-size:24px; }
.history-message { background:var(--panel); border-radius:12px; padding:14px; margin:16px 0; }
@media(min-width:1000px) { body.history-open .page { margin-right:340px; } }
@media(prefers-reduced-motion:no-preference) { #history-sidebar:not([hidden]) { animation:history-enter 180ms ease-out; } @keyframes history-enter { from { transform:translateX(24px); opacity:0; } to { transform:translateX(0); opacity:1; } } }
.action-question { fill:var(--muted); font-size:13px; font-weight:500; pointer-events:none; }
.action-node.action-alternative .lbl { font-size:13px; color:var(--muted); }
.action-node.action-alternative rect { opacity:.55; }
.action-node.action-alternative .dot { opacity:.55; }
.action-type { text-align:center; color:var(--accent); font-size:11px; font-weight:600; line-height:1.5; margin-bottom:4px; }
.node .lbl.action-title { border:1px solid var(--accent); border-radius:10px; background:var(--surface); padding:7px 10px; margin:0 8px; font-weight:600; }
.action-node.action-alternative .action-type { color:var(--muted); }
.action-node.action-alternative .lbl.action-title { border-color:var(--line); }
.action-node .dot { display:none; }
.node .lbl.action-title { border:0; background:transparent; padding:4px; }
#generate-undo { order:2; border:1px solid var(--line); color:var(--ink); background:var(--surface); border-radius:20px; padding:10px 14px; min-height:44px; cursor:pointer; }
#generate-undo:disabled { opacity:.4; cursor:default; }
.decision-dialog input[type="checkbox"] { width:auto; margin-right:8px; }

.node-commit-button { font:500 12px/1.4 Arial,sans-serif; color:var(--muted); background:var(--surface); border:1px solid var(--line); border-radius:7px; padding:5px 9px; min-height:32px; cursor:pointer; white-space:nowrap; margin-top:4px; }
.node-commit-button:hover,.node-commit-button:focus-visible { color:var(--ink); border-color:var(--accent); }
@media(pointer:coarse) { .node-commit-button { min-height:44px; margin-top:0; } }/* Quiet conversation list, matching the familiar chat sidebar pattern. */
#history-sidebar { padding:20px 12px; background:var(--panel); }
#history-sidebar .history-top { padding:0 10px; margin-bottom:18px; }
#history-sidebar .history-top strong { font-size:21px; }
#history-sidebar .history-top button { font-size:26px; }
#history-sidebar button { border:0; background:transparent; }
#history-sidebar .history-nav { gap:2px; margin-bottom:18px; }
#history-sidebar .history-nav button { padding:10px 12px; font-size:14px; }
#history-sidebar button:hover,#history-sidebar .history-row[aria-current="true"] { background:var(--hover); }
#history-sidebar .history-nav button[aria-pressed="true"] { background:transparent; }
#history-sidebar .history-content input { background:transparent; font-size:13px; padding:10px 12px; }
#history-sidebar .history-list h3 { color:var(--muted); font-size:12px; font-weight:500; margin:24px 12px 8px; }
#history-sidebar .history-list .history-row { margin:2px 0; padding:10px 12px; min-height:42px; font-size:14px; font-weight:400; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; border-radius:10px; }
/* Conversation navigation opens from the left. */
#history-sidebar { left:0; right:auto; border-left:0; border-right:1px solid var(--line); }
@media(min-width:1000px) { body.history-open .page { margin-right:0; margin-left:340px; } }
@keyframes history-enter { from { transform:translateX(-24px); opacity:0; } to { transform:translateX(0); opacity:1; } }
/* Left navigation shell with fixed controls and a scrolling conversation list. */
#history-toggle { border:0; background:transparent; color:var(--ink); font-size:20px; cursor:pointer; min-width:44px; min-height:44px; margin-right:10px; }
header > .brand { margin-right:auto; }
#history-sidebar:not([hidden]) { display:flex; flex-direction:column; width:300px; padding:18px 10px 12px; background:var(--surface); overflow:hidden; }
#history-sidebar .history-top { flex-shrink:0; gap:6px; margin-bottom:20px; }
#history-sidebar .history-top strong { margin-right:auto; font-size:23px; letter-spacing:-.04em; }
#history-sidebar .history-top button { padding:4px 8px; min-width:36px; color:var(--muted); }
#history-sidebar .history-nav { flex-shrink:0; }
#history-sidebar .history-nav button { min-height:48px; font-size:15px; border-radius:12px; }
#history-sidebar .history-nav button:first-child { background:var(--hover); }
#history-sidebar .history-content { flex:1; min-height:0; overflow-y:auto; scrollbar-width:thin; }
#history-sidebar .history-list h3 { margin-top:28px; }
#history-sidebar .history-list .history-row { min-height:44px; line-height:24px; }
.conversation-icon { display:inline-block; width:24px; font-size:18px; color:var(--muted); }
#history-sidebar .history-footer { flex-shrink:0; margin-top:12px; border-top:1px solid var(--line); border-radius:0; text-align:left; font-size:12px; color:var(--muted); }
@media(min-width:1000px) { body.history-open .page { margin-left:300px; margin-right:0; } }
