/* ---------- base ---------- */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: #1f2937;
  background: #f3f4f6;
  display: flex;
  flex-direction: column;
}
button { font-family: inherit; cursor: pointer; }

/* ---------- top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px;
  background: #111b21;
  color: #fff;
  flex: 0 0 auto;
}
.topbar__brand { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.topbar__logo { font-size: 18px; }
.topbar__badge {
  font-size: 11px; font-weight: 500;
  background: #2a3942; color: #8696a0;
  padding: 2px 8px; border-radius: 999px;
}
.topbar__actions { display: flex; gap: 10px; }

.btn {
  border: none; border-radius: 8px;
  padding: 8px 16px; font-size: 14px; font-weight: 600;
  transition: filter .15s, background .15s;
}
.btn--ghost { background: transparent; color: #d1d7db; border: 1px solid #3b4a54; }
.btn--ghost:hover { background: #2a3942; }
.btn--primary { background: #00a884; color: #111b21; border: none; }
.btn--primary:hover { background: #06cf9c; }
.btn--play { background: #25d366; color: #06291a; }
.btn--play:hover { filter: brightness(1.06); }
.topbar__sep { width: 1px; height: 24px; background: #3b4a54; margin: 0 4px; }

/* ---------- layout ---------- */
.layout {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 0;
}
.panel-title {
  margin: 0 0 4px;
  font-size: 13px; text-transform: uppercase; letter-spacing: .06em;
  color: #6b7280;
}

/* ---------- toolbox ---------- */
.toolbox {
  background: #fff;
  border-right: 1px solid #e5e7eb;
  padding: 18px 16px;
  overflow-y: auto;
}
.toolbox__hint { font-size: 12px; color: #9ca3af; margin: 0 0 14px; }
.tool {
  display: flex; align-items: center; gap: 12px;
  width: 100%; text-align: left;
  background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 10px;
  padding: 12px; margin-bottom: 10px;
  transition: border-color .15s, box-shadow .15s, transform .05s;
}
.tool:hover { border-color: #25d366; box-shadow: 0 2px 8px rgba(37,211,102,.15); }
.tool:active { transform: translateY(1px); }
.tool__icon { font-size: 20px; }
.tool__meta { display: flex; flex-direction: column; }
.tool__name { font-weight: 600; font-size: 14px; }
.tool__desc { font-size: 12px; color: #9ca3af; }

/* ---------- canvas ---------- */
/* viewport = fixed window; world = pannable/zoomable plane inside it */
.canvas-wrap {
  position: relative; overflow: hidden;
  background: #eef1f4;
  background-image:
    linear-gradient(#e2e7ec 1px, transparent 1px),
    linear-gradient(90deg, #e2e7ec 1px, transparent 1px);
  background-size: 24px 24px;
  cursor: grab;
}
.canvas-wrap.panning { cursor: grabbing; }
.world { position: absolute; top: 0; left: 0; transform-origin: 0 0; will-change: transform; }

/* control bar */
.canvas-toolbar {
  position: absolute; top: 12px; right: 14px; z-index: 20;
  display: flex; align-items: center; gap: 6px;
  background: #fff; border: 1px solid #e5e7eb; border-radius: 10px;
  padding: 4px 6px; box-shadow: 0 2px 6px rgba(0,0,0,.08);
}
.ctl {
  border: none; background: #f3f4f6; border-radius: 7px;
  width: 28px; height: 28px; font-size: 16px; color: #374151;
  display: flex; align-items: center; justify-content: center;
}
.ctl:hover { background: #e5e7eb; }
.ctl--text { width: auto; padding: 0 10px; font-size: 12px; font-weight: 600; }
.ctl__zoom { font-size: 12px; color: #6b7280; min-width: 38px; text-align: center; }
.ctl__sep { width: 1px; height: 18px; background: #e5e7eb; margin: 0 2px; }

/* SVG layer that draws the real branch connectors behind the cards */
.links { position: absolute; top: 0; left: 0; overflow: visible; pointer-events: none; z-index: 0; }
.link-halo { fill: none; stroke: #eef1f4; stroke-width: 7; stroke-linecap: round; }
.link-path { fill: none; stroke: #8b95a4; stroke-width: 2.25; stroke-linecap: round; }
.link-port { fill: #8b95a4; stroke: #fff; stroke-width: 1.5; }
.link-label { font-size: 11px; font-weight: 600; fill: #475569; font-family: inherit; text-anchor: middle; dominant-baseline: middle; }
.link-label-bg { fill: #fff; stroke: #d6dbe1; stroke-width: 1; }

.empty {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: #9ca3af; text-align: center; pointer-events: none; padding: 0 20px;
}
.empty p { margin: 4px; }
.empty__sub { font-size: 13px; max-width: 360px; }

/* node card — absolutely positioned in the world */
.node {
  position: absolute; width: 280px;
  background: #fff; border: 1px solid #e5e7eb; border-radius: 12px;
  padding: 14px; box-shadow: 0 2px 8px rgba(0,0,0,.10);
  z-index: 1;
}
.node.is-dragging { z-index: 30; box-shadow: 0 14px 32px rgba(0,0,0,.26); transform: scale(1.015); cursor: grabbing; }
/* while a node is being dragged, force the grab cursor everywhere */
body.is-dragging-node, body.is-dragging-node * { cursor: grabbing !important; user-select: none !important; }
.node.is-start { border-color: #25d366; box-shadow: 0 0 0 2px rgba(37,211,102,.18); }
.node__head {
  display: flex; align-items: center; gap: 8px; margin-bottom: 10px;
  cursor: move; user-select: none;
}
.node__icon { font-size: 15px; }
.node__titlewrap { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.node__name {
  border: none; background: transparent; width: 100%;
  font-weight: 600; font-size: 14px; color: #1f2937; font-family: inherit;
  padding: 2px 4px; border-radius: 5px;
}
.node__name::placeholder { color: #1f2937; font-weight: 600; opacity: 1; }
.node__name:hover { background: #f3f4f6; }
.node__name:focus { outline: none; background: #fff; box-shadow: 0 0 0 2px rgba(37,211,102,.25); }
.node__type { font-size: 11px; color: #9ca3af; font-weight: 500; padding: 0 4px; }
.node__spacer { flex: 1; }
.node__start {
  display: flex; align-items: center; gap: 5px;
  font-size: 11px; color: #6b7280; cursor: pointer; user-select: none;
}
.node__del {
  border: none; background: transparent; color: #9ca3af;
  font-size: 16px; line-height: 1; padding: 2px 4px; border-radius: 6px;
}
.node__del:hover { background: #fee2e2; color: #dc2626; }

.field { display: block; margin-bottom: 10px; }
.field__label { display: block; font-size: 11px; color: #6b7280; margin-bottom: 4px; }
.field textarea, .field input, .field select {
  width: 100%; border: 1px solid #d1d5db; border-radius: 8px;
  padding: 8px 10px; font-size: 13px; font-family: inherit; color: #1f2937;
  resize: vertical;
}
.field textarea:focus, .field input:focus, .field select:focus {
  outline: none; border-color: #25d366; box-shadow: 0 0 0 2px rgba(37,211,102,.15);
}
.charcount { font-size: 10px; color: #9ca3af; float: right; }

/* quick-reply buttons editor */
.qr-btns { display: flex; flex-direction: column; gap: 8px; }
.qr-btn {
  display: grid; grid-template-columns: 1fr 150px auto; gap: 6px; align-items: center;
}
.qr-btn input { font-size: 13px; }
.qr-btn__del {
  border: none; background: transparent; color: #9ca3af; font-size: 15px;
  padding: 4px; border-radius: 6px;
}
.qr-btn__del:hover { background: #fee2e2; color: #dc2626; }
.qr-add {
  margin-top: 8px; background: #f0fdf4; color: #15803d;
  border: 1px dashed #86efac; border-radius: 8px; padding: 7px; width: 100%;
  font-size: 13px; font-weight: 600;
}
.qr-add:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- simulator ---------- */
.sim { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; }
.sim[hidden] { display: none; }
.sim__backdrop { position: absolute; inset: 0; background: rgba(15,23,42,.6); backdrop-filter: blur(2px); }

.phone {
  position: relative; width: 360px; height: 720px; max-height: 92vh;
  background: #000; border-radius: 38px; padding: 10px;
  box-shadow: 0 25px 60px rgba(0,0,0,.5);
}
.phone__notch {
  position: absolute; top: 14px; left: 50%; transform: translateX(-50%);
  width: 120px; height: 22px; background: #000; border-radius: 0 0 14px 14px; z-index: 3;
}
.wa {
  width: 100%; height: 100%; border-radius: 30px; overflow: hidden;
  display: flex; flex-direction: column; background: #efeae2;
}
.wa__header {
  display: flex; align-items: center; gap: 10px;
  background: #075e54; color: #fff; padding: 30px 12px 10px; flex: 0 0 auto;
}
.wa__back, .wa__reset {
  background: transparent; border: none; color: #fff; font-size: 20px; line-height: 1; padding: 2px 4px;
}
.wa__reset { margin-left: auto; font-size: 18px; }
.wa__avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: #cbd5e1; color: #075e54; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.wa__title { display: flex; flex-direction: column; line-height: 1.2; }
.wa__title small { font-size: 11px; opacity: .85; }

.wa__chat {
  flex: 1 1 auto; overflow-y: auto; padding: 14px 10px;
  background-color: #efeae2;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40'%3E%3Ccircle cx='20' cy='20' r='1' fill='%23d8d2c8'/%3E%3C/svg%3E");
  display: flex; flex-direction: column; gap: 4px;
}

.bubble {
  max-width: 78%; padding: 7px 10px 8px; border-radius: 9px;
  font-size: 13.5px; line-height: 1.35; position: relative;
  box-shadow: 0 1px 1px rgba(0,0,0,.08); white-space: pre-wrap; word-wrap: break-word;
  animation: pop .18s ease;
}
@keyframes pop { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.bubble--in { background: #fff; align-self: flex-start; border-top-left-radius: 2px; }
.bubble--out { background: #d9fdd3; align-self: flex-end; border-top-right-radius: 2px; }
.bubble__time { display: block; font-size: 10px; color: #667781; text-align: right; margin-top: 2px; }

/* quick reply buttons in chat */
.qr-actions { align-self: flex-start; width: 78%; display: flex; flex-direction: column; gap: 4px; margin-top: 2px; }
.qr-action {
  background: #fff; border: none; border-radius: 8px;
  color: #009de2; font-size: 14px; font-weight: 500; padding: 10px;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  box-shadow: 0 1px 1px rgba(0,0,0,.08);
}
.qr-action:hover { background: #f5f5f5; }
.qr-action:disabled { color: #9ca3af; cursor: default; }
.qr-action__icon { font-size: 13px; }

.wa__inputbar {
  flex: 0 0 auto; display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; background: #f0f0f0;
}
.wa__inputfield {
  flex: 1; background: #fff; border: none; border-radius: 18px; padding: 9px 14px;
  color: #1f2937; font-size: 13px; font-family: inherit;
}
.wa__inputfield:focus { outline: none; }
.wa__send {
  flex: 0 0 auto; width: 38px; height: 38px; border: none; border-radius: 50%;
  background: #00a884; color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center; font-size: 15px;
}
.wa__send:hover { filter: brightness(1.05); }

/* fallback / unrecognized-input notice */
.bubble--error {
  background: #fff4e5; align-self: flex-start; border-top-left-radius: 2px;
  color: #92400e; border: 1px solid #fde0b2;
}

.sim__empty { margin: auto; color: #667781; text-align: center; font-size: 13px; padding: 20px; }

/* ---------- editor: list & carousel sub-fields ---------- */
.qr-add--sm { padding: 5px; font-size: 12px; margin-top: 6px; }
.sub-sec, .sub-card {
  border: 1px solid #e5e7eb; border-radius: 9px; padding: 9px; margin-bottom: 8px; background: #fafafa;
}
.sub-sec__head, .sub-card__head { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.sub-sec__head input { flex: 1; }
.sub-card__title { font-size: 12px; font-weight: 600; color: #6b7280; flex: 1; }
.sub-row { border-top: 1px dashed #e5e7eb; padding-top: 7px; margin-top: 7px; display: flex; flex-direction: column; gap: 5px; }
.sub-card input { margin-bottom: 5px; }
.sub-row__next { display: flex; gap: 6px; align-items: center; }
.sub-row__next select { flex: 1; }
.sub-row__next input { flex: 1; }

/* ---------- simulator: CTA link button ---------- */
.qr-action--link { text-decoration: none; }
.qr-action.is-disabled { color: #9ca3af; pointer-events: none; }

/* ---------- simulator: image / media bubble ---------- */
.bubble--media { padding: 4px 4px 6px; max-width: 75%; }
.wa-img { border-radius: 7px; overflow: hidden; }
.wa-img img { display: block; width: 100%; max-height: 220px; object-fit: cover; }
.wa-img--ph {
  height: 150px; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #d4dbe2, #c2ccd6);
}
.wa-img--broken { height: 150px; display: flex; align-items: center; justify-content: center; background: #e5e7eb; }
.wa-img--broken::after { content: "image unavailable"; font-size: 11px; color: #6b7280; }
.wa-img__icon { font-size: 34px; opacity: .65; }
.wa-img__cap { font-size: 13px; color: #111b21; padding: 6px 5px 0; }

/* ---------- simulator: list bottom sheet ---------- */
.wa { position: relative; }
.wa-list-trigger { font-weight: 600; }
.wa-sheet {
  position: absolute; inset: 0; z-index: 5;
  background: rgba(0,0,0,.35); display: flex; align-items: flex-end;
  animation: fade .15s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.wa-sheet__panel {
  width: 100%; max-height: 72%; overflow-y: auto;
  background: #fff; border-radius: 16px 16px 0 0; padding-bottom: 8px;
  animation: slideup .2s ease;
}
@keyframes slideup { from { transform: translateY(30px); } to { transform: none; } }
.wa-sheet__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; font-weight: 600; color: #111b21; border-bottom: 1px solid #eee;
  position: sticky; top: 0; background: #fff;
}
.wa-sheet__close { border: none; background: transparent; font-size: 16px; color: #667781; }
.wa-sheet__sec { padding: 10px 16px 4px; font-size: 12px; font-weight: 700; color: #00a884; text-transform: uppercase; letter-spacing: .04em; }
.wa-sheet__row {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  background: transparent; border: none; border-bottom: 1px solid #f0f0f0; padding: 12px 16px;
}
.wa-sheet__row:hover { background: #f5f5f5; }
.wa-sheet__rowmain { flex: 1; }
.wa-sheet__rowtitle { font-size: 14px; color: #111b21; }
.wa-sheet__rowdesc { font-size: 12px; color: #667781; margin-top: 1px; }
.wa-sheet__radio { width: 18px; height: 18px; border-radius: 50%; border: 2px solid #c4c4c4; flex: 0 0 auto; }

/* ---------- simulator: carousel ---------- */
.wa-carousel {
  align-self: stretch; flex: 0 0 auto; display: flex; align-items: flex-start; gap: 8px; overflow-x: auto; padding: 2px 2px 8px;
  scroll-snap-type: x mandatory;
}
.wa-carousel::-webkit-scrollbar { height: 5px; }
.wa-carousel::-webkit-scrollbar-thumb { background: #c4ccd2; border-radius: 4px; }
.wa-card {
  flex: 0 0 180px; scroll-snap-align: start;
  background: #fff; border-radius: 9px; overflow: hidden;
  box-shadow: 0 1px 2px rgba(0,0,0,.12); display: flex; flex-direction: column;
}
.wa-card__img { height: 110px; }
.wa-card__img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.wa-card__title { font-size: 13px; font-weight: 600; color: #111b21; padding: 7px 9px 0; }
.wa-card__sub { font-size: 12px; color: #667781; padding: 2px 9px 7px; flex: 1; }
.wa-card__btn {
  border: none; border-top: 1px solid #eee; background: #fff;
  color: #009de2; font-size: 13px; font-weight: 600; padding: 9px;
}
.wa-card__btn:hover { background: #f5f5f5; }
.wa-card__btn:disabled { color: #9ca3af; }

/* ---------- toolbox group label ---------- */
.toolbox__group {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: #b0b7c0; margin: 14px 0 8px; padding-top: 12px; border-top: 1px solid #eef0f3;
}

/* ---------- simulator: audio ---------- */
.wa-audio { display: flex; align-items: center; gap: 9px; min-width: 170px; }
.wa-audio__play { color: #54656f; font-size: 13px; }
.wa-audio__bar { flex: 1; height: 3px; border-radius: 3px; background: linear-gradient(90deg, #00a884 35%, #c4ccd2 35%); }
.wa-audio__time { font-size: 11px; color: #667781; }

/* ---------- simulator: document ---------- */
.wa-doc { display: flex; align-items: center; gap: 9px; background: #f4f5f6; border-radius: 7px; padding: 9px 11px; min-width: 170px; }
.wa-doc__icon { font-size: 20px; }
.wa-doc__name { font-size: 13px; color: #111b21; word-break: break-all; }

/* ---------- simulator: sticker (no bubble background) ---------- */
.wa-sticker { align-self: flex-start; width: 120px; height: 120px; }
.wa-sticker img { width: 100%; height: 100%; object-fit: contain; }
.wa-sticker--ph { display: flex; align-items: center; justify-content: center; }
.wa-sticker__emoji { font-size: 64px; }

/* ---------- simulator: location ---------- */
.wa-loc__map {
  height: 110px; border-radius: 7px; display: flex; align-items: center; justify-content: center;
  background:
    repeating-linear-gradient(45deg, #cfe0cf, #cfe0cf 12px, #d8e6d8 12px, #d8e6d8 24px);
}
.wa-loc__pin { font-size: 30px; filter: drop-shadow(0 2px 2px rgba(0,0,0,.25)); }
.wa-loc__name { font-size: 13px; font-weight: 600; color: #111b21; padding: 6px 5px 0; }
.wa-loc__addr { font-size: 12px; color: #667781; padding: 1px 5px 0; }

/* ---------- simulator: contact card ---------- */
.wa-contact { display: flex; align-items: center; gap: 10px; min-width: 180px; padding-bottom: 8px; border-bottom: 1px solid #eee; }
.wa-contact__avatar {
  width: 40px; height: 40px; border-radius: 50%; background: #00a884; color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 700;
}
.wa-contact__name { font-size: 14px; font-weight: 600; color: #111b21; }
.wa-contact__phone { font-size: 12px; color: #667781; }
.wa-contact__action { text-align: center; color: #009de2; font-size: 13px; font-weight: 600; padding: 8px 0 2px; }

/* ---------- editor: form checkbox ---------- */
.wa-checkbox { display: flex; align-items: center; gap: 6px; font-size: 12px; color: #6b7280; margin-bottom: 10px; cursor: pointer; }
.wa-checkbox input { width: auto; }

/* ---------- simulator: native form modal ---------- */
.wa-form-trigger { font-weight: 600; }
.wa-form {
  position: absolute; inset: 0; z-index: 6; background: #fff;
  display: flex; flex-direction: column; animation: slideup .22s ease;
}
.wa-form__head {
  display: flex; align-items: center; justify-content: space-between;
  background: #075e54; color: #fff; padding: 14px 14px 12px; flex: 0 0 auto;
}
.wa-form__title { font-weight: 600; font-size: 15px; }
.wa-form__head .wa-sheet__close { color: #fff; }
.wa-form__body { flex: 1 1 auto; overflow-y: auto; padding: 16px 14px; background: #f7f8fa; }
.wa-form__field { margin-bottom: 16px; }
.wa-form__label { display: block; font-size: 13px; font-weight: 500; color: #111b21; margin-bottom: 6px; }
.wa-form__req { color: #e11d48; }
.wa-form__input {
  width: 100%; border: 1px solid #c4ccd2; border-radius: 8px;
  padding: 11px 12px; font-size: 14px; font-family: inherit; color: #111b21; background: #fff;
}
.wa-form__input:focus { outline: none; border-color: #00a884; box-shadow: 0 0 0 2px rgba(0,168,132,.18); }
.wa-form__radio { display: flex; flex-direction: column; gap: 8px; }
.wa-form__radioitem { display: flex; align-items: center; gap: 9px; font-size: 14px; color: #111b21; }
.wa-form__field.is-invalid .wa-form__input { border-color: #e11d48; box-shadow: 0 0 0 2px rgba(225,29,72,.14); }
.wa-form__field.is-invalid .wa-form__label { color: #e11d48; }
.wa-form__foot { flex: 0 0 auto; padding: 12px 14px; border-top: 1px solid #e5e7eb; background: #fff; }
.wa-form__submit {
  width: 100%; border: none; border-radius: 22px; padding: 12px;
  background: #00a884; color: #fff; font-size: 15px; font-weight: 600; cursor: pointer;
}
.wa-form__submit:hover { filter: brightness(1.04); }

/* ---------- simulator: emoji reaction badge ---------- */
.bubble__react {
  position: absolute; bottom: -10px; right: 6px;
  background: #fff; border-radius: 12px; padding: 1px 4px; font-size: 12px;
  box-shadow: 0 1px 2px rgba(0,0,0,.2);
}
.bubble--out .bubble__react { right: auto; left: 6px; }

/* ====================================================================
 * My Flows modal (cloud storage)
 * ==================================================================== */
.modal { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; }
.modal[hidden] { display: none; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(15,23,42,.6); backdrop-filter: blur(2px); }
.modal__panel {
  position: relative; width: min(560px, 92vw); max-height: 80vh; display: flex; flex-direction: column;
  background: #fff; border-radius: 14px; box-shadow: 0 24px 60px rgba(0,0,0,.35); overflow: hidden;
}
.modal__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; background: #111b21; color: #fff;
}
.modal__title { margin: 0; font-size: 16px; font-weight: 600; }
.modal__x { border: none; background: transparent; color: #d1d7db; font-size: 22px; line-height: 1; cursor: pointer; padding: 0 4px; }
.modal__x:hover { color: #fff; }
.modal__body { padding: 10px 14px 16px; overflow-y: auto; }
.modal__empty { color: #6b7280; text-align: center; padding: 28px 10px; font-size: 14px; }

.mf-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 12px; border: 1px solid #e5e7eb; border-radius: 10px; margin-top: 10px; background: #f9fafb;
}
.mf-row.mf-current { border-color: #00a884; box-shadow: 0 0 0 2px rgba(0,168,132,.15); }
.mf-meta { display: flex; flex-direction: column; min-width: 0; }
.mf-name { font-weight: 600; color: #111827; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mf-date { font-size: 12px; color: #6b7280; margin-top: 2px; }
.mf-actions { display: flex; gap: 6px; flex: 0 0 auto; }
.mf-actions .btn { padding: 6px 12px; font-size: 13px; border-radius: 8px; cursor: pointer; }
.mf-actions .btn--ghost { background: #fff; color: #374151; border: 1px solid #d1d5db; }
.mf-actions .btn--ghost:hover { background: #f3f4f6; }
.mf-actions .btn--danger { background: #fff; color: #dc2626; border: 1px solid #fca5a5; }
.mf-actions .btn--danger:hover { background: #fee2e2; }

/* Agent listening state + toast */
.btn--live { background: #25d366 !important; color: #06291a !important; border-color: #25d366 !important; animation: fb-pulse 1.6s ease-in-out infinite; }
@keyframes fb-pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(37,211,102,.5); } 50% { box-shadow: 0 0 0 5px rgba(37,211,102,0); } }
.fb-toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 20px);
  background: #111b21; color: #fff; padding: 10px 18px; border-radius: 999px;
  font-size: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.3); z-index: 80;
  opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease;
}
.fb-toast--show { opacity: 1; transform: translate(-50%, 0); }

/* ====================================================================
 * Topbar v2 — tool switcher + dropdown menus (declutter)
 * ==================================================================== */
.topbar__left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.topbar__actions { align-items: center; }

/* segmented app switcher */
.switcher { display: inline-flex; gap: 2px; background: #0b141a; border: 1px solid #263238; border-radius: 10px; padding: 3px; }
.switcher__item {
  display: inline-flex; align-items: center; gap: 5px; padding: 6px 11px; border-radius: 7px;
  font-size: 13px; font-weight: 500; color: #8696a0; text-decoration: none; white-space: nowrap;
}
.switcher__item:hover { color: #e9edef; background: #1f2c33; }
.switcher__item.is-active { background: #2a3942; color: #fff; }

/* dropdown menus */
.menu { position: relative; display: inline-block; }
.menu__btn::after { content: ""; }
.menu__list {
  position: absolute; top: calc(100% + 6px); right: 0; min-width: 210px; z-index: 70;
  background: #fff; border: 1px solid #e5e7eb; border-radius: 11px; padding: 6px;
  box-shadow: 0 14px 34px rgba(0,0,0,.22); display: none;
}
.menu.is-open .menu__list { display: block; }
.menu.is-open > .menu__btn { background: #2a3942; }
.menu__item {
  display: block; width: 100%; text-align: left; border: none; background: transparent;
  padding: 9px 12px; border-radius: 7px; font-size: 13.5px; color: #374151; cursor: pointer; font-family: inherit;
}
.menu__item:hover { background: #f3f4f6; }
.menu__item--danger { color: #dc2626; }
.menu__item--danger:hover { background: #fee2e2; }
.menu__sep { height: 1px; background: #eef0f2; margin: 5px 4px; }

/* ---------- Login gate (auth.js) ---------- */
.fb-auth {
  position: fixed; inset: 0; z-index: 2147483647;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  background: linear-gradient(135deg, #075e54, #128c7e);
}
.fb-auth__card {
  width: min(360px, 100%); box-sizing: border-box; background: #fff; border-radius: 16px;
  padding: 32px 28px; box-shadow: 0 20px 60px rgba(0,0,0,.3); text-align: center;
}
.fb-auth--shake { animation: fb-auth-shake .4s; }
@keyframes fb-auth-shake { 0%,100%{transform:translateX(0)} 20%,60%{transform:translateX(-8px)} 40%,80%{transform:translateX(8px)} }
.fb-auth__logo { display: block; width: 64px; height: 64px; margin: 0 auto; object-fit: contain; }
.fb-auth__title { margin: 10px 0 2px; font-size: 20px; font-weight: 700; color: #111827; }
.fb-auth__sub { margin: 0 0 22px; font-size: 13px; color: #6b7280; }
.fb-auth__form { display: flex; flex-direction: column; gap: 12px; }
.fb-auth__input {
  width: 100%; box-sizing: border-box; border: 1px solid #d1d5db; border-radius: 10px;
  padding: 12px 14px; font-size: 14px; font-family: inherit; color: #111827;
}
.fb-auth__input:focus { outline: none; border-color: #25d366; box-shadow: 0 0 0 3px rgba(37,211,102,.18); }
.fb-auth__btn {
  margin-top: 4px; border: none; border-radius: 10px; padding: 12px;
  background: #075e54; color: #fff; font-size: 15px; font-weight: 600; cursor: pointer; font-family: inherit;
}
.fb-auth__btn:hover { background: #0a7168; }
.fb-auth__btn:disabled { opacity: .6; cursor: default; }
.fb-auth__err { min-height: 16px; font-size: 12.5px; color: #dc2626; }

/* ---------- Lead-category feedback (node editor + simulator) ---------- */
/* Per-node optional category field on the canvas card */
.node__leadcat { margin-top: 10px; border-top: 1px dashed #eef0f2; padding-top: 8px; }
.node__leadcat-input {
  width: 100%; box-sizing: border-box; border: 1px solid #e5e7eb; border-radius: 8px;
  padding: 6px 9px; font-size: 12px; font-family: inherit; color: #92400e;
  background: #fffbeb;
}
.node__leadcat-input::placeholder { color: #b45309; opacity: .7; }
.node__leadcat-input:focus { outline: none; border-color: #f59e0b; box-shadow: 0 0 0 2px rgba(245,158,11,.18); }

/* Live category strip under the phone header in the simulator */
.wa__leadstrip {
  flex: 0 0 auto; display: flex; align-items: center; gap: 8px;
  background: #fef3c7; border-bottom: 1px solid #fde68a; color: #92400e;
  padding: 6px 14px; font-size: 12px;
}
.wa__leadstrip-label { font-weight: 600; opacity: .8; }
.wa__leadstrip-value { font-weight: 700; }

/* Inline "categorized" marker in the chat timeline */
.sim__leadmark { display: flex; justify-content: center; margin: 8px 0; }
.sim__leadmark-tag {
  background: #fde68a; color: #78350f; border-radius: 999px;
  padding: 3px 12px; font-size: 11.5px; font-weight: 600;
  box-shadow: 0 1px 2px rgba(0,0,0,.08);
}

/* Form block inside a customer: the form is designed in the form designer */
.fl-section { gap: 6px; }
.fl-summary { margin: 0; font-size: 12.5px; color: #374151; }
.fl-open { font-weight: 700; }
.fl-hint { margin: 0; font-size: 11.5px; color: #6b7280; }

/* agent push: "replace the chat flow?" (agent-ui.js) */
.agent-ask { z-index: 90; }
.agent-ask__panel { width: min(440px, 92vw); padding: 22px 22px 18px; }
.agent-ask__title { margin: 0 0 8px; font-size: 18px; font-weight: 700; color: #111827; }
.agent-ask__text { margin: 0 0 18px; font-size: 14.5px; line-height: 1.5; color: #4b5563; }
.agent-ask__actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.agent-ask__actions .btn { min-height: 40px; padding: 8px 16px; }
.agent-ask__keep { color: #374151; border-color: #d1d5db; }
.agent-ask__keep:hover { background: #f3f4f6; }
