/* ── Component: WorkflowPage, WorkflowListPanel, WorkflowResultPanel ──
 * Class prefix: wfp-
 */

/* ═══════════════════════════════════════════════════
   WorkflowPage — Watch / Review / Build
   Adapted from workflow-final-v2.html reference
═══════════════════════════════════════════════════ */

/* ── CSS Variables (scoped) ── */
.wfp {
  --bg:   #0A0B0F;
  --bg2:  #111318;
  --bg3:  #16181F;
  --bg4:  #1C1F28;
  --line: rgba(255,255,255,0.07);
  --lx:   rgba(255,255,255,0.13);
  --t:    #E2E4EE;
  --t2:   #5A5F7A;
  --t3:   #2E3148;
  --w:    #FFFFFF;
  --g:    #A78BFA;
  --pk:   #f472b6;
  --dp:   #6C3BEE;
  --gold: #FBBF24;
  --b:    #60A5FA;
  --r:    #F87171;
  --pu:   #A78BFA;
}

.wfp {
  position: fixed;
  top: var(--topbar-h, 0);
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: var(--bg);
  color: var(--t);
  font-family: 'Inter', sans-serif;
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior-y: contain;
}

/* ── Animations ── */
@keyframes wfp-blink { 0%,100%{opacity:1} 50%{opacity:.2} }
@keyframes wfp-spin { to{transform:rotate(360deg)} }
@keyframes wfp-ap {
  0%,100%{box-shadow:0 0 0 2px rgba(167,139,250,.08), 0 0 8px rgba(167,139,250,.05)}
  50%{box-shadow:0 0 0 4px rgba(167,139,250,.18), 0 0 16px rgba(167,139,250,.12)}
}
@keyframes wfp-rp { 0%,100%{box-shadow:0 0 0 2px rgba(251,191,36,.04)} 50%{box-shadow:0 0 0 4px rgba(251,191,36,.1)} }
@keyframes wfp-fadein { from{opacity:0;transform:translateY(6px)} to{opacity:1;transform:none} }
@keyframes wfp-shimmer { to{left:140%} }
@keyframes wfp-slot-pulse { 0%,100%{background:rgba(255,255,255,.02)} 50%{background:rgba(255,255,255,.05)} }

/* New animations */
@keyframes wfp-node-enter {
  from { opacity:0; transform:translateX(-12px) scale(0.95); }
  to   { opacity:1; transform:none; }
}
@keyframes wfp-active-pulse {
  0%,100% { box-shadow:0 0 0 2px rgba(167,139,250,.1), 0 0 8px rgba(167,139,250,.06); }
  50%     { box-shadow:0 0 0 5px rgba(167,139,250,.22), 0 0 20px rgba(167,139,250,.15); }
}
@keyframes wfp-badge-pop {
  0%   { transform:scale(0); }
  60%  { transform:scale(1.3); }
  100% { transform:scale(1); }
}
@keyframes wfp-progress-shimmer {
  0%   { left:-40%; }
  100% { left:140%; }
}
@keyframes wfp-connector-flow {
  0%   { left:-100%; }
  100% { left:140%; }
}
@keyframes wfp-done-shimmer {
  0%   { left:-40%; opacity:0; }
  20%  { opacity:1; }
  80%  { opacity:1; }
  100% { left:140%; opacity:0; }
}
@keyframes wfp-arr-glow {
  0%,100% { box-shadow:0 0 4px var(--pk); }
  50%     { box-shadow:0 0 10px var(--pk), 0 0 4px var(--pk); }
}
@keyframes wfp-btn-shimmer {
  0%   { left:-50%; }
  100% { left:150%; }
}
@keyframes wfp-card-enter {
  from { opacity:0; transform:translateY(16px) scale(0.98); }
  to   { opacity:1; transform:none; }
}

/* Orbital ring spin (around active node) */
@keyframes wfp-orb-spin {
  from { transform:translate(-50%,-50%) rotate(0deg); }
  to   { transform:translate(-50%,-50%) rotate(360deg); }
}
/* Mini mascot float + sparkle */
@keyframes wfp-mascot-float {
  0%,100% { transform:translateY(0); }
  50%     { transform:translateY(-3px); }
}
@keyframes wfp-mascot-enter {
  from { opacity:0; transform:scale(0.3) translateY(6px); }
  to   { opacity:1; transform:scale(1) translateY(0); }
}
@keyframes wfp-sparkle {
  0%,100% { opacity:.6; transform:scale(.8); }
  50%     { opacity:1;  transform:scale(1.2); }
}
/* Connector traveling dot */
@keyframes wfp-dot-travel {
  0%   { left:-4px;  opacity:0; }
  10%  { opacity:1; }
  90%  { opacity:1; }
  100% { left:calc(100% + 4px); opacity:0; }
}

/* ── Shared elements ── */
.wfp .lns { height:1px; background:var(--line); }

.wfp .btn {
  display:inline-flex; align-items:center; gap:6px; border-radius:8px;
  padding:7px 16px; font-size:12px; font-weight:500; cursor:pointer;
  border:none; transition:all .15s; font-family:'Inter',sans-serif;
}
.wfp .btn-ghost { background:transparent; border:1px solid var(--lx); color:var(--t2); }
.wfp .btn-ghost:hover { color:var(--t); border-color:var(--t2); }
.wfp .btn-danger { color:#ef4444; border-color:rgba(239,68,68,0.3); }
.wfp .btn-danger:hover { background:rgba(239,68,68,0.15); border-color:#ef4444; color:#f87171; }
.wfp .btn-white { background:var(--w); color:var(--bg); font-weight:600; }
.wfp .btn-white:hover { background:#e8e8e8; }
.wfp .btn-sm { padding:5px 12px; font-size:11px; border-radius:6px; }

.wfp .tag {
  display:inline-flex; align-items:center; gap:4px;
  font-size:10px; font-weight:600; letter-spacing:.05em;
  text-transform:uppercase; padding:2px 8px; border-radius:4px; border:1px solid;
}
.wfp .t-waiting { color:#22d3ee; border-color:rgba(34,211,238,.25); background:rgba(34,211,238,.06); }
.wfp .t-run { color:var(--g); border-color:rgba(167,139,250,.25); background:rgba(167,139,250,.06); }
.wfp .t-rev { color:var(--gold); border-color:rgba(251,191,36,.2); background:rgba(251,191,36,.04); }
.wfp .t-done { color:var(--b); border-color:rgba(96,165,250,.2); background:rgba(96,165,250,.04); }
.wfp .t-sch { color:var(--pu); border-color:rgba(167,139,250,.2); background:rgba(167,139,250,.04); }
.wfp .t-fail { color:var(--r); border-color:rgba(248,113,113,.2); background:rgba(248,113,113,.04); }
.wfp .t-pause { color:var(--t2); border-color:rgba(255,255,255,.1); background:rgba(255,255,255,.03); }

/* ═══ TOP NAV ═══ */
.wfp-nav {
  display:flex; align-items:center; justify-content:space-between;
  padding:20px 40px 0; max-width:1060px; margin:0 auto;
}

/* ── Toolbar: [+ New Workflow] [mode pill] ── */
.wfp-toolbar {
  display:flex; align-items:center; gap:12px;
  padding:12px 40px 16px; max-width:1060px; margin:0 auto;
}
.wfp-nav-l { display:flex; align-items:center; gap:14px; }
.wfp-back {
  display:flex; align-items:center; gap:5px; font-size:12px;
  color:var(--t2); cursor:pointer; background:none; border:none;
  font-family:'Inter',sans-serif;
}
.wfp-back:hover { color:var(--t); }
.wfp-back svg {
  width:14px; height:14px; stroke:currentColor; fill:none;
  stroke-width:1.5; stroke-linecap:round; stroke-linejoin:round;
}
.wfp-nav-title { font-family:'Syne','Inter',sans-serif; font-size:18px; font-weight:700; color:var(--w); }
.wfp-nav-sub { font-size:11px; color:var(--t2); margin-top:1px; }

/* Mode switcher */
.wfp-mode-row {
  display:flex; gap:2px; align-items:center;
  background:rgba(17,19,24,0.5); backdrop-filter:blur(8px); -webkit-backdrop-filter:blur(8px);
  border:1px solid rgba(255,255,255,0.08); border-radius:12px; padding:4px;
}
.wfp-mode-btn {
  display:flex; align-items:center; gap:6px; padding:8px 18px; border-radius:9px;
  font-size:13px; font-weight:500; color:var(--t2); cursor:pointer;
  transition:all .15s; border:1px solid transparent; background:transparent;
  font-family:'Inter',sans-serif; white-space:nowrap;
}
.wfp-mode-btn svg {
  width:13px; height:13px; stroke:currentColor; fill:none;
  stroke-width:1.5; stroke-linecap:round; stroke-linejoin:round;
}
.wfp-mode-btn:hover { color:var(--w); }
.wfp-mode-btn.active {
  background:rgba(255,255,255,0.06); color:var(--w);
  border-color:rgba(255,255,255,0.12);
}
.wfp-mode-cnt {
  background:rgba(108,59,238,0.35); color:#c4b5fd;
  font-size:10px; padding:2px 7px; border-radius:6px; font-weight:700;
  min-width:18px; text-align:center;
}

/* ═══ WATCH LAYOUT ═══ */
.wfp-watch-wrap {
  max-width:1060px; margin:0 auto; padding:24px 40px 48px;
  display:grid; grid-template-columns:1fr 252px; gap:20px;
}

/* Workflow card */
.wfp-wfc {
  background:rgba(17,19,24,0.8); backdrop-filter:blur(12px); -webkit-backdrop-filter:blur(12px);
  border:1px solid var(--line); border-radius:14px;
  margin-bottom:12px; overflow:hidden;
  animation:wfp-card-enter .4s cubic-bezier(0.22,1,0.36,1) forwards;
  transition:transform .2s cubic-bezier(0.22,1,0.36,1), box-shadow .2s ease, border-color .15s;
}
.wfp-wfc:hover {
  border-color:var(--lx);
  transform:translateY(-2px);
  box-shadow:0 8px 24px rgba(167,139,250,.08), 0 0 0 1px rgba(167,139,250,.06);
}
.wfp-wfc-head {
  display:flex; align-items:flex-start; justify-content:space-between; padding:18px 20px 12px;
}
.wfp-wfc-title {
  font-family:'Syne','Inter',sans-serif; font-size:14px; font-weight:700;
  color:var(--w); margin-bottom:5px;
}
.wfp-wfc-meta { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.wfp-wfc-time { font-size:11px; color:var(--t2); }
.wfp-wfc-prog { height:3px; background:var(--line); margin:0 20px; border-radius:3px; overflow:hidden; }
.wfp-pf { height:100%; border-radius:3px; transition:width .5s ease; }
.wfp-pf-waiting {
  background:linear-gradient(90deg, rgba(34,211,238,.15) 0%, rgba(34,211,238,.5) 50%, rgba(34,211,238,.15) 100%);
  background-size:200% 100%;
  animation:wfp-pf-scan 2s ease-in-out infinite;
}
@keyframes wfp-pf-scan {
  0%   { background-position:200% 0; }
  100% { background-position:-200% 0; }
}
.wfp-pf-run { background:rgba(255,255,255,.22); }
.wfp-pf-rev { background:var(--gold); }
.wfp-pf-done {
  background:linear-gradient(90deg, var(--g), var(--pk));
  position:relative; overflow:hidden;
}
.wfp-pf-done::after {
  content:''; position:absolute; top:0; left:-40%; width:30%; height:100%;
  background:linear-gradient(90deg, transparent, rgba(255,255,255,.35), transparent);
  animation:wfp-progress-shimmer 2.5s ease-in-out infinite;
}

/* Flow visualization */
.wfp-flow-viz { padding:28px 20px 18px; overflow-x:auto; overflow-y:visible; scrollbar-width:none; }
.wfp-flow-viz::-webkit-scrollbar { display:none; }
.wfp-flow-track { display:inline-flex; align-items:center; white-space:nowrap; }

/* Flow node */
.wfp-fn {
  display:inline-flex; flex-direction:column; align-items:center; gap:6px; vertical-align:top;
  animation:wfp-node-enter .4s cubic-bezier(0.22,1,0.36,1) both;
  animation-delay:calc(var(--node-idx, 0) * 60ms);
}
.wfp-fn-box {
  width:42px; height:42px; border-radius:11px;
  background:rgba(22,24,31,0.7); backdrop-filter:blur(4px); -webkit-backdrop-filter:blur(4px);
  border:1px solid var(--line); display:flex; align-items:center;
  justify-content:center; position:relative;
  transition:all .3s cubic-bezier(0.22,1,0.36,1);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.08);
}
.wfp-fn-box svg {
  width:18px; height:18px; stroke:var(--t2); fill:none;
  stroke-width:1.5; stroke-linecap:round; stroke-linejoin:round;
}
.wfp-fn.done .wfp-fn-box {
  border-color:rgba(167,139,250,.35);
  background:radial-gradient(ellipse at 30% 20%, rgba(167,139,250,.12), rgba(22,24,31,0.7) 70%);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.1),
    0 0 12px rgba(167,139,250,.18),
    0 0 24px rgba(167,139,250,.06);
}
.wfp-fn.done .wfp-fn-box svg {
  stroke:var(--g);
  filter:drop-shadow(0 0 3px rgba(167,139,250,.4));
}
.wfp-fn.act .wfp-fn-box {
  border-color:rgba(167,139,250,.5);
  animation:wfp-active-pulse 2s ease-in-out infinite;
}
.wfp-fn.act .wfp-fn-box svg { stroke:var(--w); }
.wfp-fn.waiting .wfp-fn-box {
  border-color:rgba(34,211,238,.5);
  background:rgba(34,211,238,.06);
  animation:wfp-waiting-pulse 2.5s ease-in-out infinite;
  position:relative;
  overflow:visible;
}
.wfp-fn.waiting .wfp-fn-box svg { stroke:#22d3ee; filter:drop-shadow(0 0 4px rgba(34,211,238,.4)); }
.wfp-fn.waiting .wfp-fn-lbl { color:#22d3ee; font-weight:600; }
@keyframes wfp-waiting-pulse {
  0%,100% { box-shadow:0 0 0 3px rgba(34,211,238,.08), 0 0 12px rgba(34,211,238,.06); }
  50%     { box-shadow:0 0 0 6px rgba(34,211,238,.18), 0 0 24px rgba(34,211,238,.12); }
}

/* Radar sweep ring */
.wfp-fn.waiting .wfp-fn-box::before {
  content:'';
  position:absolute; inset:-8px;
  border-radius:50%;
  border:1.5px solid transparent;
  border-top-color:rgba(34,211,238,.5);
  border-right-color:rgba(34,211,238,.2);
  animation:wfp-radar-spin 2s linear infinite;
}
/* Outer sonar ring */
.wfp-fn.waiting .wfp-fn-box::after {
  content:'';
  position:absolute; inset:-4px;
  border-radius:50%;
  border:1px solid rgba(34,211,238,.15);
  animation:wfp-sonar 2.5s ease-out infinite;
}
@keyframes wfp-radar-spin {
  from { transform:rotate(0deg); }
  to   { transform:rotate(360deg); }
}
@keyframes wfp-sonar {
  0%   { inset:-4px; opacity:.6; border-color:rgba(34,211,238,.25); }
  100% { inset:-18px; opacity:0; border-color:rgba(34,211,238,0); }
}
/* Schedule-waiting node (clock tick animation) */
.wfp-fn.sched-waiting .wfp-fn-box {
  border-color:rgba(167,139,250,.5);
  background:rgba(167,139,250,.06);
  animation:wfp-sched-pulse 3s ease-in-out infinite;
  position:relative;
  overflow:visible;
}
.wfp-fn.sched-waiting .wfp-fn-box svg { stroke:#a78bfa; filter:drop-shadow(0 0 4px rgba(167,139,250,.4)); }
.wfp-fn.sched-waiting .wfp-fn-lbl { color:#a78bfa; font-weight:600; }
@keyframes wfp-sched-pulse {
  0%,100% { box-shadow:0 0 0 3px rgba(167,139,250,.08), 0 0 12px rgba(167,139,250,.06); }
  50%     { box-shadow:0 0 0 6px rgba(167,139,250,.18), 0 0 24px rgba(167,139,250,.12); }
}
/* Clock hand sweep */
.wfp-fn.sched-waiting .wfp-fn-box::before {
  content:'';
  position:absolute; inset:-8px;
  border-radius:50%;
  border:1.5px solid transparent;
  border-top-color:rgba(167,139,250,.5);
  border-right-color:rgba(167,139,250,.2);
  animation:wfp-radar-spin 3s linear infinite;
}
/* Outer tick ring */
.wfp-fn.sched-waiting .wfp-fn-box::after {
  content:'';
  position:absolute; inset:-4px;
  border-radius:50%;
  border:1px solid rgba(167,139,250,.15);
  animation:wfp-sched-tick 3s ease-out infinite;
}
@keyframes wfp-sched-tick {
  0%   { inset:-4px; opacity:.6; border-color:rgba(167,139,250,.25); }
  100% { inset:-18px; opacity:0; border-color:rgba(167,139,250,0); }
}

.wfp-fn.pend .wfp-fn-box {
  opacity:.4;
  background:rgba(22,24,31,0.5);
}
.wfp-fn.pend .wfp-fn-box svg { stroke:var(--t3); opacity:.7; }
.wfp-fn.rev .wfp-fn-box { border-color:rgba(251,191,36,.4); animation:wfp-rp 2s infinite; }
.wfp-fn.rev .wfp-fn-box svg { stroke:var(--gold); }

/* Flow node badge */
.wfp-fn-badge {
  position:absolute; bottom:-4px; right:-4px; width:14px; height:14px;
  border-radius:50%; display:flex; align-items:center; justify-content:center;
  border:2px solid var(--bg2); z-index:2;
}
.wfp-fb-ok {
  background:var(--g); color:var(--bg); font-size:7px; font-weight:700;
  animation:wfp-badge-pop .35s cubic-bezier(0.22,1,0.36,1) both;
}
.wfp-fb-spin { background:var(--w); }
.wfp-fb-spin::after {
  content:''; display:block; width:6px; height:6px;
  border:1.5px solid var(--bg); border-top-color:transparent;
  border-radius:50%; animation:wfp-spin .8s linear infinite;
}

/* ── Active node orbital ring system ── */
.wfp-orb-wrap {
  position:absolute; inset:0; pointer-events:none; z-index:0;
}
.wfp-orb-ring {
  position:absolute; border-radius:50%; border:1px solid;
  top:50%; left:50%; transform:translate(-50%,-50%);
  animation:wfp-orb-spin linear infinite;
}
.wfp-orb-ring-1 {
  width:58px; height:58px;
  border-color:rgba(167,139,250,.18);
  animation-duration:8s;
}
.wfp-orb-ring-2 {
  width:72px; height:72px;
  border-color:rgba(244,114,182,.12);
  animation-duration:12s;
  animation-direction:reverse;
}
/* Satellite dot wrappers (orbit at different speeds) */
.wfp-sat-wrap {
  position:absolute; top:50%; left:50%;
  transform:translate(-50%,-50%);
  animation:wfp-orb-spin linear infinite;
}
.wfp-sat-wrap-1 { width:58px; height:58px; animation-duration:4s; }
.wfp-sat-wrap-2 { width:72px; height:72px; animation-duration:6s; animation-direction:reverse; }
.wfp-sat-dot {
  border-radius:50%; position:absolute;
  top:-3px; left:50%; transform:translateX(-50%);
}
.wfp-sat-dot-purple {
  width:5px; height:5px;
  background:#a78bfa; box-shadow:0 0 6px #a78bfa;
}
.wfp-sat-dot-pink {
  width:4px; height:4px;
  background:#f472b6; box-shadow:0 0 5px #f472b6;
}

/* ── Mini mascot floating above active node ── */
.wfp-mascot {
  position:absolute; top:-22px; left:50%; transform:translateX(-50%);
  z-index:4; pointer-events:none;
  animation:wfp-mascot-enter .4s cubic-bezier(0.22,1,0.36,1) both,
            wfp-mascot-float 2.5s ease-in-out infinite .4s;
}
.wfp-mascot-emoji {
  font-size:16px; line-height:1;
  filter:drop-shadow(0 0 6px rgba(167,139,250,.5));
}
/* Sparkle accents around the mascot */
.wfp-mascot-sparkle {
  position:absolute; font-size:7px; line-height:1;
  animation:wfp-sparkle 1.5s ease-in-out infinite;
  pointer-events:none; color:#FBBF24;
}
.wfp-mascot-sparkle-1 { top:-4px; right:-8px; animation-delay:0s; }
.wfp-mascot-sparkle-2 { bottom:-2px; left:-7px; animation-delay:.5s; }
.wfp-mascot-sparkle-3 { top:2px; left:-9px; animation-delay:1s; font-size:5px; }

/* Flow node label */
.wfp-fn-lbl {
  font-size:8.5px; font-weight:500; color:var(--t2); text-align:center;
  max-width:50px; line-height:1.3; white-space:normal;
}
.wfp-fn.done .wfp-fn-lbl { color:var(--g); }
.wfp-fn.act .wfp-fn-lbl { color:var(--w); }
.wfp-fn.rev .wfp-fn-lbl { color:var(--gold); }

/* Flow node clickable */
.wfp-fn-clickable { cursor:pointer; }
.wfp-fn-clickable:hover {
  transform:scale(1.12);
  transition:transform .15s cubic-bezier(0.22,1,0.36,1);
  box-shadow:0 0 16px rgba(167,139,250,.18);
}

/* Step output popover */
.wfp-step-popover {
  position:fixed;
  width:360px;
  max-height:420px;
  overflow-y:auto;
  background:rgba(26,29,40,0.92);
  backdrop-filter:blur(20px) saturate(180%);
  -webkit-backdrop-filter:blur(20px) saturate(180%);
  border:1px solid rgba(167,139,250,.12);
  border-radius:14px;
  box-shadow:0 16px 48px rgba(0,0,0,.8), 0 0 0 1px rgba(167,139,250,.06);
  z-index:1100;
  animation:wfp-fadein .15s ease-out;
}
/* Backdrop overlay to dim content behind */
.wfp-sp-backdrop {
  position:fixed;
  inset:0;
  background:rgba(0,0,0,.4);
  z-index:1099;
}
.wfp-sp-head {
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:10px 12px 6px;
  border-bottom:1px solid var(--line);
}
.wfp-sp-agent {
  font-size:12px;
  font-weight:600;
  color:var(--w);
}
.wfp-sp-close {
  background:none;
  border:none;
  color:var(--t2);
  font-size:18px;
  cursor:pointer;
  padding:0 2px;
  line-height:1;
}
.wfp-sp-close:hover { color:var(--w); }
.wfp-sp-task {
  padding:8px 12px;
  font-size:11px;
  color:var(--t2);
  border-bottom:1px solid var(--line);
  line-height:1.4;
}
.wfp-sp-body {
  padding:10px 12px;
  font-size:12px;
  color:var(--t);
  line-height:1.5;
  word-break:break-word;
}
.wfp-sp-body img {
  max-width:100%;
  border-radius:6px;
  margin-top:6px;
}

/* Flow connector */
.wfp-fc {
  display:inline-flex; align-items:center; padding:0 5px;
  margin-bottom:22px; flex-shrink:0;
}
.wfp-fc-line { width:28px; height:2px; background:var(--line); border-radius:1px; }
.wfp-fc-line.done {
  background:linear-gradient(90deg, var(--g), var(--pk));
  box-shadow:0 0 6px rgba(167,139,250,.25);
  position:relative; overflow:visible;
}
.wfp-fc-line.done::after {
  content:''; position:absolute; top:0; left:-40%; width:30%; height:100%;
  background:linear-gradient(90deg, transparent, rgba(255,255,255,.4), transparent);
  animation:wfp-done-shimmer 3s ease-in-out infinite;
}
.wfp-fc-line.act {
  background:rgba(167,139,250,.15); position:relative; overflow:visible;
}
.wfp-fc-arr {
  width:0; height:0; border-top:3px solid transparent;
  border-bottom:3px solid transparent; border-left:4px solid var(--line);
}
.wfp-fc-arr.done {
  border:none; width:6px; height:6px; border-radius:50%;
  background:var(--pk); box-shadow:0 0 6px var(--pk);
  animation:wfp-arr-glow 2s ease-in-out infinite;
}
.wfp-fc-arr.act {
  border:none; width:5px; height:5px; border-radius:50%;
  background:var(--g); box-shadow:0 0 6px var(--g);
}

/* Connector traveling dots (on active connectors) */
.wfp-fc-dot {
  position:absolute; top:50%; transform:translateY(-50%);
  width:4px; height:4px; border-radius:50%;
  background:#a78bfa; box-shadow:0 0 5px #a78bfa;
  animation:wfp-dot-travel 1.8s ease-in-out infinite;
  pointer-events:none;
}
.wfp-fc-dot-2 {
  width:3px; height:3px;
  background:#f472b6; box-shadow:0 0 4px #f472b6;
  animation-delay:.6s;
}
.wfp-fc-dot-3 {
  width:2.5px; height:2.5px;
  background:#34d399; box-shadow:0 0 4px #34d399;
  animation-delay:1.2s;
}

/* Waiting connector (cyan for event triggers) */
.wfp-fc-line.waiting {
  background:rgba(34,211,238,.15); position:relative; overflow:visible;
}
.wfp-fc-dot.waiting-dot {
  background:#22d3ee; box-shadow:0 0 5px rgba(34,211,238,.6);
  animation:wfp-dot-travel 2s ease-in-out infinite;
}
.wfp-fc-dot.waiting-dot.wfp-fc-dot-2 {
  background:#67e8f9; box-shadow:0 0 4px rgba(103,232,249,.5);
}
.wfp-fc-arr.waiting {
  border:none; width:5px; height:5px; border-radius:50%;
  background:#22d3ee; box-shadow:0 0 5px rgba(34,211,238,.4);
  animation:wfp-arr-glow-cyan 2s ease-in-out infinite;
}
@keyframes wfp-arr-glow-cyan {
  0%,100% { box-shadow:0 0 3px rgba(34,211,238,.3); }
  50%     { box-shadow:0 0 8px rgba(34,211,238,.6); }
}

/* ── Sidebar ── */
.wfp-sidebar { display:flex; flex-direction:column; gap:14px; }
.wfp-sc {
  background:rgba(17,19,24,0.7); backdrop-filter:blur(8px); -webkit-backdrop-filter:blur(8px);
  border:1px solid var(--line); border-radius:14px; overflow:hidden;
}
.wfp-sc-head {
  padding:12px 16px; border-bottom:1px solid var(--line);
  display:flex; align-items:center; justify-content:space-between;
}
.wfp-sc-title {
  font-size:10px; font-weight:600; letter-spacing:.1em;
  text-transform:uppercase; color:var(--t2);
}
.wfp-sc-sub { font-size:11px; color:var(--t2); }

/* Mini status grid — avatars */
.wfp-mini-grid {
  display:grid; grid-template-columns:repeat(3,1fr);
  gap:1px; background:var(--line);
}
.wfp-mg-item {
  background:var(--bg2); padding:10px 8px;
  display:flex; flex-direction:column; align-items:center;
  gap:5px; cursor:pointer; transition:background .15s;
}
.wfp-mg-item:hover { background:var(--bg3); }
.wfp-mg-avatar {
  width:32px; height:32px; border-radius:9px; position:relative;
  overflow:visible; flex-shrink:0;
}
.wfp-mg-avatar-inner {
  width:32px; height:32px; border-radius:9px; border:1px solid var(--line);
  display:flex; align-items:center; justify-content:center;
  font-size:13px; font-weight:600; color:var(--w);
}
.wfp-mg-dot {
  position:absolute; bottom:-2px; right:-2px; width:8px; height:8px;
  border-radius:50%; border:1.5px solid var(--bg2);
}
.wfp-mg-name { font-size:9px; font-weight:500; color:var(--t2); }
.wfp-mg-item.on .wfp-mg-name { color:var(--t); }
.wfp-mg-status { font-size:8px; color:var(--t3); }
.wfp-mg-item.on .wfp-mg-status { color:var(--g); }

/* Activity feed */
.wfp-ai {
  display:flex; gap:9px; padding:9px 14px; cursor:pointer;
  transition:background .15s; align-items:flex-start;
}
.wfp-ai:hover { background:var(--bg3); }
.wfp-ai-ic {
  width:24px; height:24px; border-radius:6px; background:var(--bg3);
  border:1px solid var(--line); display:flex; align-items:center;
  justify-content:center; font-size:10px; font-weight:600;
  flex-shrink:0; margin-top:1px; color:var(--w);
}
.wfp-ai-t { flex:1; min-width:0; }
.wfp-ai-title {
  font-size:11px; font-weight:500; color:var(--t); line-height:1.4;
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}
.wfp-ai-time { font-size:10px; color:var(--t3); margin-top:1px; }

/* Empty state */
.wfp-empty {
  text-align:center; padding:48px 20px; color:var(--t2); font-size:13px;
}

/* ═══ REVIEW MODE ═══ */
.wfp-review-wrap { max-width:660px; margin:0 auto; padding:24px 40px 48px; }
.wfp-rv-back {
  display:flex; align-items:center; justify-content:space-between; margin-bottom:22px;
}
.wfp-rv-info { font-size:12px; color:var(--t2); }
.wfp-rv-info span { color:var(--gold); font-weight:600; }

.wfp-review-card {
  background:var(--bg2); border:1px solid rgba(251,191,36,.18);
  border-radius:16px; overflow:hidden; margin-bottom:8px;
}
.wfp-rc-hd { padding:20px 22px 16px; border-bottom:1px solid var(--line); }
.wfp-rc-lbl {
  font-size:10px; font-weight:600; letter-spacing:.1em;
  text-transform:uppercase; color:var(--gold); margin-bottom:7px;
  display:flex; align-items:center; gap:6px;
}
.wfp-rc-title {
  font-family:'Syne','Inter',sans-serif; font-size:17px; font-weight:700;
  color:var(--w); line-height:1.3; margin-bottom:6px;
}
.wfp-rc-meta { font-size:12px; color:var(--t2); display:flex; align-items:center; gap:8px; }

.wfp-rc-out { padding:18px 22px; border-bottom:1px solid var(--line); }
.wfp-rc-out-lbl {
  font-size:10px; font-weight:600; letter-spacing:.1em;
  text-transform:uppercase; color:var(--t2); margin-bottom:10px;
}
.wfp-rc-out-txt {
  font-size:13px; color:var(--t); line-height:1.75;
  background:var(--bg3); border:1px solid var(--line);
  border-radius:10px; padding:16px; max-height:200px; overflow-y:auto;
}
.wfp-rc-out-txt::-webkit-scrollbar { width:3px; }
.wfp-rc-out-txt::-webkit-scrollbar-thumb { background:var(--bg4); border-radius:2px; }

.wfp-rc-steps-row {
  padding:12px 22px; border-bottom:1px solid var(--line);
  display:flex; align-items:center; justify-content:space-between; cursor:pointer;
}
.wfp-rc-steps-row:hover { background:var(--bg3); }
.wfp-rc-steps-lbl { font-size:11px; color:var(--t2); display:flex; align-items:center; gap:8px; }
.wfp-sdots { display:flex; gap:3px; }
.wfp-sdot { width:5px; height:5px; border-radius:50%; background:var(--g); }
.wfp-sdot.pending { background:var(--t3); }

/* Review steps detail (expanded) */
.wfp-rc-steps-detail {
  padding:12px 22px; border-bottom:1px solid var(--line);
  background:var(--bg3);
}
.wfp-rc-step-item {
  display:flex; align-items:flex-start; gap:10px; padding:8px 0;
  border-bottom:1px solid var(--line);
}
.wfp-rc-step-item:last-child { border-bottom:none; }
.wfp-rc-step-num {
  width:20px; height:20px; border-radius:50%; background:var(--bg4);
  border:1px solid var(--line); display:flex; align-items:center;
  justify-content:center; font-size:10px; color:var(--t2); flex-shrink:0;
}
.wfp-rc-step-info { flex:1; min-width:0; }
.wfp-rc-step-mini { font-size:11px; font-weight:600; color:var(--t); }
.wfp-rc-step-task { font-size:11px; color:var(--t2); margin-top:2px; }
.wfp-rc-step-result {
  margin-top:6px; padding:8px; background:var(--bg); border:1px solid var(--line);
  border-radius:6px; font-size:11px; color:var(--t); line-height:1.5;
  max-height:120px; overflow-y:auto;
}

/* Review action bar */
.wfp-rc-act { padding:16px 22px; display:flex; gap:8px; align-items:center; }
.wfp-rc-note {
  flex:1; background:var(--bg3); border:1px solid var(--line); border-radius:8px;
  padding:9px 12px; font-size:12px; color:var(--t); font-family:'Inter',sans-serif;
  outline:none; resize:none; height:38px;
}
.wfp-rc-note::placeholder { color:rgba(255,255,255,0.5); }
.wfp-rc-note:focus { border-color:var(--lx); }
.wfp .btn-reject { background:rgba(248,113,113,.08); color:var(--r); border:1px solid rgba(248,113,113,.2); }
.wfp .btn-reject:hover { background:rgba(248,113,113,.15); }
.wfp .btn-changes { background:rgba(251,191,36,.08); color:var(--gold); border:1px solid rgba(251,191,36,.2); }
.wfp .btn-changes:hover { background:rgba(251,191,36,.15); }
.wfp .btn-approve { background:rgba(167,139,250,.1); color:var(--g); border:1px solid rgba(167,139,250,.25); font-weight:600; }
.wfp .btn-approve:hover { background:rgba(167,139,250,.18); }

/* ═══ BUILD MODE ═══ */
.wfp-build-wrap { max-width:740px; margin:0 auto; padding:24px 40px 48px; }
.wfp-build-hd {
  display:flex; align-items:center; justify-content:space-between; margin-bottom:26px;
}
.wfp-build-title { font-family:'Syne','Inter',sans-serif; font-size:17px; font-weight:700; color:var(--w); }
.wfp-build-sub { font-size:12px; color:var(--t2); margin-top:3px; }

.wfp-field-row { display:grid; grid-template-columns:1fr 1fr; gap:14px; margin-bottom:22px; }
.wfp-fg { display:flex; flex-direction:column; gap:6px; }
.wfp-fl {
  font-size:10px; font-weight:600; letter-spacing:.08em;
  text-transform:uppercase; color:var(--t2);
}
.wfp-fi {
  background:var(--bg3); border:1px solid var(--lx); border-radius:8px;
  padding:10px 14px; color:var(--t); font-family:'Inter',sans-serif;
  font-size:13px; outline:none; transition:border-color .15s;
}
.wfp-fi:focus { border-color:rgba(255,255,255,.3); }
.wfp-fi::placeholder { color:rgba(255,255,255,0.5); }

/* Schedule tabs */
.wfp-sched-section { margin-bottom:22px; }
.wfp-sched-label {
  font-size:10px; font-weight:600; letter-spacing:.1em;
  text-transform:uppercase; color:var(--t2); margin-bottom:10px;
}
.wfp-sched-tabs {
  display:flex; gap:1px; background:var(--line); border:1px solid var(--line);
  border-radius:10px; overflow:hidden; margin-bottom:12px;
}
.wfp-stab {
  flex:1; padding:8px 0; text-align:center; font-size:12px; font-weight:500;
  color:var(--t2); background:var(--bg3); cursor:pointer; transition:all .15s;
  border:none; font-family:'Inter',sans-serif;
}
.wfp-stab.active { background:var(--bg4); color:var(--w); }
.wfp-stab:hover:not(.active) { color:var(--t); }

.wfp-sched-detail {
  background:var(--bg); border:1px solid var(--line); border-radius:8px;
  padding:14px 16px; font-size:12px; color:var(--t2); line-height:1.6;
}
.wfp-sched-detail strong { color:var(--t); }
.wfp-sched-inline { display:flex; gap:8px; align-items:center; margin-top:8px; flex-wrap:wrap; }
.wfp-sched-input {
  background:var(--bg3); border:1px solid var(--lx); border-radius:7px;
  padding:6px 10px; font-size:12px; color:var(--t); font-family:'Inter',sans-serif;
  outline:none; width:120px;
}
.wfp-sched-select {
  background:var(--bg3); border:1px solid var(--lx); border-radius:7px;
  padding:6px 10px; font-size:12px; color:var(--t); font-family:'Inter',sans-serif;
  outline:none; cursor:pointer;
}
.wfp-trigger-note {
  font-size:11px; color:var(--t3); margin-top:8px;
  display:flex; align-items:center; gap:5px; font-style:italic;
}
.wfp-trigger-note svg {
  width:10px; height:10px; stroke:currentColor; fill:none;
  stroke-width:1.5; stroke-linecap:round; stroke-linejoin:round; flex-shrink:0;
}

/* Palette */
.wfp-pal-label {
  font-size:10px; font-weight:600; letter-spacing:.1em;
  text-transform:uppercase; color:var(--t2); margin-bottom:8px;
}
.wfp-pal-sub {
  font-size:10px; color:var(--t3); font-weight:400;
  text-transform:none; letter-spacing:0;
}
.wfp-drag-hint {
  font-size:11px; color:var(--t3); display:flex; align-items:center;
  gap:5px; margin-bottom:10px;
}
.wfp-drag-hint svg {
  width:10px; height:10px; stroke:currentColor; fill:none; stroke-width:2; stroke-linecap:round;
}
.wfp-palette {
  display:grid; grid-template-columns:repeat(6,1fr); gap:8px;
  margin-bottom:20px; padding:14px; background:var(--bg);
  border:1px solid var(--line); border-radius:10px;
}
.wfp-mc {
  display:flex; flex-direction:column; align-items:center; gap:5px;
  padding:10px 6px; background:var(--bg3); border:1px solid var(--line);
  border-radius:9px; cursor:grab; transition:all .15s; user-select:none;
}
.wfp-mc:hover { border-color:var(--lx); transform:translateY(-2px); }
.wfp-mc:active { cursor:grabbing; transform:scale(.93); }
.wfp-mc-icon {
  width:32px; height:32px; border-radius:9px; display:flex;
  align-items:center; justify-content:center; background:var(--bg4);
  border:1px solid var(--line);
}
.wfp-mc-icon svg {
  width:16px; height:16px; stroke:var(--t2); fill:none;
  stroke-width:1.5; stroke-linecap:round; stroke-linejoin:round;
}
.wfp-mc-name { font-size:9px; font-weight:600; color:var(--t2); text-align:center; }

/* Drop zone */
.wfp-dz-label {
  font-size:10px; font-weight:600; letter-spacing:.1em;
  text-transform:uppercase; color:var(--t2); margin-bottom:10px;
}
.wfp-drop-zone {
  background:var(--bg); border:1px solid var(--line); border-radius:12px;
  padding:20px 16px; margin-bottom:20px; overflow-x:auto;
  scrollbar-width:none; min-height:130px; display:flex; align-items:center;
}
.wfp-drop-zone::-webkit-scrollbar { display:none; }
.wfp-dz-track { display:inline-flex; align-items:center; }

.wfp-dz-trig { display:flex; flex-direction:column; align-items:center; gap:7px; }
.wfp-dz-trig-box {
  width:50px; height:50px; border-radius:13px; background:var(--bg3);
  border:1px solid var(--lx); display:flex; align-items:center;
  justify-content:center; cursor:pointer; transition:all .15s;
}
.wfp-dz-trig-box:hover { border-color:rgba(255,255,255,.25); }
.wfp-dz-trig-box svg {
  width:18px; height:18px; stroke:var(--t2); fill:none;
  stroke-width:1.5; stroke-linecap:round; stroke-linejoin:round;
}
.wfp-dz-lbl {
  font-size:9px; font-weight:500; color:var(--t2);
  text-align:center; max-width:54px; line-height:1.3;
}

.wfp-dz-conn { display:flex; align-items:center; padding:0 4px; margin-bottom:26px; flex-shrink:0; }
.wfp-dz-cline { width:24px; height:1px; background:var(--line); }
.wfp-dz-carr {
  width:0; height:0; border-top:3px solid transparent;
  border-bottom:3px solid transparent; border-left:4px solid var(--line);
}

.wfp-dz-slot { display:flex; flex-direction:column; align-items:center; gap:7px; flex-shrink:0; }
.wfp-dz-slot-box {
  width:50px; height:50px; border-radius:13px; border:1.5px dashed rgba(255,255,255,.1);
  background:transparent; display:flex; align-items:center; justify-content:center;
  transition:all .2s; cursor:pointer; position:relative;
}
.wfp-dz-slot-box.filled {
  background:var(--bg3); border-style:solid; border-color:var(--lx); cursor:grab;
}
.wfp-dz-slot-box.filled svg { width:20px; height:20px; stroke:var(--t); stroke-width:1.5; }
.wfp-dz-slot-box:not(.filled):hover {
  border-color:rgba(255,255,255,.25); background:rgba(255,255,255,.02);
}
.wfp-dz-slot-box.drag-over {
  border-color:var(--w); border-style:solid;
  background:rgba(255,255,255,.04); transform:scale(1.1);
}
.wfp-dz-slot-box svg {
  width:18px; height:18px; stroke:var(--t3); fill:none;
  stroke-width:1.5; stroke-linecap:round; stroke-linejoin:round;
}

.wfp-slot-del {
  position:absolute; top:-5px; right:-5px; width:15px; height:15px;
  border-radius:50%; background:var(--bg4); border:1px solid var(--lx);
  display:flex; align-items:center; justify-content:center;
  font-size:8px; color:var(--t2); cursor:pointer; opacity:0;
  transition:opacity .15s; z-index:3;
}
.wfp-dz-slot:hover .wfp-slot-del { opacity:1; }
.wfp-slot-del:hover { background:var(--r); color:var(--w); border-color:var(--r); }

.wfp-slot-task {
  width:68px; background:transparent; border:none;
  border-bottom:1px solid var(--line); font-size:9px; color:var(--t2);
  text-align:center; padding:2px 0; outline:none; font-family:'Inter',sans-serif;
}
.wfp-slot-task::placeholder { color:rgba(255,255,255,0.5); }
.wfp-slot-task:focus { border-bottom-color:var(--lx); }

.wfp-dz-add { display:flex; flex-direction:column; align-items:center; gap:7px; }
.wfp-dz-add-box {
  width:50px; height:50px; border-radius:13px; border:1px dashed var(--t3);
  background:transparent; display:flex; align-items:center; justify-content:center;
  cursor:pointer; transition:all .15s; font-size:20px; color:var(--t3);
}
.wfp-dz-add-box:hover { border-color:var(--t2); color:var(--t2); }

/* Settings */
.wfp-build-settings {
  display:flex; flex-direction:column; gap:12px; padding:16px;
  background:var(--bg); border:1px solid var(--line); border-radius:10px; margin-bottom:20px;
}
.wfp-sr { display:flex; align-items:center; justify-content:space-between; }
.wfp-sl { font-size:12px; color:var(--t2); }
.wfp-tog {
  width:28px; height:15px; background:var(--bg4); border:1px solid var(--line);
  border-radius:8px; position:relative; cursor:pointer; transition:all .15s; flex-shrink:0;
}
.wfp-tog.on { background:rgba(255,255,255,.12); border-color:rgba(255,255,255,.2); }
.wfp-tog::after {
  content:''; position:absolute; width:9px; height:9px; background:var(--t3);
  border-radius:50%; top:2px; left:2px; transition:all .15s;
}
.wfp-tog.on::after { transform:translateX(13px); background:var(--w); }

.wfp-build-foot { display:flex; align-items:center; justify-content:space-between; }
.wfp-foot-opt {
  display:flex; align-items:center; gap:6px; font-size:12px;
  color:var(--t2); cursor:pointer;
}

/* ═══ "+ New Workflow" branded button ═══ */
/* FAB — floating action button */
.wfp-fab {
  position:fixed; bottom:32px; right:32px; z-index:1010;
  width:56px; height:56px; border-radius:50%; border:none; cursor:pointer;
  background:linear-gradient(135deg, #6C3BEE 0%, #9333ea 100%);
  color:#fff;
  box-shadow:0 6px 24px rgba(108,59,238,.45), 0 2px 8px rgba(0,0,0,.3);
  display:flex; align-items:center; justify-content:center;
  transition:transform .18s ease, box-shadow .18s ease, filter .18s ease;
}
.wfp-fab svg {
  width:24px; height:24px; stroke:currentColor; fill:none;
  stroke-width:2.5; stroke-linecap:round; stroke-linejoin:round;
}
.wfp-fab:hover {
  transform:translateY(-3px) scale(1.05);
  box-shadow:0 10px 32px rgba(108,59,238,.6), 0 4px 12px rgba(0,0,0,.3);
  filter:brightness(1.1);
}
.wfp-fab:active {
  transform:translateY(0) scale(0.95);
}
.wfp-fab:focus-visible {
  outline:2px solid #a78bfa;
  outline-offset:3px;
}

/* ═══ Workflow card state accents ═══ */
.wfp-wfc--active {
  box-shadow:inset 3px 0 0 var(--g), 0 0 8px rgba(167,139,250,.06);
}
.wfp-wfc--active:hover {
  box-shadow:inset 3px 0 0 var(--g), 0 8px 24px rgba(167,139,250,.1), 0 0 0 1px rgba(167,139,250,.08);
}
.wfp-wfc--done {
  border-top:2px solid rgba(167,139,250,.25);
}

/* Trigger card — animated border glow when actively listening */
.wfp-wfc--trigger-active {
  border:1px solid rgba(34,211,238,.25);
  box-shadow:inset 3px 0 0 rgba(34,211,238,.6), 0 0 12px rgba(34,211,238,.06);
  animation:wfp-trigger-card-glow 3s ease-in-out infinite;
}
.wfp-wfc--trigger-active:hover {
  box-shadow:inset 3px 0 0 rgba(34,211,238,.6), 0 8px 24px rgba(34,211,238,.1), 0 0 0 1px rgba(34,211,238,.12);
}
@keyframes wfp-trigger-card-glow {
  0%,100% { border-color:rgba(34,211,238,.2); box-shadow:inset 3px 0 0 rgba(34,211,238,.5), 0 0 8px rgba(34,211,238,.04); }
  50%     { border-color:rgba(34,211,238,.35); box-shadow:inset 3px 0 0 rgba(34,211,238,.7), 0 0 18px rgba(34,211,238,.1); }
}

/* ═══ WORKFLOW DETAILS (expandable) ═══ */
.wfp-wf-details {
  margin:0 16px 14px;
  border:1px solid var(--line);
  border-radius:8px;
  overflow:hidden;
}
.wfp-wf-details summary {
  padding:8px 14px;
  font-size:12px;
  font-weight:600;
  color:var(--t3);
  cursor:pointer;
  background:var(--bg2);
  user-select:none;
  list-style:none;
  display:flex;
  align-items:center;
  gap:6px;
}
.wfp-wf-details summary::before {
  content:'▸';
  font-size:10px;
  transition:transform .15s;
}
.wfp-wf-details[open] summary::before {
  transform:rotate(90deg);
}
.wfp-wf-details summary:hover {
  color:var(--t1);
}
.wfp-wf-details-body {
  padding:12px 14px;
  display:flex;
  flex-direction:column;
  gap:10px;
}
.wfp-wf-details-section {}
.wfp-wf-details-label {
  font-size:10px;
  font-weight:700;
  text-transform:uppercase;
  letter-spacing:.06em;
  color:var(--t3);
  margin-bottom:4px;
}
.wfp-wf-details-text {
  font-size:13px;
  color:var(--t2);
  line-height:1.45;
}
.wfp-wf-details-step {
  font-size:13px;
  color:var(--t2);
  padding:3px 0;
  line-height:1.4;
}
.wfp-wf-details-step-num {
  color:var(--t3);
  font-weight:600;
  font-size:11px;
}

/* ═══ MOBILE (<768px) ═══ */
@media (max-width: 767px) {
  .wfp-nav {
    padding:12px 16px 0; flex-direction:column; gap:12px; align-items:stretch;
  }
  .wfp-nav-l { gap:10px; }
  .wfp-nav-title { font-size:16px; }
  .wfp-mode-row { display:none; }

  /* Mobile bottom nav */
  .wfp-mobile-nav {
    display:flex; position:fixed; bottom:0; left:0; right:0;
    border-top:1px solid var(--line); background:var(--bg2); z-index:1001;
    padding-bottom:env(safe-area-inset-bottom, 0px);
  }

  /* Flow viz touch scroll */
  .wfp-flow-viz {
    -webkit-overflow-scrolling:touch;
    overscroll-behavior-x:contain;
    scroll-snap-type:x proximity;
  }

  /* Touch targets on flow nodes */
  .wfp-fn-box { min-width:44px; min-height:44px; }
  .wfp-ph-tab {
    flex:1; display:flex; flex-direction:column; align-items:center; gap:3px;
    padding:9px 0 11px; cursor:pointer; font-size:9px; font-weight:600;
    letter-spacing:.06em; text-transform:uppercase; color:var(--t3);
    border-top:2px solid transparent; transition:all .15s;
    background:none; border-left:none; border-right:none; border-bottom:none;
    font-family:'Inter',sans-serif;
  }
  .wfp-ph-tab svg {
    width:15px; height:15px; stroke:currentColor; fill:none;
    stroke-width:1.5; stroke-linecap:round; stroke-linejoin:round;
  }
  .wfp-ph-tab.active { color:var(--t); border-top-color:var(--w); }
  .wfp-ph-tab.alert-tab { color:var(--gold); }
  .wfp-ph-tab.alert-tab.active { border-top-color:var(--gold); }

  /* Watch mode mobile */
  .wfp-watch-wrap {
    grid-template-columns:1fr; padding:16px 16px calc(80px + env(safe-area-inset-bottom, 0px)); gap:16px;
  }
  .wfp-sidebar { display:none; }

  /* Mobile stats row */
  .wfp-m-stats {
    display:grid; grid-template-columns:repeat(3,1fr); gap:1px;
    background:var(--line); border:1px solid var(--line);
    border-radius:8px; overflow:hidden; margin-bottom:12px;
  }
  .wfp-m-stat { background:var(--bg3); padding:8px; text-align:center; }
  .wfp-m-stat-n { font-family:'Syne','Inter',sans-serif; font-size:16px; font-weight:800; color:var(--w); }
  .wfp-m-stat-l { font-size:8px; color:var(--t2); text-transform:uppercase; letter-spacing:.06em; }

  .wfp-wfc { border-radius:11px; }
  .wfp-wfc-head { padding:11px 13px 9px; }
  .wfp-wfc-title { font-size:11px; margin-bottom:4px; line-height:1.3; }
  .wfp-wfc-prog { margin:0 13px; }
  .wfp-flow-viz { padding:10px 13px 12px; }

  /* Mobile flow nodes (smaller) */
  .wfp-fn-box { width:34px; height:34px; border-radius:9px; }
  .wfp-fn-box svg { width:13px; height:13px; }
  .wfp-fn-lbl { font-size:7.5px; max-width:40px; line-height:1.2; }
  .wfp-fc-line { width:16px; }
  .wfp-fn-badge { width:12px; height:12px; bottom:-3px; right:-3px; }
  .wfp-fb-ok { font-size:6px; }
  .wfp-fb-spin::after { width:5px; height:5px; }
  /* Smaller orbital + mascot on mobile */
  .wfp-orb-ring-1 { width:46px; height:46px; }
  .wfp-orb-ring-2 { width:58px; height:58px; }
  .wfp-sat-wrap-1 { width:46px; height:46px; }
  .wfp-sat-wrap-2 { width:58px; height:58px; }
  .wfp-sat-dot-purple { width:4px; height:4px; }
  .wfp-sat-dot-pink { width:3px; height:3px; }
  .wfp-mascot { top:-18px; }
  .wfp-mascot-emoji { font-size:13px; }

  /* Mobile step popover */
  .wfp-step-popover { width:260px; max-height:280px; }

  /* Review mode mobile */
  .wfp-review-wrap { padding:16px 16px 80px; max-width:100%; }
  .wfp-rc-title { font-size:14px; }
  .wfp-rc-act { flex-wrap:wrap; }

  /* Build mode mobile */
  .wfp-build-wrap { padding:16px 16px 80px; max-width:100%; }
  .wfp-field-row { grid-template-columns:1fr; }
  .wfp-palette { grid-template-columns:repeat(3,1fr); }
  .wfp-build-foot { flex-direction:column; gap:12px; align-items:stretch; }
}

/* ═══ PAGINATION ═══ */
.wfp-pagination {
  display:flex; align-items:center; justify-content:center; gap:16px;
  padding:16px 0 8px;
}
.wfp-pag-info {
  font-size:12px; color:var(--t2); font-weight:500;
}

/* ═══ TEMPLATES MODE ═══ */

/* Category color vars */
.wfp-templates-wrap {
  --wfp-jade: #34D399;    --wfp-jade-dim: rgba(52,211,153,0.12);
  --wfp-violet: #7B68EE;  --wfp-violet-dim: rgba(123,104,238,0.15);
  --wfp-amber: #FBBF24;   --wfp-amber-dim: rgba(251,191,36,0.12);
  --wfp-sky: #38BDF8;     --wfp-sky-dim: rgba(56,189,248,0.12);
  --wfp-rose: #F87171;    --wfp-rose-dim: rgba(248,113,113,0.12);
  --wfp-purple: #A78BFA;  --wfp-purple-dim: rgba(167,139,250,0.12);
}

.wfp-templates-wrap {
  max-width:1200px; margin:0 auto; padding:24px 28px 80px;
}

/* Header */
.wfp-tpl-header {
  display:flex; align-items:flex-start; justify-content:space-between;
  margin-bottom:28px; gap:20px;
}
.wfp-tpl-title-block h1 {
  font-family:'Syne','Inter',sans-serif; font-size:22px; font-weight:600;
  letter-spacing:-0.02em; color:var(--w); margin-bottom:4px;
}
.wfp-tpl-title-block p {
  color:var(--t2); font-size:13px;
}

/* Filter bar */
.wfp-tpl-filter-bar {
  display:flex; align-items:center; gap:10px;
  margin-bottom:28px; flex-wrap:wrap;
}

.wfp-tpl-search-wrap {
  position:relative; flex:1; min-width:220px; max-width:360px;
}
.wfp-tpl-search-wrap svg {
  position:absolute; left:12px; top:50%; transform:translateY(-50%);
  color:var(--t3); pointer-events:none;
}
.wfp-tpl-search-input {
  width:100%; background:var(--bg2); border:1px solid var(--line);
  border-radius:8px; padding:9px 12px 9px 36px;
  color:var(--w); font-family:'Instrument Sans','Inter',sans-serif;
  font-size:13px; outline:none; transition:border-color .2s, box-shadow .2s;
}
.wfp-tpl-search-input::placeholder { color:var(--t3); }
.wfp-tpl-search-input:focus {
  border-color:rgba(123,104,238,0.4);
  box-shadow:0 0 0 3px rgba(123,104,238,0.1);
}

/* Pills */
.wfp-tpl-pills {
  display:flex; gap:6px; flex-wrap:wrap;
}
.wfp-tpl-pill {
  display:flex; align-items:center; gap:6px;
  padding:7px 13px; border-radius:20px; font-size:12px; font-weight:500;
  border:1px solid var(--line); background:var(--bg2);
  color:var(--t2); cursor:pointer; transition:all .18s; white-space:nowrap;
}
.wfp-tpl-pill:hover { color:var(--w); border-color:rgba(255,255,255,0.15); }
.wfp-tpl-pill.active {
  background:var(--wfp-violet-dim);
  border-color:rgba(123,104,238,0.35);
  color:#B0A5FF;
}
.wfp-tpl-pill-dot {
  width:6px; height:6px; border-radius:50%; flex-shrink:0;
}

/* Sort */
.wfp-tpl-sort {
  background:var(--bg2); border:1px solid var(--line);
  border-radius:8px; padding:8px 12px; color:var(--t2);
  font-family:'Instrument Sans','Inter',sans-serif; font-size:12px;
  outline:none; cursor:pointer; margin-left:auto;
}
.wfp-tpl-sort:focus { border-color:rgba(123,104,238,0.4); }

/* Section labels */
.wfp-tpl-section-lbl {
  font-size:10px; font-weight:700; letter-spacing:0.1em;
  text-transform:uppercase; color:var(--t3);
  margin-bottom:12px; margin-top:32px;
  display:flex; align-items:center; gap:8px;
}
.wfp-tpl-section-lbl:first-of-type { margin-top:0; }
.wfp-tpl-section-lbl::after {
  content:''; flex:1; height:1px; background:var(--line);
}

/* Grid */
.wfp-tpl-grid {
  display:grid; grid-template-columns:repeat(auto-fill, minmax(320px, 1fr)); gap:14px;
}

/* Card */
.wfp-tpl-card {
  background:var(--bg2); border:1px solid var(--line); border-radius:12px;
  padding:18px 20px; cursor:pointer; transition:all .22s;
  position:relative; overflow:hidden;
  display:flex; flex-direction:column; gap:12px;
}
.wfp-tpl-card::after {
  content:''; position:absolute; top:0; left:0; right:0;
  height:2px; border-radius:12px 12px 0 0; opacity:0; transition:opacity .22s;
}
.wfp-tpl-card:hover {
  border-color:rgba(123,104,238,0.3);
  transform:translateY(-2px);
  box-shadow:0 8px 32px rgba(0,0,0,0.4), 0 0 0 1px rgba(123,104,238,0.1);
}
.wfp-tpl-card:hover::after { opacity:1; }
.wfp-tpl-card[data-cat="leads"]::after   { background:var(--wfp-jade); }
.wfp-tpl-card[data-cat="calls"]::after   { background:var(--wfp-violet); }
.wfp-tpl-card[data-cat="payments"]::after { background:var(--wfp-amber); }
.wfp-tpl-card[data-cat="social"]::after  { background:var(--wfp-sky); }
.wfp-tpl-card[data-cat="reports"]::after  { background:var(--wfp-purple); }
.wfp-tpl-card[data-cat="saved"]::after   { background:var(--wfp-rose); }
.wfp-tpl-card.hidden { display:none; }

/* Card top row */
.wfp-tpl-card-top {
  display:flex; align-items:flex-start; justify-content:space-between; gap:12px;
}
.wfp-tpl-card-icon {
  width:38px; height:38px; border-radius:10px;
  display:flex; align-items:center; justify-content:center;
  font-size:18px; flex-shrink:0;
}
.wfp-tpl-card-icon.leads    { background:var(--wfp-jade-dim); }
.wfp-tpl-card-icon.calls    { background:var(--wfp-violet-dim); }
.wfp-tpl-card-icon.payments { background:var(--wfp-amber-dim); }
.wfp-tpl-card-icon.social   { background:var(--wfp-sky-dim); }
.wfp-tpl-card-icon.reports  { background:var(--wfp-purple-dim); }
.wfp-tpl-card-icon.saved    { background:var(--wfp-rose-dim); }

/* Badges */
.wfp-tpl-card-badges { display:flex; gap:5px; flex-wrap:wrap; justify-content:flex-end; }
.wfp-tpl-badge {
  font-size:10px; font-weight:600; padding:2px 8px;
  border-radius:20px; letter-spacing:0.03em; text-transform:uppercase;
}
.wfp-tpl-badge.badge-saved    { background:var(--wfp-rose-dim); color:var(--wfp-rose); }
.wfp-tpl-badge.badge-popular  { background:var(--wfp-amber-dim); color:var(--wfp-amber); }
.wfp-tpl-badge.badge-new      { background:var(--wfp-jade-dim); color:var(--wfp-jade); }
.wfp-tpl-badge.badge-category {
  background:var(--bg4, rgba(255,255,255,0.05));
  color:var(--t2); border:1px solid var(--line);
}

/* Card body */
.wfp-tpl-card-name {
  font-size:14px; font-weight:600; letter-spacing:-0.01em;
  color:var(--w); margin-bottom:5px;
}
.wfp-tpl-card-desc {
  font-size:12px; color:var(--t2); line-height:1.55;
  display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden;
}

/* Step flow preview */
.wfp-tpl-card-flow {
  display:flex; align-items:center; gap:0;
  flex-wrap:nowrap; overflow:hidden;
}
.wfp-tpl-flow-step {
  display:flex; align-items:center; gap:5px;
  background:var(--bg3, rgba(255,255,255,0.04));
  border:1px solid var(--line); border-radius:6px;
  padding:4px 9px; font-size:11px; color:var(--t2);
  white-space:nowrap; flex-shrink:0;
}
.wfp-tpl-step-dot {
  width:5px; height:5px; border-radius:50%;
  background:var(--t3); flex-shrink:0;
}
.wfp-tpl-flow-arrow {
  color:var(--t3); font-size:11px; padding:0 4px; flex-shrink:0;
}
.wfp-tpl-flow-more {
  font-size:11px; color:var(--t3); padding-left:4px; flex-shrink:0;
}

/* Card footer */
.wfp-tpl-card-footer {
  display:flex; align-items:center; justify-content:space-between;
  padding-top:10px; border-top:1px solid var(--line);
}
.wfp-tpl-card-meta {
  display:flex; align-items:center; gap:12px;
  font-size:11px; color:var(--t3);
}
.wfp-tpl-card-meta span {
  display:flex; align-items:center; gap:4px;
}

/* Use button */
.wfp-tpl-use-btn {
  display:flex; align-items:center; gap:5px;
  font-size:12px; font-weight:600; color:var(--wfp-violet);
  cursor:pointer; padding:5px 12px; border-radius:6px;
  border:1px solid rgba(123,104,238,0.25);
  background:var(--wfp-violet-dim);
  font-family:'Instrument Sans','Inter',sans-serif;
  transition:all .18s;
}
.wfp-tpl-use-btn:hover {
  background:rgba(123,104,238,0.25);
  border-color:rgba(123,104,238,0.5);
}

/* Delete button */
.wfp-tpl-del {
  position:absolute; top:8px; right:8px; width:22px; height:22px;
  border-radius:50%; background:var(--bg4, rgba(255,255,255,0.05));
  border:1px solid var(--line); display:flex; align-items:center; justify-content:center;
  font-size:13px; color:var(--t2); cursor:pointer; opacity:0;
  transition:opacity .15s; line-height:1; z-index:2;
}
.wfp-tpl-card:hover .wfp-tpl-del { opacity:1; }
.wfp-tpl-del:hover { background:var(--r); color:var(--w); border-color:var(--r); }

/* Empty search state */
.wfp-tpl-empty-search {
  text-align:center; padding:60px 20px; color:var(--t3);
}
.wfp-tpl-empty-icon { font-size:36px; margin-bottom:12px; }
.wfp-tpl-empty-search h3 { font-size:15px; color:var(--t2); margin-bottom:6px; }
.wfp-tpl-empty-search p { font-size:13px; }

/* Category row in WorkflowLauncher */
.launch-category-row {
  display:flex; align-items:center; gap:12px;
  padding:8px 0 0 28px;
}
.launch-cat-label {
  font-size:12px; color:var(--t2); font-weight:500; white-space:nowrap;
}
.launch-cat-select {
  background:var(--bg2, #16161F); border:1px solid var(--line, rgba(255,255,255,0.07));
  border-radius:8px; padding:6px 10px; color:var(--w, #F0F0F8);
  font-size:12px; outline:none; cursor:pointer; flex:1; max-width:200px;
}

/* ═══ MOBILE TEMPLATES ═══ */
@media (max-width: 767px) {
  .wfp-templates-wrap { padding:16px 16px 80px; }
  .wfp-tpl-grid { grid-template-columns:1fr; }
  .wfp-tpl-filter-bar { flex-direction:column; align-items:stretch; }
  .wfp-tpl-search-wrap { max-width:100%; }
  .wfp-tpl-pills { overflow-x:auto; flex-wrap:nowrap; -webkit-overflow-scrolling:touch; }
  .wfp-tpl-sort { margin-left:0; }
}

/* Hide mobile-only elements on desktop */
@media (min-width: 768px) {
  .wfp-mobile-nav { display:none; }
  .wfp-m-stats { display:none; }
}

/* ═══════════════════════════════════════════════════
   NEW ANIMATIONS (Phase 3)
═══════════════════════════════════════════════════ */

/* Step completion bloom — green glow burst */
@keyframes wfp-step-bloom {
  0%   { transform:scale(1); box-shadow:0 0 0 0 rgba(34,197,94,.4); }
  40%  { transform:scale(1.15); box-shadow:0 0 16px 4px rgba(34,197,94,.5); }
  100% { transform:scale(1); box-shadow:0 0 0 0 rgba(34,197,94,0); }
}

/* Workflow completion waterfall cascade */
@keyframes wfp-complete-waterfall {
  0%   { opacity:0.6; transform:scale(0.95); box-shadow:none; }
  50%  { opacity:1; transform:scale(1.08); box-shadow:0 0 12px rgba(167,139,250,.5); }
  100% { opacity:1; transform:scale(1); box-shadow:0 0 6px rgba(167,139,250,.2); }
}

/* Running card energy field — breathing glow */
@keyframes wfp-energy-field {
  0%,100% { box-shadow:inset 3px 0 0 var(--g), 0 0 8px rgba(167,139,250,.06), 0 0 0 1px rgba(167,139,250,.04); }
  50%     { box-shadow:inset 3px 0 0 var(--g), 0 0 18px rgba(167,139,250,.15), 0 0 0 2px rgba(167,139,250,.08); }
}

/* Section collapse/expand slide */
@keyframes wfp-section-slide {
  from { opacity:0; max-height:0; }
  to   { opacity:1; max-height:2000px; }
}

/* Attention pulse on section header */
@keyframes wfp-attention-pulse {
  0%,100% { box-shadow:inset 3px 0 0 rgba(245,158,11,.4); }
  50%     { box-shadow:inset 3px 0 0 rgba(245,158,11,.8), 0 0 12px rgba(245,158,11,.15); }
}

/* Mini-tile entrance pop */
@keyframes wfp-tile-pop {
  0%   { transform:scale(0); opacity:0; }
  60%  { transform:scale(1.15); opacity:1; }
  100% { transform:scale(1); }
}

/* ═══ Running card energy field modifier ═══ */
.wfp-wfc--running {
  animation:wfp-energy-field 3s ease-in-out infinite;
}

/* Step bloom on just-completed nodes */
.wfp-fn--just-completed .wfp-fn-box {
  animation:wfp-step-bloom .6s cubic-bezier(0.22,1,0.36,1) both;
}

/* Workflow completing waterfall */
.wfp-wfc--completing .wfp-fn-box {
  animation:wfp-complete-waterfall .5s cubic-bezier(0.22,1,0.36,1) both;
  animation-delay:calc(var(--node-idx, 0) * 150ms);
}

/* ═══════════════════════════════════════════════════
   COLLAPSIBLE SECTIONS
═══════════════════════════════════════════════════ */

/* ═══════════════════════════════════════════════════
   SPLIT LAYOUT — sidebar + main (iPad Settings style)
═══════════════════════════════════════════════════ */
.wfp-split {
  display:flex; min-height:0; flex:1;
}

.wfp-sidebar {
  width:220px; flex-shrink:0;
  background:rgba(17,19,24,0.95);
  border-right:1px solid rgba(255,255,255,0.07);
  padding:16px 0;
  position:sticky; top:0; align-self:flex-start;
  min-height:calc(100vh - 80px);
  min-height:calc(100dvh - 80px);
}

.wfp-sidebar-item {
  display:flex; align-items:center; gap:10px;
  padding:12px 20px; width:100%;
  border:none; background:none; cursor:pointer;
  font-size:13px; color:#5A5F7A;
  border-left:2px solid transparent;
  transition:all .12s;
  font-family:inherit; text-align:left;
}
.wfp-sidebar-item:hover {
  color:#E2E4EE;
  background:rgba(255,255,255,0.03);
}
.wfp-sidebar-item.active {
  color:#fff;
  border-left-color:var(--item-accent);
  background:rgba(255,255,255,0.04);
}

.wfp-sidebar-dot {
  width:6px; height:6px; border-radius:50%; flex-shrink:0;
}

.wfp-sidebar-label {
  flex:1;
}

.wfp-sidebar-badge {
  font-size:9px; font-weight:700; color:#fff;
  padding:1px 6px; border-radius:8px; min-width:16px;
  text-align:center; line-height:1.4;
}

.wfp-split-main {
  flex:1; min-width:0; padding:16px 24px 24px 24px;
  animation:wfp-section-slide .2s ease-out;
}

@media (max-width:767px) {
  .wfp-split { flex-direction:column; }
  .wfp-sidebar {
    width:100%; border-right:none;
    border-bottom:1px solid rgba(255,255,255,0.07);
    display:flex; overflow-x:auto; padding:0;
    min-height:auto;
  }
  .wfp-sidebar-item {
    border-left:none; border-bottom:2px solid transparent;
    white-space:nowrap; padding:8px 16px;
  }
  .wfp-sidebar-item.active {
    border-left-color:transparent;
    border-bottom-color:var(--item-accent);
  }
  .wfp-split-main { padding:16px 12px 24px; }
}

/* ═══════════════════════════════════════════════════
   INLINE REVIEW (Needs Attention cards)
═══════════════════════════════════════════════════ */

.wfp-inline-review {
  background:rgba(251,191,36,.04); border:1px solid rgba(251,191,36,.15);
  border-radius:0 0 14px 14px; margin-top:-1px;
  overflow:hidden;
}

.wfp-inline-review-preview {
  padding:12px 16px; border-bottom:1px solid rgba(251,191,36,.1);
}
/* Email/social preview inside inline review — constrain height, scroll body */
.wfp-inline-review-preview .review-email-preview,
.wfp-inline-review-preview .review-social-preview {
  margin:0;
}
.wfp-inline-review-preview .review-email-body,
.wfp-inline-review-preview .review-social-body {
  max-height:280px; overflow-y:auto;
}

.wfp-inline-review-label {
  font-size:9px; font-weight:600; letter-spacing:.08em;
  text-transform:uppercase; color:var(--gold); margin-bottom:6px;
}

.wfp-inline-review-text {
  font-size:12px; color:var(--t); line-height:1.5;
  max-height:100px; overflow-y:auto;
  background:var(--bg3); border:1px solid var(--line);
  border-radius:8px; padding:10px;
}

.wfp-inline-review-bar {
  display:flex; gap:8px; align-items:center; padding:10px 16px;
}

/* ═══════════════════════════════════════════════════
   MINI-TILES (overflow waiting items)
═══════════════════════════════════════════════════ */

.wfp-mini-tiles {
  display:flex; flex-wrap:wrap; gap:8px; padding:8px 0;
}

.wfp-mini-tile {
  width:32px; height:32px; border-radius:50%;
  background:rgba(34,211,238,.15); border:1px solid rgba(34,211,238,.3);
  display:flex; align-items:center; justify-content:center;
  font-size:11px; font-weight:700; color:#22d3ee;
  cursor:pointer; transition:all .2s;
  animation:wfp-tile-pop .3s cubic-bezier(0.22,1,0.36,1) both;
  animation-delay:calc(var(--tile-idx, 0) * 60ms);
}
.wfp-mini-tile:hover {
  transform:scale(1.15);
  box-shadow:0 0 12px rgba(34,211,238,.3);
}

/* ═══════════════════════════════════════════════════
   RECORDS TAB
═══════════════════════════════════════════════════ */

.wfp-records-wrap {
  max-width:740px; margin:0 auto; padding:24px 40px 48px;
}

.wfp-records-hd { margin-bottom:20px; }
.wfp-records-title {
  font-family:'Syne','Inter',sans-serif; font-size:17px; font-weight:700; color:var(--w);
}
.wfp-records-sub { font-size:12px; color:var(--t2); margin-top:4px; }

.wfp-records-search {
  width:100%; background:var(--bg3); border:1px solid var(--line);
  border-radius:8px; padding:9px 14px; font-size:13px;
  color:var(--t); font-family:'Inter',sans-serif; outline:none;
  margin-bottom:16px; transition:border-color .15s;
}
.wfp-records-search:focus { border-color:var(--lx); }
.wfp-records-search::placeholder { color:rgba(255,255,255,0.5); }

.wfp-records-top-row {
  display:flex; align-items:center; justify-content:space-between;
  margin-bottom:16px;
}

/* Breadcrumb */
.wfp-records-breadcrumb {
  display:flex; align-items:center; gap:4px;
  font-size:12px; color:var(--t2); margin-bottom:16px;
}
.wfp-records-top-row .wfp-records-breadcrumb { margin-bottom:0; }
.wfp-bc-link {
  cursor:pointer; color:var(--g); transition:color .15s;
}
.wfp-bc-link:hover { color:var(--w); }
.wfp-bc-current { color:var(--t); font-weight:500; }

/* Group card (Level 1) */
.wfp-record-group-card {
  display:flex; align-items:center; gap:12px;
  background:var(--bg2); border:1px solid var(--line); border-radius:12px;
  padding:16px; margin-bottom:10px; cursor:pointer;
  transition:all .15s;
  animation:wfp-card-enter .4s cubic-bezier(0.22,1,0.36,1) forwards;
}
.wfp-record-group-card:hover {
  border-color:var(--lx); transform:translateY(-2px);
  box-shadow:0 8px 24px rgba(167,139,250,.08);
}

.wfp-record-group-left { flex:1; min-width:0; }
.wfp-record-group-title {
  font-family:'Syne','Inter',sans-serif; font-size:13px; font-weight:700;
  color:var(--w); margin-bottom:4px;
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}
.wfp-record-group-meta { font-size:11px; color:var(--t2); }

.wfp-record-ratio { width:60px; flex-shrink:0; }
.wfp-record-ratio-bar {
  height:4px; border-radius:2px; background:var(--bg4);
  overflow:hidden; display:flex;
}
.wfp-record-ratio-success { background:#34d399; height:100%; }
.wfp-record-ratio-fail { background:var(--r); height:100%; }

.wfp-record-group-right {
  flex-shrink:0; color:var(--t2);
}
.wfp-record-group-right svg {
  width:14px; height:14px; stroke:currentColor; fill:none;
  stroke-width:1.5; stroke-linecap:round; stroke-linejoin:round;
}

/* Run row (Level 2) */
.wfp-record-run-row {
  display:flex; align-items:center; justify-content:space-between;
  background:var(--bg2); border:1px solid var(--line); border-radius:12px;
  padding:14px 16px; margin-bottom:8px; cursor:pointer;
  transition:all .15s;
  animation:wfp-card-enter .3s cubic-bezier(0.22,1,0.36,1) forwards;
}
.wfp-record-run-row:hover {
  border-color:var(--lx); transform:translateY(-1px);
  box-shadow:0 4px 16px rgba(0,0,0,.2);
}

.wfp-record-run-left { flex:1; min-width:0; }
.wfp-record-run-date { font-size:12px; font-weight:500; color:var(--w); margin-bottom:2px; }
.wfp-record-run-meta { font-size:11px; color:var(--t2); }

.wfp-record-run-right {
  display:flex; align-items:center; gap:10px; flex-shrink:0;
}
.wfp-record-run-right svg {
  width:14px; height:14px; stroke:var(--t2); fill:none;
  stroke-width:1.5; stroke-linecap:round; stroke-linejoin:round;
}

.wfp-record-run-avatars {
  display:flex; gap:-4px;
}
.wfp-record-avatar {
  width:22px; height:22px; border-radius:50%;
  display:flex; align-items:center; justify-content:center;
  font-size:9px; font-weight:700; color:#fff;
  margin-left:-4px; border:2px solid var(--bg2);
}
.wfp-record-avatar:first-child { margin-left:0; }

/* Detail card (Level 3) */
.wfp-record-detail-card {
  background:var(--bg2); border:1px solid var(--line); border-radius:14px;
  overflow:hidden;
}

.wfp-record-detail-hd {
  padding:20px 22px 16px; border-bottom:1px solid var(--line);
}
.wfp-record-detail-title {
  font-family:'Syne','Inter',sans-serif; font-size:17px; font-weight:700;
  color:var(--w); margin-bottom:6px;
}
.wfp-record-detail-meta {
  display:flex; align-items:center; gap:10px; font-size:12px; color:var(--t2);
}

/* Timeline */
.wfp-record-timeline {
  padding:16px 22px 20px;
}

.wfp-record-timeline-item {
  display:flex; gap:12px; padding:12px 0;
  border-bottom:1px solid var(--line);
  animation:wfp-fadein .3s ease-out both;
}
.wfp-record-timeline-item:last-child { border-bottom:none; }

.wfp-record-timeline-marker {
  width:24px; height:24px; border-radius:50%; flex-shrink:0;
  display:flex; align-items:center; justify-content:center;
  font-size:10px; font-weight:700; border:2px solid var(--line);
  color:var(--t2); background:var(--bg4);
}
.wfp-record-timeline-marker.done {
  border-color:rgba(167,139,250,.4); color:var(--g); background:rgba(167,139,250,.1);
}

.wfp-record-timeline-content { flex:1; min-width:0; }

.wfp-record-timeline-hd {
  display:flex; align-items:center; gap:8px; margin-bottom:4px;
}
.wfp-record-timeline-agent {
  font-size:12px; font-weight:600; color:var(--t);
}

.wfp-record-timeline-task {
  font-size:11px; color:var(--t2); line-height:1.4; margin-bottom:4px;
}

.wfp-record-timeline-result { margin-top:6px; }
.wfp-record-timeline-toggle {
  font-size:11px; color:var(--g); cursor:pointer; margin-bottom:4px;
}
.wfp-record-timeline-toggle:hover { color:var(--w); }

.wfp-record-timeline-result-body {
  background:var(--bg3); border:1px solid var(--line); border-radius:6px;
  padding:10px; font-size:11px; color:var(--t); line-height:1.5;
  max-height:150px; overflow-y:auto;
}

/* Schedule loading in section */
.wfp-sched-loading {
  font-size:12px; color:var(--t2); padding:8px 0;
}

/* ═══ BULK ACTIONS (Needs Attention) ═══ */
.wfp-bulk-bar {
  display:flex; align-items:center; gap:16px;
  padding:10px 16px; margin-bottom:8px;
  background:var(--bg3); border:1px solid var(--line);
  border-radius:10px;
}
.wfp-bulk-select-all {
  display:flex; align-items:center; gap:6px;
  cursor:pointer; font-size:13px; color:var(--t);
  user-select:none;
}
.wfp-bulk-count {
  font-size:12px; color:var(--t2);
}
.wfp-bulk-actions {
  margin-left:auto; display:flex; gap:8px;
}
.wfp-bulk-btn-approve {
  background:#22c55e !important; color:#fff !important; border:none !important;
}
.wfp-bulk-btn-approve:disabled { opacity:0.4; cursor:not-allowed; }
.wfp-bulk-btn-reject {
  background:var(--r) !important; color:#fff !important; border:none !important;
}
.wfp-bulk-btn-reject:disabled { opacity:0.4; cursor:not-allowed; }

.wfp-card-wrap {
  display:flex; gap:10px; align-items:flex-start;
}
.wfp-card-check {
  width:16px; height:16px; margin-top:14px; flex-shrink:0;
  accent-color:var(--g); cursor:pointer;
}

/* ═══ MOBILE RECORDS ═══ */
@media (max-width: 767px) {
  .wfp-records-wrap { padding:16px 16px 80px; }
  .wfp-record-group-card { padding:12px; }
  .wfp-record-run-row { padding:10px 12px; }
  .wfp-record-detail-hd { padding:14px 16px 12px; }
  .wfp-record-timeline { padding:12px 16px 16px; }
  .wfp-records-top-row { flex-direction:column; gap:8px; align-items:stretch; }
  .wfp-inline-review-bar { flex-wrap:wrap; }
}

/* ── Landscape mode: phones held sideways ── */
@media (orientation: landscape) and (max-height: 500px) {
  .wfp-nav { padding:6px 16px 0; }
  .wfp-mobile-nav { padding-bottom:env(safe-area-inset-bottom, 0px); }
  .wfp-ph-tab { padding:5px 0 7px; font-size:8px; }
  .wfp-ph-tab svg { width:13px; height:13px; }
  .wfp-wfc { border-radius:9px; }
  .wfp-wfc-head { padding:8px 10px 6px; }
  .wfp-flow-viz { padding:8px 10px 10px; }
}

/* ═══ TRIGGER EXECUTION HISTORY ═══ */
.trigger-history {
  padding: 0 16px 12px;
}
.trigger-history-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.55);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  cursor: pointer;
  padding: 6px 0;
  transition: color 0.15s;
}
.trigger-history-toggle:hover {
  color: rgba(255, 255, 255, 0.85);
}
.trigger-history-arrow {
  font-size: 8px;
  transition: transform 0.2s;
}
.trigger-history-list {
  display: none;
  margin-top: 6px;
  border-left: 2px solid rgba(255, 255, 255, 0.08);
  padding-left: 12px;
  max-height: 280px;
  overflow-y: auto;
}
.trigger-history--open .trigger-history-list {
  display: block;
}
.trigger-history-entry {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 5px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 11px;
}
.trigger-history-entry:last-child {
  border-bottom: none;
}
.trigger-history-time {
  color: rgba(255, 255, 255, 0.4);
  font-size: 10px;
  min-width: 60px;
}
.trigger-history-link {
  color: #60a5fa;
  text-decoration: none;
  font-size: 10px;
  font-weight: 500;
  cursor: pointer;
}
.trigger-history-link:hover {
  text-decoration: underline;
  color: #93bbfc;
}
.trigger-history-error {
  color: rgba(248, 113, 113, 0.8);
  font-size: 10px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.trigger-history-empty {
  color: rgba(255, 255, 255, 0.3);
  font-size: 10px;
  padding: 4px 0;
}
.trigger-history-payload-toggle {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.35);
  font-size: 9px;
  padding: 1px 6px;
  border-radius: 3px;
  cursor: pointer;
}
.trigger-history-payload-toggle:hover {
  border-color: rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.6);
}
.trigger-history-payload {
  display: none;
  width: 100%;
  margin: 4px 0 0;
  padding: 6px 8px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 4px;
  font-size: 9px;
  color: rgba(255, 255, 255, 0.45);
  line-height: 1.4;
  max-height: 120px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-all;
}
.trigger-history-payload--open {
  display: block;
}
