:root {
  --bg: #f3f4f6;
  --panel: #ffffff;
  --sidebar: #1e1b4b;
  --sidebar-2: #1e1b4b;
  --sidebar-fg: #e0e7ff;
  --sidebar-muted: #a5b4fc;
  --sidebar-active: #312e81;
  --text: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #4f46e5;
  --accent-2: #4338ca;
  --accent-soft: #eef2ff;
  --danger: #dc2626;
  --warn: #d97706;
  --ok: #16a34a;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  font-family: "DM Sans", "Segoe UI", ui-sans-serif, system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
body { display: flex; }
a { color: var(--accent); text-decoration: none; }
button, input, select, textarea { font: inherit; }

.sidebar {
  width: 240px;
  background: var(--sidebar);
  color: var(--sidebar-fg);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
.brand {
  padding: 14px 12px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.brand-logo-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border-radius: 12px;
  background: #fff;
  padding: 8px 10px;
  text-decoration: none;
}
.brand-mark {
  display: block;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  object-fit: contain;
}
.brand-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.2;
}
.brand-name {
  color: #1e1b4b;
  font-weight: 700;
  font-size: 16px;
}
.brand-sub {
  margin: 2px 0 0;
  color: #4f46e5;
  font-size: 12px;
  font-weight: 600;
}
#nav { display: flex; flex-direction: column; padding: 12px 8px; gap: 4px; }
#nav a {
  color: var(--sidebar-fg);
  padding: 10px 12px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
#nav a:hover, #nav a.active { background: var(--sidebar-active); color: #fff; }
#nav .nav-count {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #f97316;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}
.sidebar-foot { margin-top: auto; padding: 16px 18px; color: var(--sidebar-muted); font-size: 12px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 18px 28px 8px;
}
.topbar h1 { margin: 0; font-size: 26px; }
.content { padding: 8px 28px 40px; }

.grid { display: grid; gap: 16px; }
.stats { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; padding: 16px 18px; box-shadow: var(--shadow);
}
.card h3 { margin: 0 0 12px; font-size: 15px; color: var(--muted); font-weight: 600; }
.stat-value { font-size: 28px; font-weight: 700; }
.stat-label { color: var(--muted); font-size: 13px; margin-top: 4px; }

.bulkbar {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
  background: var(--accent-soft); border: 1px solid #c7d2fe; border-radius: 10px;
  padding: 10px 12px; margin-bottom: 12px;
}
.table-wrap { overflow: auto; }
th.check, td.check { width: 36px; }
.consent {
  display: flex; gap: 10px; align-items: flex-start;
  margin: 14px 0 4px; color: var(--text); font-size: 14px; font-weight: 600;
}
.day-picks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 4px 0 0;
}
.day-picks label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.import-progress { margin-top: 14px; }
.progress-track {
  height: 10px;
  background: #e5e7eb;
  border-radius: 999px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  width: 8%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.2s ease;
}
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  margin-bottom: 12px;
}
.toolbar .field { min-width: 160px; }
.toolbar .field.grow { flex: 1; min-width: 220px; }
.toolbar .field label { margin-top: 0; }
.toolbar input, .toolbar select { width: 100%; }
.toolbar .actions-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.toolbar .chip.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.pager {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  padding: 12px 2px 0;
}
.pager p { margin: 0; }
.pager-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.btn:disabled,
.btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

input, select, textarea {
  border: 1px solid #cfd8e3; border-radius: 8px; padding: 9px 11px; background: #fff;
}
textarea { width: 100%; min-height: 220px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 6px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.btn {
  border: 0; border-radius: 8px; padding: 9px 14px; cursor: pointer;
  background: var(--accent); color: #fff; font-weight: 600;
}
.btn:hover { background: var(--accent-2); }
.btn.secondary { background: #e8eef5; color: var(--text); }
.btn.danger { background: var(--danger); }
.btn.ghost { background: transparent; color: var(--accent); }

table { width: 100%; border-collapse: collapse; background: var(--panel); border-radius: 12px; overflow: hidden; }
th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--line); font-size: 14px; vertical-align: top; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; background: #f8fafc; }
tr:hover td { background: #f8fbfd; }

.badge {
  display: inline-block; padding: 3px 8px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
}
.badge.subscribed, .badge.sent, .badge.ok, .badge.active, .badge.approved { background: #ecfdf3; color: var(--ok); }
.badge.draft, .badge.paused, .badge.pending, .badge.scheduled { background: #eef2f6; color: #475467; }
.badge.sending, .badge.warn { background: #fffaeb; color: var(--warn); }
.badge.bounced, .badge.complained, .badge.unsubscribed, .badge.invalid, .badge.danger, .badge.rejected, .badge.disabled { background: #fef3f2; color: var(--danger); }

.flash {
  margin: 0 28px 8px; padding: 10px 12px; border-radius: 8px;
  background: #ecfdf3; color: var(--ok);
}
.flash.error { background: #fef3f2; color: var(--danger); }

.modal {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .45);
  display: grid; place-items: center; z-index: 20;
}
.modal[hidden] { display: none; }
.modal-card { width: min(560px, calc(100% - 24px)); background: #fff; border-radius: 14px; padding: 18px; }
.modal-card h2 { margin: 0 0 8px; }

.split { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.preview {
  border: 1px solid var(--line); border-radius: 12px; min-height: 360px; background: #fff;
}
.empty { color: var(--muted); padding: 28px; text-align: center; }
.muted { color: var(--muted); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.warn-text { color: var(--warn); font-weight: 600; }
.danger-text { color: var(--danger); font-weight: 600; }

.auth-page { display: block; background: var(--bg); }
.auth-page .sidebar, .auth-page .topbar { display: none; }
.auth-page .main { min-height: 100%; }
.auth-card { max-width: 440px; margin: 72px auto; }
.auth-brand {
  display: flex;
  justify-content: center;
  margin: 0 0 20px;
}
.auth-brand img {
  display: block;
  height: 64px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
}
.dns-table td { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; word-break: break-all; }

.content.builder-on, .content.flow-on { padding: 8px 16px 28px; }
.builder-shell { display: flex; flex-direction: column; gap: 12px; }
.builder-toolbar {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center;
  justify-content: space-between;
}
.builder-tabs { display: flex; background: #e8eef5; border-radius: 10px; padding: 4px; }
.builder-tab {
  border: 0; background: transparent; padding: 8px 14px; border-radius: 8px;
  cursor: pointer; font-weight: 600; color: var(--muted);
}
.builder-tab.active { background: #fff; color: var(--text); box-shadow: var(--shadow); }
.builder-kinds, .builder-tags, .builder-device { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip {
  border: 1px solid var(--line); background: #fff; border-radius: 999px;
  padding: 5px 10px; font-size: 12px; cursor: pointer; color: var(--accent);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.builder-workspace {
  display: grid; grid-template-columns: 220px minmax(0, 1fr) 280px;
  min-height: 640px; border: 1px solid var(--line); border-radius: 14px;
  overflow: hidden; background: #fff;
}
.builder-palette, .builder-inspector {
  background: #f8fafc; padding: 14px; overflow: auto;
}
.builder-palette { border-right: 1px solid var(--line); }
.builder-inspector { border-left: 1px solid var(--line); }
.builder-palette h3, .builder-inspector h3 {
  margin: 0 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted);
}
.builder-add {
  width: 100%; text-align: left; border: 1px solid var(--line); background: #fff;
  border-radius: 10px; padding: 10px 12px; margin: 0 0 8px; cursor: grab;
  display: flex; gap: 8px; align-items: flex-start;
}
.builder-add:hover { border-color: var(--accent-2); }
.builder-add:active { cursor: grabbing; }
.builder-add.is-dragging { opacity: .45; }
.builder-add-grip { color: #94a3b8; letter-spacing: -1px; line-height: 1; margin-top: 3px; user-select: none; }
.builder-add strong { display: block; font-size: 13px; }
.builder-add span span { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.builder-canvas-wrap { overflow: auto; padding: 24px 16px 40px; }
.builder-preheader {
  text-align: center; font-size: 12px; color: var(--muted); margin-bottom: 10px;
}
.builder-email {
  margin: 0 auto; background: #fff; box-shadow: 0 16px 40px rgba(15, 23, 42, .12);
  max-width: 100%;
}
.drop-slot {
  height: 6px; margin: 0 16px; border-radius: 99px;
  transition: height .12s ease, margin .12s ease, background .12s ease;
}
.builder-email.is-droppable .drop-slot {
  height: 14px; margin: 4px 16px; background: rgba(79, 70, 229, .16);
}
.drop-slot.active {
  height: 8px; margin: 6px 16px; background: var(--accent);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, .22);
}
.builder-block { position: relative; cursor: pointer; outline: 2px solid transparent; }
.builder-block:hover { outline: 2px dashed rgba(79, 70, 229, .45); }
.builder-block.selected { outline: 2px solid var(--accent); }
.builder-block.is-dragging { opacity: .4; }
.builder-block.drop-before { box-shadow: inset 0 3px 0 var(--accent); }
.builder-block.drop-after { box-shadow: inset 0 -3px 0 var(--accent); }
.drag-handle {
  position: absolute; left: 6px; top: 10px; z-index: 3;
  width: 18px; height: 22px; display: none; place-items: center;
  cursor: grab; color: #64748b; font-size: 12px; letter-spacing: -1px;
  background: #fff; border: 1px solid var(--line); border-radius: 4px;
  user-select: none;
}
.drag-handle:active { cursor: grabbing; }
.builder-block:hover .drag-handle,
.builder-block.selected .drag-handle { display: grid; }
.builder-block-tools {
  position: absolute; top: 6px; right: 6px; display: none; gap: 2px; z-index: 2;
}
.builder-block:hover .builder-block-tools, .builder-block.selected .builder-block-tools { display: flex; }
.builder-block-tools button, .builder-block-tools span {
  background: var(--sidebar); color: #fff; border: 0; border-radius: 6px;
  width: 24px; height: 24px; cursor: pointer; font-size: 12px;
  display: grid; place-items: center;
}
.builder-block-tools span { width: auto; padding: 0 8px; font-size: 11px; }
.builder-block-body { min-height: 12px; }
.eb-heading, .eb-text, .eb-btnwrap, .eb-logo, .eb-placeholder, .eb-footer, .eb-social, .eb-html, .eb-cols {
  padding: 12px 28px;
}
.eb-heading { font-weight: 700; line-height: 1.3; }
.eb-heading.h1 { font-size: 28px; }
.eb-heading.h2 { font-size: 22px; }
.eb-heading.h3 { font-size: 18px; }
.eb-text { font-size: 16px; line-height: 1.65; white-space: pre-wrap; }
.is-center { text-align: center; }
.is-right { text-align: right; }
.eb-btn {
  display: inline-block; padding: 12px 22px; border-radius: 6px; font-weight: 700; font-size: 15px;
}
.eb-image img { display: block; width: 100%; height: auto; }
.eb-placeholder {
  margin: 12px 28px; border: 1px dashed #cbd5e1; border-radius: 8px;
  padding: 28px 12px; text-align: center; color: var(--muted); background: #f8fafc;
}
.eb-hr { margin: 12px 28px; border: 0; border-top: 1px solid #e5e7eb; }
.eb-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; font-size: 15px; line-height: 1.6; }
.eb-footer { text-align: center; color: #6b7280; font-size: 12px; line-height: 1.6; border-top: 1px solid #e5e7eb; }
.eb-social { text-align: center; font-size: 13px; color: var(--accent); }
.eb-html { font-size: 12px; color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.builder-area { min-height: 90px; }
.builder-upload {
  position: relative; display: inline-flex; margin: 6px 0 10px; cursor: pointer; overflow: hidden;
}
.builder-file {
  position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer;
  font-size: 0;
}
.eb-placeholder .builder-upload { margin: 12px auto 0; display: inline-flex; }
.builder-html-pane textarea { min-height: 480px; }
.builder-html-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 10px; }
.builder-media-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 6px 0 10px; }
.media-drop {
  border: 1px dashed #cbd5e1; border-radius: 12px; padding: 28px 16px; text-align: center;
  background: #fff; margin: 12px 0 16px; color: var(--text);
}
.media-drop.is-over { border-color: var(--accent); background: var(--accent-soft); }
.media-drop strong { display: block; margin-bottom: 4px; }
.media-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px;
}
.media-card {
  background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px;
  display: flex; flex-direction: column; gap: 8px; text-align: left;
}
button.media-card { cursor: pointer; font: inherit; color: inherit; }
.media-thumb {
  height: 140px; border-radius: 8px; overflow: hidden; background: #f8fafc;
  display: grid; place-items: center;
}
.media-thumb img, .media-thumb video { width: 100%; height: 100%; object-fit: cover; }
.media-meta { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.media-meta strong { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-url {
  font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  background: #f8fafc; padding: 4px 6px; border-radius: 6px;
}
.media-picker {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 30;
  display: grid; place-items: center; padding: 16px;
}
.media-picker-card {
  width: min(860px, 100%); max-height: calc(100vh - 32px); overflow: auto;
  background: #fff; border-radius: 14px; padding: 18px;
}
.media-picker-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.media-picker-head h3 { margin: 0; }
.media-grid-picker { margin-top: 12px; }
#top-actions label.btn { position: relative; overflow: hidden; display: inline-flex; align-items: center; }
.builder-preview-pane { display: flex; flex-direction: column; gap: 12px; align-items: center; }
.builder-preview-frame { min-height: 640px; width: 100%; background: #fff; }
.builder-inspector label { margin-top: 8px; }
.builder-inspector input[type="color"] { height: 38px; padding: 4px; }

.chart-wrap { min-height: 280px; overflow: auto; }
.chart-svg { width: 100%; height: auto; display: block; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 10px; font-size: 13px; color: var(--muted); }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { width: 10px; height: 10px; border-radius: 99px; display: inline-block; }

.hub-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

a.builder-tab { color: var(--muted); text-decoration: none; display: inline-block; }
a.builder-tab.active { color: var(--text); }
textarea.short { min-height: 88px; font-family: inherit; }
.hours-grid {
  display: grid;
  grid-template-columns: 110px 1fr 1fr auto;
  gap: 8px 12px;
  align-items: center;
}
.hours-grid .hours-head { font-size: 12px; color: var(--muted); font-weight: 600; }
.preview-box {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  min-height: 72px;
}
.inbox-layout {
  display: grid;
  grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
  gap: 16px;
  min-height: 560px;
}
.inbox-list { max-height: 70vh; overflow: auto; }
.inbox-item {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: #fff;
  padding: 10px 12px;
  cursor: pointer;
}
.inbox-item.active { background: var(--accent-soft); }
.inbox-item.unread { background: #fff7ed; }
.inbox-item.unread strong { color: #9a3412; }
.inbox-item .meta { display: flex; justify-content: space-between; gap: 8px; }
.thread {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 56vh;
  overflow: auto;
  padding: 8px 4px 12px;
}
.bubble {
  max-width: 80%;
  padding: 8px 12px;
  border-radius: 12px;
  background: #f1f5f9;
  align-self: flex-start;
}
.bubble.out { background: var(--accent-soft); align-self: flex-end; }
.bubble.bot { border: 1px dashed #c7d2fe; }
.bubble .when { display: block; margin-top: 4px; font-size: 11px; color: var(--muted); }
.reply-form textarea.short { min-height: 72px; }
.chat-notes {
  margin: 8px 0 12px;
  padding: 10px 12px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: #fffbeb;
}
.note-list { list-style: none; margin: 8px 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.note-list li { display: flex; flex-direction: column; gap: 2px; }
.note-list em { color: var(--muted); font-style: normal; font-size: 12px; }
.note-form { display: flex; gap: 8px; }
.note-form input { flex: 1; }
.reply-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.slash-wrap { position: relative; }
.slash-menu {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 4px);
  z-index: 5;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  max-height: 220px;
  overflow: auto;
  padding: 6px;
}
.slash-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 8px;
  border-radius: 8px;
  cursor: pointer;
}
.slash-item:hover { background: var(--accent-soft); }
.slash-item span { color: var(--muted); font-size: 12px; }

@media (max-width: 900px) {
  .inbox-layout, .hours-grid { grid-template-columns: 1fr; }
}

@media (max-width: 1100px) {
  .builder-workspace { grid-template-columns: 1fr; min-height: 0; }
  .builder-palette, .builder-inspector { border: 0; border-top: 1px solid var(--line); max-height: 280px; }
}

.flow-wizard { display: flex; flex-direction: column; gap: 0; }
.flow-wizard-head {
  display: flex;
  align-items: center;
  gap: 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px 12px 0 0;
  padding: 14px 18px;
}
.flow-stepper {
  display: flex;
  align-items: center;
  gap: 0;
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1;
}
.flow-stepper li { flex: 1; position: relative; }
.flow-stepper li a {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}
.flow-stepper li.current a { color: var(--text); }
.flow-stepper li.done a { color: var(--ok); }
.flow-step-num {
  width: 22px; height: 22px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); font-size: 12px; background: #fff; flex-shrink: 0;
}
.flow-stepper li.current .flow-step-num { background: var(--accent); color: #fff; border-color: var(--accent); }
.flow-stepper li.done .flow-step-num { background: #ecfdf3; color: var(--ok); border-color: #bbf7d0; }
.flow-skip {
  margin-left: auto;
  background: none;
  border: 0;
  color: var(--accent);
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.flow-wizard-body { background: #fff; border: 1px solid var(--line); border-top: 0; border-radius: 0 0 12px 12px; padding: 0 0 16px; }
.flow-panel { margin: 16px; box-shadow: none; }
.flow-wizard-foot {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 16px 0;
}
input.is-invalid, select.is-invalid { border-color: var(--danger); }
.field-error { color: var(--danger); font-size: 13px; margin: 6px 0 0; }
.flow-trigger-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 12px;
  margin: 8px 0 18px;
}
.flow-trigger-card {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 18px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-weight: 600;
  color: var(--text);
  min-height: 110px;
}
.flow-trigger-card.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.flow-trigger-card.disabled, .flow-trigger-card:disabled { opacity: 0.45; cursor: not-allowed; }
.flow-trigger-icon { font-size: 22px; }
.flow-radio, .flow-toggle { display: flex; align-items: center; gap: 8px; font-weight: 600; margin: 8px 0; }
.flow-hint {
  background: #eff6ff;
  color: #1d4ed8;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  margin-top: 12px;
}

.flow-canvas-page { position: relative; min-height: 70vh; padding-bottom: 40px; }
.flow-canvas-meta { color: var(--muted); font-size: 13px; margin-bottom: 12px; }
.flow-entry-strip {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  max-width: 980px;
  margin: 0 auto 8px;
}
.flow-entry-label { font-size: 13px; font-weight: 700; margin-bottom: 10px; }
.flow-entry-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.flow-entry-card {
  background: #eef4fb;
  border-radius: 10px;
  padding: 12px;
  min-height: 88px;
  font-size: 12px;
  color: var(--muted);
  white-space: pre-line;
}
.flow-entry-card strong { display: block; color: #334155; font-size: 13px; margin-bottom: 6px; }
.flow-tree { display: flex; flex-direction: column; align-items: center; gap: 0; }
.flow-children { display: flex; flex-direction: column; align-items: center; }
.flow-children.branched { flex-direction: row; align-items: flex-start; gap: 28px; }
.flow-col { display: flex; flex-direction: column; align-items: center; }
.flow-plus {
  width: 28px; height: 28px; border-radius: 8px; border: 1px solid #93c5fd;
  background: #fff; color: var(--accent); font-size: 18px; line-height: 1;
  cursor: pointer; margin: 10px 0; box-shadow: 0 0 0 3px #fff;
}
.flow-node, .flow-exit {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  min-width: 220px;
  max-width: 280px;
  cursor: pointer;
  box-shadow: var(--shadow);
}
.flow-node-kicker { font-size: 11px; color: var(--muted); font-weight: 700; text-transform: uppercase; margin-bottom: 4px; }
.flow-exit { display: flex; align-items: center; gap: 10px; min-width: 180px; }
.flow-exit-dot { width: 12px; height: 12px; border-radius: 3px; background: #f43f5e; flex-shrink: 0; }
.flow-branch { font-size: 11px; font-weight: 700; margin-top: 8px; }
.flow-branch.yes { color: var(--ok); }
.flow-branch.no { color: var(--danger); }
.flow-palette-overlay {
  position: fixed; inset: 0; background: rgba(15, 23, 42, 0.18);
  display: grid; place-items: center; z-index: 30;
}
.flow-palette-overlay[hidden] { display: none; }
.flow-palette {
  position: relative;
  background: #fff;
  border-radius: 16px;
  padding: 22px 20px 16px;
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 18px;
  width: min(920px, calc(100% - 32px));
  box-shadow: var(--shadow);
}
.flow-palette h4 { margin: 0 0 10px; display: flex; align-items: center; gap: 8px; }
.pal-dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.pal-dot.green { background: #86efac; }
.pal-dot.gold { background: #fbbf24; }
.pal-dot.purple { background: #c4b5fd; }
.flow-pal-item {
  display: block; width: 100%; text-align: left;
  background: none; border: 0; padding: 6px 4px; cursor: pointer; color: var(--text);
}
.flow-pal-item:hover { color: var(--accent); }
.flow-pal-item.locked { color: var(--muted); cursor: not-allowed; }
.flow-palette-close {
  position: absolute; top: 8px; right: 10px;
  border: 0; background: none; font-size: 22px; cursor: pointer; color: var(--muted);
}
.flow-drawer {
  position: fixed; top: 0; right: 0; width: min(360px, 100%); height: 100%;
  background: #fff; border-left: 1px solid var(--line); padding: 20px; z-index: 31;
  overflow: auto; box-shadow: var(--shadow);
}
.flow-drawer[hidden] { display: none; }
.flow-drawer h3 { margin: 8px 0 12px; }

.wa-live-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px; border-radius: 999px; background: #ecfdf3; color: var(--ok);
  font-size: 12px; font-weight: 700;
}
.wa-live-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--ok);
  box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.6);
  animation: wa-live-pulse 1.6s ease-out infinite;
}
@keyframes wa-live-pulse {
  0% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.55); }
  100% { box-shadow: 0 0 0 8px rgba(22, 163, 74, 0); }
}
.wa-status-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.wa-tpl-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.wa-tpl-component { margin-top: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #f8fafc; }
.wa-kind-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 10px;
  margin: 12px 0 18px;
}
.wa-kind-card {
  text-align: left;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 12px;
  cursor: pointer;
  color: inherit;
}
.wa-kind-card strong { display: block; margin-bottom: 4px; }
.wa-kind-card span { display: block; color: var(--muted); font-size: 12px; line-height: 1.4; }
.wa-kind-card.active { border-color: var(--accent); background: var(--accent-soft); }
.wa-btn-row, .wa-card-row { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-top: 10px; background: #f8fafc; }

.wa-editor-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 16px;
  align-items: start;
  margin-top: 16px;
}
.wa-preview-pane {
  position: sticky;
  top: 16px;
  z-index: 0;
  max-height: calc(100vh - 32px);
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  box-shadow: var(--shadow);
}
.wa-editor-layout > .card { position: relative; z-index: 1; }
.wa-card-row textarea { min-height: 72px; font-family: inherit; }
.wa-submit-bar {
  position: sticky;
  bottom: 0;
  z-index: 2;
  margin-top: 16px;
  padding-top: 12px;
  background: #fff;
  border-top: 1px solid var(--line);
}
.wa-submit-bar .warn-text { margin: 0 0 8px; }
.wa-preview-pane h3 { margin: 0 0 12px; }
.wa-phone {
  width: 300px;
  margin: 0 auto;
  background: #0b141a;
  border-radius: 28px;
  overflow: hidden;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.18);
}
.wa-phone-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px 10px;
  background: #008069;
  color: #fff;
}
.wa-phone-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: #fff; color: #008069; font-weight: 700;
  display: grid; place-items: center;
}
.wa-phone-bar strong { display: block; font-size: 14px; }
.wa-phone-bar span { display: block; font-size: 11px; opacity: .85; }
.wa-phone-chat {
  min-height: 420px;
  padding: 12px 10px 16px;
  background: #efeae2 url("data:image/svg+xml,%3Csvg width='60' height='60' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 60L60 0H30L0 30M60 60V30L30 60' fill='%23d9d2c8' fill-opacity='.35'/%3E%3C/svg%3E");
}
.wa-bubble {
  max-width: 92%;
  margin-left: auto;
  background: #fff;
  border-radius: 8px 0 8px 8px;
  box-shadow: 0 1px 0.5px rgba(11, 20, 26, .13);
  overflow: hidden;
}
.wa-bubble-header {
  font-weight: 700;
  font-size: 14px;
  padding: 10px 10px 0;
}
.wa-bubble-body {
  white-space: pre-wrap;
  font-size: 13.5px;
  line-height: 1.4;
  padding: 8px 10px 4px;
  color: #111b21;
}
.wa-bubble-footer {
  padding: 0 10px 6px;
  color: #667781;
  font-size: 12px;
}
.wa-bubble-meta {
  text-align: right;
  color: #667781;
  font-size: 11px;
  padding: 0 8px 6px;
}
.wa-bubble-meta span { color: #53bdeb; }
.wa-media {
  background: #d1d7db;
  min-height: 120px;
  display: grid;
  place-items: center;
  color: #54656f;
  font-weight: 600;
}
.wa-media img { display: block; width: 100%; max-height: 160px; object-fit: cover; }
.wa-media-video, .wa-media-doc, .wa-media-fallback { min-height: 92px; }
.wa-offer {
  margin: 8px 10px 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: #fff7ed;
  color: #9a3412;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.wa-offer em { font-style: normal; font-weight: 600; color: #c2410c; }
.wa-bubble-actions { border-top: 1px solid #f0f2f5; }
.wa-bubble-action {
  width: 100%;
  padding: 9px 10px;
  text-align: center;
  color: #027eb5;
  font-weight: 600;
  font-size: 13px;
  border: 0;
  border-top: 1px solid #f0f2f5;
  background: #fff;
  display: flex;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  font-family: inherit;
}
.wa-bubble-action:hover { background: #f0f7fb; }
.wa-bubble-action:active { background: #e7f3fa; }
.wa-bubble-in {
  margin: 8px 0 0;
  margin-right: auto;
  margin-left: 0;
  background: #fff;
  border-radius: 0 8px 8px 8px;
}
.wa-bubble-in .wa-bubble-body { color: #111b21; }
.wa-carousel {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 8px 10px 10px;
}
.wa-card {
  min-width: 168px;
  max-width: 168px;
  border: 1px solid #e9edef;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}
.wa-phone-compose {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: #f0f2f5;
  color: #667781;
  padding: 10px 14px;
  font-size: 13px;
}
.wa-preview-reset {
  border: 0;
  background: #fff;
  color: #027eb5;
  font-size: 11px;
  font-weight: 700;
  border-radius: 999px;
  padding: 4px 8px;
  cursor: pointer;
}
.wa-preview-note { margin: 10px 0 0; font-size: 12px; }

@media (max-width: 1100px) {
  .wa-editor-layout { grid-template-columns: 1fr; }
  .wa-preview-pane { position: static; }
}

@media (max-width: 900px) {
  body { flex-direction: column; }
  .sidebar { width: 100%; }
  #nav { flex-direction: row; overflow: auto; }
  .row, .split, .wa-editor-layout { grid-template-columns: 1fr; }
  .flow-trigger-grid, .flow-entry-cards, .flow-palette { grid-template-columns: 1fr 1fr; }
  .flow-children.branched { flex-direction: column; align-items: center; }
}
