/* WhatsApp Lab — pastel minimal refresh 🌙
   Soft lilac + blush, airy spacing, floating cards. */

:root {
  --lilac: #b79df7;
  --lilac-dark: #8b5cf6;
  --lilac-soft: #ede6fd;
  --pink: #f6b8d6;
  --pink-deep: #e56aa5;
  --pink-soft: #fde9f3;
  --bg: #faf7fc;
  --card: #ffffff;
  --ink: #3a2f52;
  --muted: #9a8fb8;
  --line: #f0e7f8;
  --green: #34c77b;
  --red: #f87171;
  --amber: #f5b84c;
  --radius: 20px;
  --shadow-soft: 0 6px 24px rgba(183, 157, 247, .12);
  --shadow-lift: 0 12px 36px rgba(183, 157, 247, .18);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(900px 480px at 12% -4%, rgba(237, 230, 253, .9), transparent 60%),
    radial-gradient(800px 460px at 88% 6%, rgba(253, 233, 243, .9), transparent 60%),
    radial-gradient(1000px 700px at 50% 110%, rgba(237, 230, 253, .55), transparent 60%),
    var(--bg);
  /* Fixed-height app shell: the page itself never scrolls. Each tab fills the
     remaining viewport height; scrolling happens inside the tab's panels. */
  height: 100vh; height: 100dvh;
  display: flex; flex-direction: column;
  overflow: hidden;
}

/* floating header bar */
header {
  flex: none;
  position: sticky; top: 14px; z-index: 50;
  margin: 14px 18px 0; padding: 13px 22px;
  display: flex; align-items: center; gap: 14px;
  background: rgba(255, 255, 255, .82);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, .9);
  border-radius: 22px;
  box-shadow: var(--shadow-soft);
}
header h1 { font-size: 19px; margin: 0; font-weight: 700; letter-spacing: .2px; }
header .sub { font-size: 12px; color: var(--muted); }
#connDot { width: 10px; height: 10px; border-radius: 50%; background: #d9cdf3; display: inline-block; margin-right: 6px; }
#connDot.ok { background: var(--green); box-shadow: 0 0 8px rgba(52, 199, 123, .8); }
#connDot.bad { background: var(--red); }
header .spacer { flex: 1; }
.conn-pill {
  display: inline-flex; align-items: center; gap: 2px;
  font-size: 13px; font-weight: 600; color: var(--ink);
  background: var(--lilac-soft); border-radius: 999px; padding: 8px 16px;
}

/* floating pill tabs */
nav.tabs {
  flex: none;
  position: sticky; top: 92px; z-index: 40;
  display: flex; gap: 6px; overflow-x: auto;
  margin: 14px 18px 0; padding: 8px;
  background: rgba(255, 255, 255, .72);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, .9);
  border-radius: 999px;
  box-shadow: var(--shadow-soft);
  width: fit-content; max-width: calc(100% - 36px);
}
nav.tabs button {
  border: none; background: none; padding: 10px 20px; border-radius: 999px; cursor: pointer;
  font-size: 14px; font-weight: 600; color: var(--muted); white-space: nowrap;
  transition: all .18s ease;
}
nav.tabs button:hover { color: var(--lilac-dark); background: var(--lilac-soft); }
nav.tabs button.active {
  background: linear-gradient(135deg, var(--lilac), var(--pink));
  color: #fff; box-shadow: 0 4px 14px rgba(183, 157, 247, .4);
}

main {
  flex: 1; min-height: 0; width: 100%;
  padding: 18px 20px 14px;
  display: flex; flex-direction: column; overflow: hidden;
}
.tab { display: none; }
.tab.active { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow: hidden; }
/* tab chrome (title rows) keeps its natural height; the tab's main panel
   grows to fill the remaining height */
.tab.active > .row { flex: none; }
.tab.active > .inbox,
.tab.active > .tpl-gallery,
.tab.active > .bots-layout,
.tab.active > .wh-layout,
.tab.active > .pane-scroll { flex: 1; min-height: 0; }
/* generic inner scroll region for tabs whose content is a stack of cards */
.pane-scroll { overflow-y: auto; padding: 2px 2px 10px; }

.card {
  background: var(--card); border: 1px solid rgba(255,255,255,.9);
  border-radius: var(--radius); padding: 22px; margin-bottom: 18px;
  box-shadow: var(--shadow-soft);
}
.card h3 { margin: 0 0 14px; font-size: 16px; font-weight: 700; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
label.field { display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 600; color: var(--muted); flex: 1; min-width: 160px; }

input, select, textarea {
  border: 1.5px solid var(--line); border-radius: 14px; padding: 11px 14px;
  font-size: 14px; font-family: inherit; background: #fff; color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: #c3b8dd; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--lilac);
  box-shadow: 0 0 0 4px rgba(183, 157, 247, .16);
}
textarea { resize: vertical; min-height: 80px; }

button.btn {
  border: none; border-radius: 999px; padding: 11px 24px; font-size: 14px; font-weight: 700; cursor: pointer;
  background: linear-gradient(135deg, var(--lilac), var(--pink)); color: #fff;
  box-shadow: 0 4px 14px rgba(183, 157, 247, .35);
  transition: transform .12s ease, box-shadow .12s ease, filter .12s;
}
button.btn:hover { filter: brightness(1.04); transform: translateY(-1px); box-shadow: 0 8px 20px rgba(183, 157, 247, .4); }
button.btn:active { transform: translateY(0); }
button.btn:disabled { opacity: .5; cursor: default; transform: none; box-shadow: none; }
button.ghost { background: #fff; color: var(--lilac-dark); border: 1.5px solid var(--lilac); box-shadow: none; }
button.ghost:hover { background: var(--lilac-soft); }
button.danger { background: #fff; color: #dc2626; border: 1.5px solid #fca5a5; box-shadow: none; }
button.small { padding: 7px 14px; font-size: 12px; }

.badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 4px 12px; border-radius: 999px; background: var(--lilac-soft); color: var(--lilac-dark); }
.badge.green { background: #d9f7e8; color: #12805c; }
.badge.amber { background: #fdf0d7; color: #b45309; }
.badge.red { background: #fee2e2; color: #b91c1c; }
.badge.gray { background: #f1f0f7; color: var(--muted); }
.muted { color: var(--muted); font-size: 13px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; background: var(--lilac-soft); padding: 2px 8px; border-radius: 8px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .6px; padding: 10px; border-bottom: 1px solid var(--line); }
td { padding: 10px; border-bottom: 1px solid #f6f1fc; vertical-align: top; }

/* conversations */
.inbox {
  display: grid; grid-template-columns: 300px 1fr 300px; gap: 0;
  border: 1px solid rgba(255,255,255,.9); border-radius: 24px; overflow: hidden;
  background: var(--card); box-shadow: var(--shadow-soft);
}
.conv-list { border-right: 1px solid var(--line); overflow-y: auto; min-height: 0; min-width: 0; background: #fff; }
.conv { padding: 14px 16px; border-bottom: 1px solid #f6f1fc; cursor: pointer; display: flex; gap: 12px; align-items: center; transition: background .12s; }
.conv:hover { background: #fbf8ff; }
.conv.active { background: linear-gradient(135deg, var(--lilac-soft), var(--pink-soft)); }
.wicon { font-size: 12px; margin-left: 6px; flex: none; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: linear-gradient(135deg, var(--lilac), var(--pink)); color: #fff; font-weight: 700; font-size: 13px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; box-shadow: 0 3px 10px rgba(183,157,247,.3); }
.avatar.lg { width: 30px; height: 30px; font-size: 11px; }
.conv .who { font-weight: 700; font-size: 14px; display: flex; justify-content: space-between; align-items: center; }
.conv .prev { font-size: 12.5px; color: var(--muted); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread-wrap { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
#threadHead, #handoverBanner, .replybar { flex: none; }
.thread { flex: 1; min-height: 0; overflow-y: auto; padding: 20px; background: linear-gradient(180deg, #f8f4fe, #fdf6fa); display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 72%; padding: 11px 15px; border-radius: 20px; font-size: 14px; line-height: 1.5; word-break: break-word; }
.msg.in { background: #fff; align-self: flex-start; border-bottom-left-radius: 6px; box-shadow: 0 2px 8px rgba(0,0,0,.05); }
.msg.out { background: linear-gradient(135deg, #e2d4fc, #f6c9e2); align-self: flex-end; border-bottom-right-radius: 6px; box-shadow: 0 2px 8px rgba(183,157,247,.18); }
.msg .meta { font-size: 10.5px; color: var(--muted); margin-top: 5px; text-align: right; }
.msg .tag { font-size: 10px; font-weight: 700; color: var(--lilac-dark); }
.replybar { padding: 14px 16px; border-top: 1px solid var(--line); background: rgba(255,255,255,.9); }
.replybar .row { margin-bottom: 8px; }
.empty { text-align: center; color: var(--muted); padding: 60px 20px; }

/* contact details sidebar (right column of conversations) */
.contact-side { border-left: 1px solid var(--line); overflow-y: auto; min-height: 0; min-width: 0; background: #fff; padding: 18px; }
.avatar.xl { width: 72px; height: 72px; font-size: 22px; }
.cs-photo { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; box-shadow: 0 3px 10px rgba(183,157,247,.3); }
.cs-row { margin-bottom: 12px; }
.cs-k { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); display: block; margin-bottom: 4px; }
.cs-v { font-size: 13.5px; word-break: break-word; line-height: 1.5; }

/* handover + bot-paused banners */
.handover-banner {
  background: linear-gradient(135deg, var(--pink-soft), var(--lilac-soft));
  border-bottom: 1.5px solid var(--pink);
  padding: 12px 18px; font-size: 13.5px; color: var(--ink);
}
.paused-banner {
  background: #fdf0d7; color: #b45309;
  padding: 10px 18px; font-size: 13px;
  display: flex; align-items: center; gap: 12px;
}
.closed-banner {
  background: #eef0f4; color: #5b6472;
  padding: 10px 18px; font-size: 13px;
  display: flex; align-items: center; gap: 12px;
}
/* closed conversation rows render dimmed */
.conv.closed { opacity: .55; }
.closed-badge {
  font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .5px;
  background: #e8eaf0; color: #6b7280; border-radius: 8px; padding: 2px 8px; margin-left: 6px; flex: none;
}
/* All / Open / Closed segmented filter */
.seg { display: inline-flex; background: #f1edfb; border-radius: 12px; padding: 3px; gap: 2px; }
.seg button {
  border: none; background: transparent; border-radius: 9px; padding: 5px 12px;
  font-size: 12.5px; font-weight: 700; color: var(--muted); cursor: pointer;
}
.seg button.on { background: #fff; color: var(--lilac-dark); box-shadow: 0 1px 4px rgba(0,0,0,.08); }
/* template card title: never spill outside the card */
.tpl-name { font-weight: 700; font-size: 14px; overflow-wrap: anywhere; word-break: break-word; }
/* neutral media placeholder (no emoji) for templates without preview media */
.ph-media-neutral {
  background: #f1eefb; border: 1.5px dashed #cfc4ef; border-radius: 12px;
  padding: 22px; text-align: center; margin-bottom: 8px;
  font-size: 12px; font-weight: 700; color: #9b8fd0; text-transform: uppercase; letter-spacing: .8px;
}
@media (max-width: 1150px) {
  .inbox { grid-template-columns: 280px 1fr; grid-template-rows: minmax(0, 1fr) auto; overflow: hidden; }
  .contact-side { grid-column: 1 / -1; border-left: none; border-top: 1px solid var(--line); max-height: 230px; }
}

/* modal */
.modal-bg { position: fixed; inset: 0; background: rgba(58, 47, 82, .4); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); display: none; align-items: center; justify-content: center; z-index: 150; padding: 20px; }
.modal-bg.open { display: flex; }
.modal { background: #fff; border-radius: 24px; padding: 26px; width: 100%; max-width: 640px; max-height: 88vh; overflow-y: auto; box-shadow: 0 24px 70px rgba(58,47,82,.25); }
.modal h3 { margin-top: 0; }
.action-row, .btn-row, .param-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }
.action-row { background: #fbf8ff; border: 1px solid var(--line); border-radius: 14px; padding: 12px; }
.log { background: #2e2647; color: #d8ccff; border-radius: 14px; padding: 14px; font-family: ui-monospace, monospace; font-size: 12px; max-height: 260px; overflow-y: auto; white-space: pre-wrap; }
.toast { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%); background: #3a2f52; color: #fff; padding: 13px 26px; border-radius: 999px; font-size: 14px; z-index: 200; display: none; box-shadow: 0 10px 30px rgba(0,0,0,.25); max-width: 90vw; }
.toast.show { display: block; }
.toast.err { background: #c0392b; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 760px) {
  .grid2 { grid-template-columns: 1fr; }
  .inbox { grid-template-columns: 1fr; display: block; overflow-y: auto; }
  .conv-list { max-height: 240px; border-right: none; border-bottom: 1px solid var(--line); }
  .thread-wrap { height: 62vh; min-height: 340px; }
  .contact-side { border-left: none; border-top: 1px solid var(--line); overflow: visible; }
}
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
.media-card { border: 1px solid var(--line); border-radius: 18px; overflow: hidden; background: #fff; box-shadow: var(--shadow-soft); transition: transform .12s, box-shadow .12s; }
.media-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.media-card img, .media-card video { width: 100%; height: 120px; object-fit: cover; background: var(--lilac-soft); display: block; }
.media-card .mbody { padding: 10px 12px; font-size: 12px; }
.drop { border: 2px dashed var(--lilac); border-radius: var(--radius); padding: 30px; text-align: center; color: var(--muted); cursor: pointer; background: rgba(255,255,255,.6); transition: background .15s; }
.drop:hover { background: var(--lilac-soft); }
.steps { counter-reset: s; padding-left: 0; list-style: none; }
.steps li { counter-increment: s; margin-bottom: 12px; font-size: 13.5px; padding-left: 36px; position: relative; line-height: 1.5; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 26px; height: 26px; border-radius: 50%; background: linear-gradient(135deg, var(--lilac), var(--pink)); color: #fff; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; box-shadow: 0 3px 10px rgba(183,157,247,.35); }

/* ---- send drawer ---- */
.drawer-bg { position: fixed; inset: 0; background: rgba(58, 47, 82, .35); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); display: none; z-index: 120; }
.drawer-bg.open { display: block; }
.drawer {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(480px, 94vw);
  background: rgba(255,255,255,.96);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  box-shadow: -16px 0 50px rgba(183, 157, 247, .2);
  padding: 24px; overflow-y: auto; animation: slidein .24s ease-out;
  border-radius: 24px 0 0 24px;
}
@keyframes slidein { from { transform: translateX(50px); opacity: .4; } to { transform: none; opacity: 1; } }
.drawer-tabs { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.drawer-tabs button { border: 1.5px solid var(--line); background: #fff; border-radius: 999px; padding: 9px 16px; font-size: 13px; font-weight: 700; color: var(--muted); cursor: pointer; transition: all .15s; }
.drawer-tabs button:hover { border-color: var(--lilac); color: var(--lilac-dark); }
.drawer-tabs button.active { background: linear-gradient(135deg, var(--lilac), var(--pink)); color: #fff; border-color: transparent; box-shadow: 0 4px 14px rgba(183,157,247,.35); }
.window-banner { border-radius: 14px; padding: 11px 16px; font-size: 13px; font-weight: 600; }
.window-banner.open { background: #d9f7e8; color: #12805c; }
.window-banner.closed { background: #fdf0d7; color: #b45309; }

/* ---- template cards + phone preview ---- */
.tpl-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 18px; overflow-y: auto; padding: 4px 2px 14px; align-content: start; }
.tpl-card { background: var(--card); border: 1px solid rgba(255,255,255,.9); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-soft); cursor: pointer; transition: transform .14s, box-shadow .14s; }
.tpl-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }
.tpl-card .chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0; }
.tpl-preview { background: linear-gradient(180deg, #f8f4fe, #fdf6fa); border-radius: 16px; padding: 14px; font-size: 13px; line-height: 1.55; }
.tpl-preview .ph { font-weight: 700; margin-bottom: 6px; }
.tpl-preview .ph-media { background: var(--lilac-soft); border-radius: 12px; padding: 20px; text-align: center; margin-bottom: 8px; font-size: 24px; }
.tpl-preview .pf { color: var(--muted); font-size: 12px; margin-top: 6px; }
.tpl-preview .pbtns { margin-top: 8px; display: flex; flex-direction: column; gap: 5px; }
.tpl-preview .pbtn { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 7px; text-align: center; color: var(--lilac-dark); font-weight: 600; font-size: 12.5px; }
.tpl-preview .var, .phone-bubble .var { background: var(--pink-soft); color: var(--pink-deep); border-radius: 6px; padding: 0 6px; font-weight: 700; font-size: 12px; }
.tpl-preview img { border-radius: 12px; }
.tpl-sendbox { margin-top: 12px; border-top: 1px dashed var(--line); padding-top: 12px; }
.phone { width: 260px; margin: 0 auto; background: linear-gradient(180deg, #f3ecfd, #fdeef5); border-radius: 30px; padding: 18px 14px; border: 7px solid #3a2f52; box-shadow: var(--shadow-lift); }
.phone-bubble { background: #fff; border-radius: 16px; padding: 14px; font-size: 13px; line-height: 1.55; box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.phone-bubble .pf { color: var(--muted); font-size: 11.5px; margin-top: 6px; }
.phone-bubble .pbtns { margin-top: 8px; display: flex; flex-direction: column; gap: 4px; }
.phone-bubble .pbtn { border-top: 1px solid var(--line); padding: 8px; text-align: center; color: var(--lilac-dark); font-weight: 600; font-size: 12.5px; }
.tpl-builder { display: grid; grid-template-columns: 1fr 290px; gap: 22px; }
@media (max-width: 700px) { .tpl-builder { grid-template-columns: 1fr; } }

/* ---- bots layout ---- */
.bots-layout { display: grid; grid-template-columns: 310px 1fr; grid-template-rows: minmax(0, 1fr); gap: 18px; overflow: hidden; }
.card.bots-list { overflow-y: auto; min-height: 0; min-width: 0; margin-bottom: 0; }
.bots-main { min-width: 0; min-height: 0; overflow-y: auto; padding-bottom: 6px; }
@media (max-width: 900px) {
  .bots-layout { grid-template-columns: 1fr; grid-template-rows: none; display: block; overflow-y: auto; }
  .card.bots-list { margin-bottom: 18px; max-height: 320px; }
}
.bot-row { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border-radius: 14px; cursor: pointer; border: 1.5px solid transparent; transition: background .12s; }
.bot-row:hover { background: #fbf8ff; }
.bot-row.selected { background: linear-gradient(135deg, var(--lilac-soft), var(--pink-soft)); border-color: var(--lilac); }
.switch { position: relative; width: 42px; height: 24px; flex: none; margin-top: 2px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .sl { position: absolute; inset: 0; background: #ddd3f5; border-radius: 999px; cursor: pointer; transition: .2s; }
.switch .sl::before { content: ""; position: absolute; width: 17px; height: 17px; left: 3.5px; top: 3.5px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked + .sl { background: linear-gradient(135deg, var(--lilac), var(--pink)); }
.switch input:checked + .sl::before { transform: translateX(18px); }

/* ---- flow canvas (roomier) ---- */
.flow-cols { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
@media (max-width: 1000px) { .flow-cols { grid-template-columns: 1fr; } }
.flow-cols > .card { display: flex; flex-direction: column; min-height: 0; }
.palette { display: flex; gap: 9px; flex-wrap: wrap; margin-bottom: 14px; flex: none; }
.pal-item { display: flex; align-items: center; gap: 8px; background: #fff; border: 1.5px dashed var(--lilac); border-radius: 14px; padding: 9px 15px; font-size: 13px; font-weight: 700; color: var(--lilac-dark); cursor: grab; user-select: none; box-shadow: var(--shadow-soft); transition: background .12s; }
.pal-item:hover { background: var(--lilac-soft); }
.pal-item.disabled { opacity: .45; cursor: default; border-style: solid; }
.canvas-wrap {
  position: relative; width: 100%;
  height: 600px; min-height: 600px; max-height: 600px; flex: none;
  background: #fff; border: 1px solid rgba(255,255,255,.9); border-radius: 22px; overflow: hidden;
  box-shadow: var(--shadow-soft);
  cursor: grab; touch-action: none;
}
.canvas-wrap.panning { cursor: grabbing; }
/* pannable/zoomable world — the dot grid moves with the content */
#flowWorld {
  position: absolute; left: 0; top: 0; width: 6000px; height: 4000px;
  transform-origin: 0 0;
  background-image: radial-gradient(#e3d6fa 1.3px, transparent 1.3px); background-size: 24px 24px;
}
#flowSvg { position: absolute; left: 0; top: 0; width: 6000px; height: 4000px; pointer-events: none; }
#flowNodes { position: absolute; inset: 0; }
.canvas-zoom {
  position: absolute; right: 12px; bottom: 12px; z-index: 5;
  display: flex; gap: 2px; align-items: center;
  background: rgba(255,255,255,.92); border: 1px solid var(--line);
  border-radius: 999px; padding: 4px 6px; box-shadow: var(--shadow-soft);
}
.canvas-zoom button {
  border: none; background: none; font-size: 15px; font-weight: 700; cursor: pointer;
  padding: 3px 9px; border-radius: 8px; color: var(--lilac-dark);
}
.canvas-zoom button:hover { background: var(--lilac-soft); }
.canvas-zoom span { font-size: 11px; color: var(--muted); min-width: 42px; text-align: center; }
.canvas-hint {
  position: absolute; left: 12px; bottom: 12px; z-index: 5; pointer-events: none;
  font-size: 11px; color: var(--muted); background: rgba(255,255,255,.78);
  padding: 5px 11px; border-radius: 999px;
}
.fnode { position: absolute; width: 210px; background: #fff; border: 2px solid var(--lilac); border-radius: 16px; box-shadow: 0 6px 18px rgba(183,157,247,.16); cursor: default; }
.fnode.selected { border-color: var(--pink-deep); box-shadow: 0 0 0 4px rgba(229,106,165,.16), 0 6px 18px rgba(183,157,247,.2); }
.fnode-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; background: linear-gradient(135deg, var(--lilac-soft), var(--pink-soft)); border-radius: 14px 14px 0 0; cursor: move; font-size: 13px; font-weight: 700; }
.fnode-head .fx { margin-left: auto; cursor: pointer; color: var(--muted); font-size: 12px; padding: 2px 8px; border-radius: 8px; }
.fnode-head .fx:hover { background: #fee2e2; color: #b91c1c; }
.fnode-body { padding: 10px 12px; font-size: 12px; color: var(--muted); max-height: 140px; overflow: hidden; line-height: 1.5; }
.fnode-body .var { background: var(--pink-soft); color: var(--pink-deep); border-radius: 5px; padding: 0 5px; font-weight: 700; }
.fhandles { position: absolute; right: -7px; top: 0; bottom: 0; width: 14px; }
.fhandle { position: absolute; width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 2.5px solid var(--lilac-dark); cursor: crosshair; box-shadow: 0 2px 6px rgba(139,92,246,.3); }
.fhandle.out { bottom: -7px; transform: translateX(-50%); }
.fhandle.out:hover { background: var(--lilac-dark); }
.fhandle.in { top: -7px; left: 50%; transform: translateX(-50%); cursor: default; }
.fhandle-lbl { position: absolute; top: calc(100% + 4px); transform: translateX(-50%); font-size: 10px; font-weight: 700; color: var(--lilac-dark); background: #fff; padding: 2px 8px; border-radius: 8px; border: 1px solid var(--line); white-space: nowrap; pointer-events: none; box-shadow: var(--shadow-soft); }
.cond-row, .kv-row { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; flex-wrap: wrap; }
.cond-row { background: #fbf8ff; border: 1px solid var(--line); border-radius: 10px; padding: 9px; }
.cond-num { font-weight: 800; color: var(--lilac-dark); font-size: 12px; }

/* ---- webhooks tab (reference-style) ---- */
.wh-layout { display: grid; grid-template-columns: 250px 1fr; grid-template-rows: minmax(0, 1fr); gap: 18px; overflow: hidden; }
.wh-rail { padding: 18px; margin-bottom: 0; overflow-y: auto; min-height: 0; min-width: 0; }
.wh-main { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.wh-main > .row { flex: none; }
#webhookList { overflow-y: auto; min-height: 0; padding-bottom: 10px; }
@media (max-width: 900px) {
  .wh-layout { grid-template-columns: 1fr; display: block; overflow-y: auto; }
  .wh-rail { margin-bottom: 18px; }
}
.wh-fgroup { margin-bottom: 20px; }
.wh-fgroup:last-child { margin-bottom: 0; }
.wh-flabel { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); margin-bottom: 10px; }
.wh-fbtns { display: flex; flex-direction: column; gap: 6px; }
.wh-fbtn {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  border: 1.5px solid var(--line); background: #fff; border-radius: 12px;
  padding: 9px 13px; font-size: 13px; font-weight: 600; color: var(--ink);
  cursor: pointer; transition: all .14s ease; text-align: left; width: 100%;
}
.wh-fbtn:hover { border-color: var(--lilac); background: #fbf8ff; }
.wh-fbtn.active {
  background: linear-gradient(135deg, var(--lilac), var(--pink)); color: #fff; border-color: transparent;
  box-shadow: 0 4px 14px rgba(183, 157, 247, .35);
}
.wh-fbtn.active .wh-count { background: rgba(255,255,255,.25); color: #fff; }
.wh-count {
  font-size: 11px; font-weight: 800; background: var(--lilac-soft); color: var(--lilac-dark);
  border-radius: 999px; padding: 2px 9px; min-width: 28px; text-align: center;
}
.wh-ev { margin-bottom: 12px; padding: 18px 20px; }
.wh-error {
  margin-top: 8px; font-family: ui-monospace, monospace; font-size: 12px;
  color: #c0392b; background: #fdeceb; border-radius: 10px; padding: 8px 12px;
}
.wh-details summary {
  cursor: pointer; font-size: 13px; font-weight: 700; color: var(--lilac-dark);
  background: var(--lilac-soft); border-radius: 999px; padding: 8px 16px;
  display: inline-block; transition: background .12s;
}
.wh-details summary:hover { background: #e2d4fb; }
.wh-details summary::marker { content: ''; }
.wh-details summary::before { content: '▸ '; }
.wh-details[open] summary::before { content: '▾ '; }
.varchip { display: inline-block; background: var(--lilac-soft); color: var(--lilac-dark); border-radius: 8px; padding: 3px 9px; font-size: 11.5px; font-weight: 700; margin: 2px 4px 2px 0; font-family: ui-monospace, monospace; }
.trace-line { padding: 3px 0; border-bottom: 1px solid #2e2845; }
