/* ================================================================
   GUARDForge — /guard-loop-builder
   Port of the sQuark.ai GUARD Loop Builder, restyled with the
   Mesonsoft light-glass theme: white panels, #ece6f6 borders,
   #9F66FF → #FF196E gradient accents — same language as
   ms-ai-studio.css and ms-cloud-agentic.css.
   ================================================================ */

/* ---------- Page frame ---------- */
.ms-gb-page{padding:30px 20px 48px}
.ms-gb-head{max-width:960px;margin:0 auto 20px;text-align:center}
.ms-gb-lede{margin:12px auto 0;max-width:640px;color:#5b6675;font-size:15.5px;line-height:1.65}

/* ---------- Shell ---------- */
/* Mirrors .ms-studio-app: a rounded, tinted card that fills most of the
   viewport, with the tool chrome clipped inside it. */
.ms-gb-app{display:flex;flex-direction:column;max-width:1660px;margin:0 auto;min-height:78vh;border-radius:22px;border:1px solid #ece6f6;background:linear-gradient(168deg,#fdfcff,#f7f4fd);box-shadow:0 34px 70px -46px rgba(159,102,255,.55);overflow:hidden}

/* ---------- Toolbar ---------- */
.ms-gb-bar{display:flex;align-items:center;gap:12px;flex-wrap:wrap;padding:12px 16px;background:#fff;border-bottom:1px solid #ece6f6}
.ms-gb-title{font-size:15px;font-weight:800;letter-spacing:-.01em;color:#171f2b}
.ms-gb-bar-actions{display:flex;flex-wrap:wrap;gap:8px;margin-left:auto}
.ms-gb-btn{display:inline-flex;align-items:center;justify-content:center;gap:6px;padding:7px 16px;border-radius:999px;border:1px solid #e4dcf6;background:#fff;color:#4b5563;font-family:inherit;font-size:12.5px;font-weight:700;white-space:nowrap;cursor:pointer;transition:all .18s ease}
.ms-gb-btn:hover{border-color:#b79bf5;color:#7c3aed;transform:translateY(-1px)}
.ms-gb-btn-primary{color:#fff;border-color:transparent;background:linear-gradient(115deg,#9F66FF,#FF196E);box-shadow:0 12px 26px -14px rgba(159,102,255,.65)}
.ms-gb-btn-primary:hover{color:#fff;border-color:transparent;box-shadow:0 16px 32px -14px rgba(255,25,110,.55)}
.ms-gb-btn:focus-visible{outline:2px solid #9F66FF;outline-offset:2px}

/* ---------- Link hint bar + error banner ---------- */
.ms-gb-hint{display:flex;align-items:center;gap:9px;padding:9px 16px;background:#faf8ff;border-bottom:1px solid #ece6f6;font-size:12.5px;line-height:1.5;color:#6b7488}
.ms-gb-hint svg{flex:0 0 auto;color:#0ea77e}
.ms-gb-hint strong{color:#171f2b}
.ms-gb-error{margin:0;padding:9px 16px;border-bottom:1px solid #fbd5d5;background:#fff5f5;font-size:12.5px;font-weight:600;color:#dc2626}

/* ---------- 3-column body ---------- */
.ms-gb-main{display:flex;flex:1;min-height:0}

/* ---------- Node palette (left) ---------- */
.ms-gb-rail{flex:0 0 230px;padding:16px 14px;overflow-y:auto;background:#fff;border-right:1px solid #ece6f6}
.ms-gb-group+.ms-gb-group{margin-top:16px}
.ms-gb-group-title{margin:0 0 8px;font-size:10.5px;font-weight:800;letter-spacing:.1em;text-transform:uppercase;color:#8b86a3}
.ms-gb-item{display:flex;align-items:flex-start;gap:9px;width:100%;padding:8px 9px;margin-bottom:6px;border-radius:10px;border:1px solid #f1ebfa;background:#fdfcff;text-align:left;cursor:grab;transition:all .18s ease}
.ms-gb-item:hover{border-color:var(--ms-accent);background:#fff;box-shadow:0 10px 22px -16px rgba(23,31,43,.3);transform:translateX(2px)}
.ms-gb-item:active{cursor:grabbing}
.ms-gb-item.is-locked{opacity:.55;cursor:not-allowed}
.ms-gb-item.is-locked:hover{border-color:#f1ebfa;background:#fdfcff;box-shadow:none;transform:none}
.ms-gb-item-ico{flex:0 0 auto;display:flex;align-items:center;justify-content:center;width:26px;height:26px;border-radius:8px;border:1px solid var(--ms-accent);background:color-mix(in srgb,var(--ms-accent) 12%,#fff);color:var(--ms-accent)}
.ms-gb-item-copy{display:block;min-width:0;line-height:1.25}
.ms-gb-item-copy strong{display:block;overflow:hidden;font-size:12.5px;font-weight:700;color:#2b3444;text-overflow:ellipsis;white-space:nowrap}
.ms-gb-item-copy em{display:block;font-style:normal;font-size:10.5px;color:#a8a3bd}

/* ---------- Canvas stage (center) ---------- */
.ms-gb-stage{position:relative;flex:1;min-width:0;min-height:560px;background:#fbfaff}
.ms-gb-empty{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;margin:0;pointer-events:none;font-size:13.5px;color:#a8a3bd}
.ms-gb-minimap{border:1px solid #ece6f6!important;border-radius:10px!important;overflow:hidden;background:#fff!important}
.ms-gb-stage .react-flow__controls{border:1px solid #ece6f6;border-radius:10px;overflow:hidden;background:#fff;box-shadow:0 8px 20px -18px rgba(23,31,43,.5)}
.ms-gb-stage .react-flow__controls button{background:#fff;border-bottom:1px solid #f1ebfa;color:#4b5563}
.ms-gb-stage .react-flow__controls button:hover{background:#faf8ff;color:#7c3aed}
.ms-gb-stage .react-flow__controls button svg{fill:currentColor}
.ms-gb-stage .react-flow__connection-path{stroke:#9F66FF;stroke-width:2.5}
.ms-gb-stage .react-flow__edge-path{stroke-linecap:round}

/* ---------- Node card ---------- */
/* Light-glass twin of sQuark's dark GuardNodeBase: same 240px card, typed
   handles and SOURCE/SCANNER/RESOLVER/GATE tag, recolored via --ms-accent. */
.ms-gb-node{width:240px;padding:12px 14px;border-radius:13px;border:1.5px solid color-mix(in srgb,var(--ms-accent) 45%,#fff);background:color-mix(in srgb,var(--ms-accent) 9%,#fff);box-shadow:0 18px 40px -26px rgba(23,31,43,.5);transition:border-color .2s ease,box-shadow .2s ease,transform .2s ease}
.ms-gb-node:hover{border-color:var(--ms-accent)}
.ms-gb-node.is-selected{border-color:var(--ms-accent);box-shadow:0 0 0 3px color-mix(in srgb,var(--ms-accent) 22%,transparent),0 20px 40px -24px rgba(23,31,43,.5)}
.ms-gb-node-top{display:flex;align-items:center;gap:10px}
.ms-gb-node-ico{flex:0 0 auto;display:flex;align-items:center;justify-content:center;width:36px;height:36px;border-radius:10px;border:1px solid color-mix(in srgb,var(--ms-accent) 55%,#fff);background:color-mix(in srgb,var(--ms-accent) 14%,#fff);color:var(--ms-accent)}
.ms-gb-node-label{margin:0;font-size:14px;font-weight:700;line-height:1.2;color:#171f2b}
.ms-gb-node-sub{margin:2px 0 0;font-size:11px;color:var(--ms-accent)}
.ms-gb-node-tag{display:inline-block;margin-top:8px;font-size:9px;font-weight:800;letter-spacing:1.5px;color:var(--ms-accent)}
/* Typed handles keep sQuark's 12px size; white ring reads on the light stage. */
.ms-gb-node .react-flow__handle{width:12px!important;height:12px!important;border:2px solid #fff!important;background:var(--ms-accent)!important;box-shadow:0 2px 6px rgba(23,31,43,.3)}
.ms-gb-node .react-flow__handle:hover{transform:scale(1.25)}

/* ---------- Inspector (right) ---------- */
.ms-gb-panel{flex:0 0 340px;padding:16px;overflow-y:auto;background:#fff;border-left:1px solid #ece6f6}
.ms-gb-panel-label{margin:0 0 10px;font-size:11px;font-weight:800;letter-spacing:.14em;text-transform:uppercase;color:#7c3aed}
.ms-gb-inspect-title{margin:0;font-size:15px;font-weight:800;color:#171f2b}
.ms-gb-inspect-id{margin:4px 0 0;font-size:11.5px;color:#8b86a3}
.ms-gb-inspect-id code{padding:1px 5px;border-radius:5px;background:#f3efff;color:#7c3aed;font-size:10.5px}
.ms-gb-field{display:block;margin-top:12px}
.ms-gb-field>span{display:block;margin-bottom:5px;font-size:10.5px;font-weight:700;color:#6b7488}
.ms-gb-input{display:block;width:100%;box-sizing:border-box;padding:8px 10px;border-radius:9px;border:1px solid #e4dcf6;background:#fdfcff;font-family:inherit;font-size:12.5px;color:#171f2b;outline:none;transition:border-color .18s ease,box-shadow .18s ease}
.ms-gb-input:focus{border-color:#9F66FF;box-shadow:0 0 0 3px rgba(159,102,255,.18);background:#fff}
.ms-gb-input::placeholder{color:#a8a3bd}
.ms-gb-muted{margin:6px 0 0;font-size:12.5px;line-height:1.6;color:#8b86a3}
.ms-gb-note{margin:12px 0 0;padding:9px 11px;border-radius:10px;border:1px solid #f1ebfa;background:#fbfaff;font-size:11.5px;line-height:1.55;color:#6b7488}
.ms-gb-payload{max-height:260px;margin:14px 0 0;padding:11px;border-radius:10px;border:1px solid #f1ebfa;background:#fbfaff;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:10.5px;line-height:1.5;color:#4b5563;white-space:pre-wrap;overflow:auto}

/* ---------- Responsive ---------- */
@media (max-width:1200px){
  .ms-gb-main{flex-wrap:wrap}
  .ms-gb-rail{flex:1 1 240px;max-height:340px;border-right:0;border-bottom:1px solid #ece6f6}
  .ms-gb-panel{flex:1 1 300px;border-left:0;border-top:1px solid #ece6f6}
  .ms-gb-stage{order:-1;flex:1 1 100%;min-height:480px}
}
@media (max-width:700px){
  .ms-gb-bar-actions{width:100%;margin-left:0}
  .ms-gb-stage{min-height:400px}
  .ms-gb-page{padding:20px 12px 36px}
}
@media (prefers-reduced-motion:reduce){
  .ms-gb-node,.ms-gb-item,.ms-gb-btn,.ms-gb-input{transition:none}
}
