/* Workspace: three columns on the Swiss grid. Sessions | terminal | checkpoint. */
body.workspace { height:100vh; display:flex; flex-direction:column; overflow:hidden; }
.panes { --left:280px; --right:500px; flex:1; min-height:0; display:grid;
  grid-template-columns:var(--left) 7px minmax(360px, 1fr) 7px var(--right); }
/* Drag handles between the columns: a thin rule that thickens and turns blue under the pointer. */
.gutter { position:relative; cursor:col-resize; background:var(--paper); touch-action:none; }
.gutter::before { content:""; position:absolute; top:0; bottom:0; left:3px; width:1px; background:var(--line); }
.gutter:hover::before, .gutter.drag::before { left:2px; width:3px; background:var(--accent); }
body.dragging { cursor:col-resize; user-select:none; }
body.dragging iframe, body.dragging #term-wrap { pointer-events:none; }   /* keep the drag when crossing them */
.pane { min-height:0; display:flex; flex-direction:column; padding:20px 24px; background:var(--paper); }
.sessions { overflow:auto; }
/* The right column: live flow on top (scrolls on its own), the checkpoint below, a draggable rule between.
   The split moves only when you drag it, so the column stays still while steps come and go. */
.checkpoint { --flow:45%; padding:0; overflow:hidden; }
.flow-part { flex:0 0 var(--flow); min-height:120px; overflow-y:auto; overflow-x:hidden; padding:20px 24px 4px;
  scrollbar-gutter:stable; }   /* room for the scrollbar always, so its coming and going cannot resize the map */
.gutter-h { flex:none; height:7px; position:relative; cursor:row-resize; touch-action:none; }
.gutter-h::before { content:""; position:absolute; left:0; right:0; top:3px; height:1px; background:var(--line); }
.gutter-h:hover::before, .gutter-h.drag::before { top:2px; height:3px; background:var(--accent); }
body.dragging-h { cursor:row-resize; user-select:none; }
body.dragging-h iframe { pointer-events:none; }
.decide-part { flex:1; min-height:200px; display:flex; flex-direction:column; padding:14px 24px 0; }
.decide-part .pane-label { margin-right:var(--sbw, 0px); }   /* line up with the scrolled content around it */
.decide-part iframe { flex:1; margin:0 -24px; width:calc(100% + 48px); min-height:0; }

/* Live flow map */
.live svg { width:100%; height:auto; display:block; overflow:visible; margin-bottom:12px; }
.live .edge { fill:none; stroke:#0A0A0A; stroke-width:1; }
.live .edge.out { stroke-width:1.5; }
.live .edge.wait { stroke-dasharray:4 4; animation:dash 0.8s linear infinite; }
@keyframes dash { to { stroke-dashoffset:-8; } }
.live .node { fill:#fff; stroke:#0A0A0A; stroke-width:1; }
.live .hub { fill:var(--accent); }
.live .hub-label { fill:var(--ink); font:600 12px var(--mono); letter-spacing:2px; text-anchor:middle; }
.live .n-name { font:600 13px var(--sans); fill:var(--ink); }
.live .n-name.small { font:400 12px var(--mono); }
.live .n-meta { font:400 11px var(--mono); fill:var(--muted); }
.live .pulse { animation:pulse 0.9s ease-in-out infinite alternate; }
@keyframes pulse { from { opacity:1; } to { opacity:0.25; } }
.live-list { list-style:none; margin:10px 0 18px; padding:0; border-top:1px solid var(--line); }
.live-list li { display:grid; grid-template-columns:10px 1fr auto; column-gap:10px; padding:7px 0; border-bottom:1px solid var(--soft);
  font:400 12px/1.4 var(--mono); }
.live-list .sq { width:8px; height:8px; margin-top:4px; }
.live-list .what { color:var(--ink); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.live-list .when { color:var(--muted); }
.live-list .where { grid-column:2 / 4; color:var(--muted); }
.live-list .none { display:block; color:var(--muted); }
.pane-label { font:400 12px/1 var(--mono); letter-spacing:2px; text-transform:uppercase; border-bottom:1px solid var(--line);
  padding-bottom:10px; margin:0 0 14px; display:flex; align-items:center; gap:10px; }
.pane-label .num { display:inline-flex; width:20px; height:20px; align-items:center; justify-content:center;
  background:var(--accent); color:#fff; font-weight:600; letter-spacing:0; }
.pane-label .cwd { color:var(--muted); letter-spacing:0.5px; text-transform:none; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

.session-list { list-style:none; margin:0 0 28px; padding:0; }
.session-list li a { display:grid; grid-template-columns:14px 1fr; column-gap:10px; padding:12px 8px; text-decoration:none;
  border-bottom:1px solid var(--soft); }
.session-list li.on a { background:var(--ink); color:#fff; }
.session-list li.on .s-meta { color:#D6D6D6; }
.session-list .dot { margin-top:7px; }
.s-name { font:600 17px/1.3 var(--sans); }
.s-meta { grid-column:2; font:400 12px/1.4 var(--mono); color:var(--muted); }
.session-list .none { color:var(--muted); font-size:15px; padding:8px 0; }

.new-session { display:flex; flex-direction:column; gap:12px; margin-top:auto; }
.new-session label { display:flex; flex-direction:column; gap:6px; font:400 12px/1 var(--mono); letter-spacing:1.2px; text-transform:uppercase; }
.new-session input:not([type=radio]) { font:400 15px/1.3 var(--sans); padding:9px 10px; border:1px solid var(--line); background:#fff;
  border-radius:0; letter-spacing:0; text-transform:none; }
.new-session fieldset { border:none; padding:0; margin:0; display:flex; gap:16px; }
.new-session .radio { flex-direction:row; align-items:center; gap:6px; }
.new-session .btn { justify-content:center; }

.terminal { padding:20px 24px 16px; }
.term-head { display:flex; justify-content:space-between; align-items:flex-start; gap:12px; }
.term-head .pane-label { flex:1; min-width:0; }
#term-wrap { flex:1; min-height:0; background:#000; padding:10px 0 4px 12px; border:1px solid var(--line); display:flex; }
#term { flex:1; min-width:0; min-height:0; overflow:hidden; }
#term .xterm-viewport { background:#000 !important; scrollbar-width:none; }
#term .xterm-viewport::-webkit-scrollbar { display:none; }
.term-empty { max-width:36em; }
.term-empty .big { font:600 34px/1.1 var(--sans); letter-spacing:-1px; margin:24px 0 16px; }
.term-empty p { color:var(--muted); }

.checkpoint iframe { flex:1; border:none; background:var(--paper); }


/* Risk overview: four kinds, counted per call; a kind turns black once it has happened */
.risk-bar { display:grid; grid-template-columns:repeat(4, 1fr); border:1px solid var(--line); margin-bottom:14px; }
.risk-bar div { padding:8px 8px 7px; font:400 11px/1.2 var(--mono); letter-spacing:1px; text-transform:uppercase;
  color:var(--muted); border-left:1px solid var(--line); }
.risk-bar div:first-child { border-left:none; }
.risk-bar b { display:block; font:600 22px/1.1 var(--sans); color:var(--ink); letter-spacing:-0.5px; }
.risk-bar div.on { background:var(--ink); color:#D6D6D6; } .risk-bar div.on b { color:#fff; }
.risk-key { margin:-6px 0 12px; font:400 11px/1.45 var(--mono); color:var(--muted); }
.risk-key b { font-weight:600; color:var(--ink); }
.pane-label .pane-sub { color:var(--muted); letter-spacing:1px; margin-left:4px; }
.live .n-meta.risky { fill:var(--ink); font-weight:600; }
.live .n-meta.faint { fill:var(--faint); }
.live-list .risk { display:inline-block; border:1px solid var(--ink); color:var(--ink); padding:0 4px; margin-right:6px;
  font-size:10px; letter-spacing:1px; text-transform:uppercase; }
.checkpoint.waiting .decide-part .pane-label { border-bottom-color:var(--warn); }
.waiting-note { margin-left:auto; color:#fff; background:var(--warn); padding:3px 6px; letter-spacing:1px; }
.waiting-note:empty { display:none; }

/* Online demo: a thin band under the header, and a clear first action */
.online-band { border-bottom:1px solid var(--line); padding:9px 48px; font:400 13px/1.4 var(--mono); background:#F2F4FF; }
.online-band b { font-weight:600; }
nav a.cta { background:var(--ink); color:#fff; border-color:var(--ink); }
.big-btn { font-size:15px; padding:16px 26px; margin-top:12px; }

/* New session: one clear panel in the middle, three short questions. */
.new-btn { justify-content:center; margin-top:auto; }
.start { max-width:640px; overflow:auto; }
.start-form { display:flex; flex-direction:column; gap:14px; }
.start-h { display:flex; align-items:center; gap:10px; font:600 20px/1.2 var(--sans); letter-spacing:-0.3px; margin:14px 0 2px; }
.start-h .sq { background:var(--ink); color:#fff; width:24px; height:24px; display:inline-flex; align-items:center;
  justify-content:center; font:600 13px/1 var(--mono); }
.start-form .where { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.choice { display:flex; gap:10px; align-items:flex-start; border:1px solid var(--line); padding:16px; background:#fff; cursor:pointer; }
.choice:has(input[name=where]:checked) { border-color:var(--accent); box-shadow:inset 0 0 0 1px var(--accent); }
.choice > input { margin-top:4px; }
.c-body { display:flex; flex-direction:column; gap:8px; flex:1; min-width:0; }
.c-body b { font:600 17px/1.2 var(--sans); }
.c-sub { color:var(--muted); font-size:14px; line-height:1.4; }
.start-form input[name=project], .start-form input[name=cwd] { font:400 15px/1.3 var(--sans); padding:9px 10px;
  border:1px solid var(--line); background:#fff; width:100%; box-sizing:border-box; min-width:0; }
.pick { display:flex; gap:8px; }
.row-choices { display:flex; flex-wrap:wrap; gap:10px; }
.row-choices.col { flex-direction:column; }
.pill { display:flex; flex-wrap:wrap; align-items:center; gap:8px; border:1px solid var(--line); padding:12px 14px; background:#fff;
  font-size:16px; cursor:pointer; }
.pill .c-sub { flex-basis:100%; padding-left:24px; }
.pill:has(input:checked) { border-color:var(--accent); box-shadow:inset 0 0 0 1px var(--accent); }
.no-key { margin:0; }
.learn-check { display:flex; flex-wrap:wrap; align-items:center; gap:4px 8px; font-size:16px; margin-top:8px; }
.learn-check .c-sub { flex-basis:100%; padding-left:24px; }
.learn-check + .learn-check { margin-top:0; }
/* A practice lesson needs no folder, sign-in, or options: only the agent choice and a short note stay. */
.start-form.practice .agent-only { display:none; }
.start-form.practice .start-h .sq { display:none; }
.practice-note { margin:4px 0 0; max-width:40em; font-size:16px; line-height:1.5; border-left:3px solid var(--accent); padding:4px 0 4px 12px; }
@media (max-width: 1100px) { .start-form .where { grid-template-columns:1fr; } }
