/* =========================================================================
   SUPER ADMIN — LAUNDRY BUSINESS MASTERCLASS
   ========================================================================= */
:root {
  --navy: #0f1b3d;
  --navy-2: #16255a;
  --navy-3: #1d2f6f;
  --ink: #1a2238;
  --muted: #5b6478;
  --bg: #f2f4fa;
  --card: #ffffff;
  --accent: #ff7a00;
  --accent-dark: #e55f00;
  --gold: #ffb020;
  --green: #16a34a;
  --green-bg: #eafaf0;
  --red: #dc2626;
  --red-bg: #fdecec;
  --amber-bg: #fff7e6;
  --blue-bg: #eaf2ff;
  --line: #e5e8f0;
  --radius: 14px;
  --font: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
}
img { max-width: 100%; display: block; }
[hidden] { display: none !important; }
button { font-family: inherit; cursor: pointer; }
a { color: var(--accent-dark); }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 0; border-radius: 10px; font-weight: 700;
  padding: 10px 16px; font-size: 14px; line-height: 1.2;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: translateY(1px); }
.btn-block { width: 100%; }
.btn-sm { padding: 7px 12px; font-size: 12.5px; }
.btn-primary { background: linear-gradient(135deg, #ff8a1e, var(--accent-dark)); color: #fff; box-shadow: 0 6px 16px rgba(255,122,0,.3); }
.btn-green { background: var(--green); color: #fff; }
.btn-red { background: var(--red); color: #fff; }
.btn-ghost { background: transparent; color: var(--muted); font-weight: 600; }
.btn-outline { background: #fff; color: var(--navy); border: 1.5px solid var(--line); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ----------------------------------------------------------------- login */
.login-view {
  min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  background:
    radial-gradient(700px 400px at 90% -10%, rgba(255,176,32,.2), transparent 60%),
    linear-gradient(160deg, var(--navy), var(--navy-3));
}
.login-card {
  background: #fff; border-radius: 22px; padding: 34px 28px;
  width: 100%; max-width: 420px; box-shadow: 0 30px 70px rgba(0,0,0,.35);
  text-align: center;
}
.login-card .brand-mark { width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 12px; object-fit: cover; }
.login-card h1 { font-size: 24px; font-weight: 800; color: var(--navy); letter-spacing: .04em; }
.login-sub { font-size: 13.5px; color: var(--muted); margin: 6px 0 24px; }
.login-card form { text-align: left; }
.login-card label { display: block; font-size: 13px; font-weight: 700; color: var(--navy); margin-bottom: 14px; }
.login-card input {
  width: 100%; margin-top: 6px; padding: 13px 14px; font-size: 16px;
  border: 1.5px solid var(--line); border-radius: 10px; background: var(--bg);
  font-family: inherit;
}
.login-card input:focus { outline: none; border-color: var(--accent); background: #fff; }
.demo-hint { margin-top: 14px; font-size: 12.5px; color: var(--muted); text-align: center; background: var(--amber-bg); border: 1px dashed var(--gold); border-radius: 10px; padding: 10px; }
.form-error { background: var(--red-bg); color: var(--red); border: 1px solid #f5c6c6; border-radius: 10px; padding: 10px 14px; font-size: 13px; font-weight: 600; margin-bottom: 14px; }

/* ------------------------------------------------------------- app shell */
.app { display: flex; min-height: 100dvh; }
.sidebar {
  width: 250px; flex-shrink: 0;
  background: var(--navy);
  color: #fff;
  display: flex; flex-direction: column;
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 100;
  transform: translateX(-100%);
  transition: transform .2s ease;
}
.sidebar.open { transform: none; }
.side-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 16px; border-bottom: 1px solid rgba(255,255,255,.08);
  font-size: 13px; font-weight: 600; letter-spacing: .06em;
}
.side-brand .brand-mark { width: 34px; height: 34px; border-radius: 8px; object-fit: cover; }
.side-brand b { color: var(--gold); }
.side-nav { flex: 1; overflow-y: auto; padding: 12px 8px; }
.side-nav a {
  display: flex; align-items: center; gap: 10px;
  color: #b9c2e0; text-decoration: none;
  font-size: 14px; font-weight: 600;
  padding: 11px 12px; border-radius: 10px;
  margin-bottom: 2px;
}
.side-nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.side-nav a.active { background: var(--accent); color: #fff; box-shadow: 0 6px 16px rgba(255,122,0,.35); }
.side-nav a.sub { padding-left: 28px; font-size: 13px; font-weight: 500; color: #9aa6cc; }
.side-nav a.sub2 { padding-left: 42px; font-size: 12.5px; font-weight: 400; color: #7e8ab0; }
.side-nav .nav-sep { height: 1px; margin: 10px 10px 8px; background: rgba(255,255,255,.09); }
.side-nav .nav-sep:first-of-type { margin-top: 4px; }
.side-nav a.sub.active { background: var(--navy-2); color: #fff; box-shadow: none; }
.logout-btn {
  margin: 12px; padding: 12px;
  background: rgba(255,255,255,.06); color: #ffb4b4;
  border: 0; border-radius: 10px; font-weight: 700; font-size: 14px;
}
.logout-btn:hover { background: rgba(255,255,255,.12); }

.main { flex: 1; min-width: 0; margin-left: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 12px;
  background: #fff; border-bottom: 1px solid var(--line);
  padding: 12px 18px;
}
.topbar h2 { font-size: 18px; font-weight: 800; color: var(--navy); flex: 1; }
.hamburger {
  background: var(--bg); border: 0; border-radius: 10px;
  width: 40px; height: 40px; font-size: 18px; color: var(--navy);
}
.topbar-right { display: flex; align-items: center; gap: 10px; }
.mode-badge {
  font-size: 11px; font-weight: 800; letter-spacing: .08em;
  text-transform: uppercase;
  background: var(--amber-bg); color: var(--accent-dark);
  border: 1px solid var(--gold); border-radius: 100px; padding: 4px 10px;
}
.mode-badge.live { background: var(--green-bg); color: var(--green); border-color: #9be3b8; }
.user-email { font-size: 13px; color: var(--muted); font-weight: 600; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.view { padding: 22px 18px 60px; width: 100%; max-width: 1200px; margin: 0 auto; }

/* ---------------------------------------------------------------- cards */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px;
  margin-bottom: 18px;
  box-shadow: 0 4px 14px rgba(15,27,61,.05);
}
.card h3 { font-size: 16px; font-weight: 800; color: var(--navy); margin-bottom: 14px; }
.card h4 { font-size: 14px; font-weight: 700; color: var(--navy); margin-bottom: 8px; }
.card p.hint { font-size: 13px; color: var(--muted); margin-top: 6px; }

.stat-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px;
}
.stat-card .label { font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; }
.stat-card .value { font-size: 26px; font-weight: 800; color: var(--navy); margin-top: 4px; line-height: 1.1; }
.stat-card .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stat-card.accent .value { color: var(--accent-dark); }
.stat-card.green .value { color: var(--green); }
.stat-card.red .value { color: var(--red); }
.stat-grid.wide { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.stat-grid.wide .stat-card { padding: 12px 14px; }
.stat-grid.wide .stat-card .value { font-size: 20px; }

/* ---------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
table { width: 100%; border-collapse: collapse; min-width: 640px; }
th {
  text-align: left; font-size: 11.5px; font-weight: 800; letter-spacing: .06em;
  text-transform: uppercase; color: var(--muted);
  padding: 12px 14px; border-bottom: 1px solid var(--line);
  background: #fafbfe; white-space: nowrap;
}
td { padding: 12px 14px; font-size: 13.5px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: #fafbfe; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
.wrap-cell { word-break: break-all; }

/* --------------------------------------------------------------- badges */
.badge {
  display: inline-block; font-size: 11px; font-weight: 800;
  padding: 4px 10px; border-radius: 100px; letter-spacing: .03em;
  white-space: nowrap;
}
.badge.unpaid, .badge.pending_payment { background: var(--amber-bg); color: #b45309; }
.badge.for_review { background: var(--blue-bg); color: #1d4ed8; }
.badge.paid, .badge.confirmed { background: var(--green-bg); color: var(--green); }
.badge.rejected, .badge.payment_failed { background: var(--red-bg); color: var(--red); }
.badge.cancelled { background: #eef0f5; color: var(--muted); }
.badge.sent, .badge.completed, .badge.queued { background: var(--blue-bg); color: #1d4ed8; }
.badge.failed, .badge.draft { background: #eef0f5; color: var(--muted); }

/* ---------------------------------------------------------------- forms */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 700; color: var(--navy); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 11px 13px; font-size: 15px;
  border: 1.5px solid var(--line); border-radius: 10px;
  background: var(--bg); font-family: inherit; color: var(--ink);
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--accent); background: #fff; }
.field textarea { min-height: 120px; resize: vertical; }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.form-grid { display: grid; grid-template-columns: 1fr; gap: 0 16px; }
.check-row { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 600; color: var(--navy); margin-bottom: 12px; }
.check-row input { width: 18px; height: 18px; accent-color: var(--accent); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }

/* ---------------------------------------------------------------- filters */
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.chip {
  border: 1.5px solid var(--line); background: #fff;
  border-radius: 100px; padding: 8px 14px; font-size: 13px; font-weight: 700;
  color: var(--muted);
}
.chip.active { background: var(--navy); color: #fff; border-color: var(--navy); }

/* ---------------------------------------------------------------- detail */
.detail-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
.detail-box { border: 1px solid var(--line); border-radius: 12px; padding: 16px; background: #fafbfe; }
.detail-box h4 { font-size: 12.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 10px; }
.detail-row { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; font-size: 13.5px; border-bottom: 1px dashed var(--line); }
.detail-row:last-child { border-bottom: 0; }
.detail-row span:first-child { color: var(--muted); font-weight: 600; }
.detail-row span:last-child { text-align: right; font-weight: 700; color: var(--ink); word-break: break-all; }
.receipt-img { max-width: 100%; max-height: 340px; border-radius: 10px; border: 1px solid var(--line); margin-top: 8px; }
.msg-list { font-size: 13px; }
.msg-list li { padding: 6px 0; border-bottom: 1px dashed var(--line); }
.msg-list li:last-child { border-bottom: 0; }

/* ----------------------------------------------------------- settings */
.conn-grid { display: grid; grid-template-columns: 1fr; gap: 12px; margin-top: 4px; }
.conn-card {
  border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px;
  background: #fafbfe; display: flex; align-items: center; gap: 12px;
}
.conn-card .conn-ico {
  width: 40px; height: 40px; border-radius: 10px; flex: 0 0 40px;
  display: flex; align-items: center; justify-content: center; font-size: 19px;
  background: var(--blue-bg);
}
.conn-card.sms .conn-ico { background: var(--amber-bg); }
.conn-card .conn-body { flex: 1; min-width: 0; }
.conn-card .conn-title { font-size: 14px; font-weight: 800; color: var(--navy); }
.conn-card .conn-sub { font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.conn-dot {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 800; padding: 4px 10px; border-radius: 999px;
  white-space: nowrap; flex: 0 0 auto;
}
.conn-dot::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%; flex: 0 0 8px;
}
.conn-dot.ok { background: var(--green-bg); color: var(--green); }
.conn-dot.ok::before { background: var(--green); box-shadow: 0 0 0 3px rgba(22,163,74,.15); }
.conn-dot.bad { background: var(--red-bg); color: var(--red); }
.conn-dot.bad::before { background: var(--red); }
.conn-dot.warn { background: var(--amber-bg); color: #b45309; }
.conn-dot.warn::before { background: #f59e0b; }

.setting-section { margin-top: 18px; }
.setting-section > h4 {
  font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .07em;
  color: var(--muted); display: flex; align-items: center; gap: 8px; margin-bottom: 12px;
}
.setting-section > h4::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 44px; }
.pw-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  border: 0; background: transparent; color: var(--muted); font-size: 16px;
  padding: 6px; border-radius: 8px; line-height: 1;
}
.pw-toggle:hover { color: var(--navy); background: var(--blue-bg); }

.kv-list { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.kv-row {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 10px 14px; font-size: 13.5px; border-bottom: 1px solid var(--line);
  background: #fff;
}
.kv-row:last-child { border-bottom: 0; }
.kv-row .k { color: var(--muted); font-weight: 600; flex: 0 0 auto; }
.kv-row .v { font-weight: 700; color: var(--ink); word-break: break-all; text-align: right; }

.set-actions {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  margin-top: 16px; padding-top: 16px; border-top: 1px dashed var(--line);
}

.test-grid { display: grid; grid-template-columns: 1fr; gap: 10px; margin-top: 4px; }
.test-box {
  display: flex; align-items: center; gap: 12px; text-align: left;
  border: 1.5px solid var(--line); border-radius: 12px; background: #fafbfe;
  padding: 12px 14px; transition: border-color .15s ease, background .15s ease, transform .12s ease;
}
.test-box:hover { border-color: var(--accent); background: #fff; transform: translateY(-1px); }
.test-box:active { transform: translateY(0); }
.test-box .tb-ico {
  width: 38px; height: 38px; border-radius: 10px; flex: 0 0 38px;
  display: flex; align-items: center; justify-content: center; font-size: 17px;
  background: var(--blue-bg);
}
.test-box:nth-child(2) .tb-ico { background: var(--amber-bg); }
.test-box .tb-txt { font-size: 13.5px; font-weight: 800; color: var(--navy); }
.test-box .tb-sub { display: block; font-size: 11.5px; font-weight: 600; color: var(--muted); margin-top: 1px; }
.test-box .tb-txtwrap { flex: 1; min-width: 0; }
@media (min-width: 640px) { .test-grid { grid-template-columns: 1fr 1fr; } }

@media (min-width: 640px) {
  .conn-grid { grid-template-columns: 1fr 1fr; }
}

/* -------------------------------------------------- Facebook / Meta */
.meta-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.meta-tab {
  border: 1.5px solid var(--line); background: #fff; color: var(--navy);
  padding: 9px 16px; border-radius: 999px; font-weight: 700; font-size: 13px;
}
.meta-tab.active { background: var(--navy); color: #fff; border-color: var(--navy); }

.conn-banner {
  border: 1.5px solid var(--line); border-radius: 12px; padding: 18px;
  display: flex; align-items: center; gap: 14px; background: #fafbfe; flex-wrap: wrap;
}
.conn-banner .cb-ico { width: 48px; height: 48px; border-radius: 12px; background: var(--blue-bg); display: flex; align-items: center; justify-content: center; font-size: 24px; flex: 0 0 48px; }
.conn-banner.connected { border-color: #bfe6cd; background: var(--green-bg); }
.conn-banner.connected .cb-ico { background: #fff; }

/* workflow canvas */
.wf-toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.wf-canvas {
  position: relative; border: 1.5px solid var(--line); border-radius: 14px;
  background: #fafbfe url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24"><rect width="1" height="1" fill="%23e8ecf5"/></svg>');
  min-height: 460px; overflow: hidden;
}
.wf-svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.wf-svg path { pointer-events: stroke; }
.wf-svg path.edge { stroke: #9aa6cc; stroke-width: 2.2; fill: none; }
.wf-svg path.edge.sel { stroke: var(--accent); stroke-width: 3; }
.wf-node {
  position: absolute; width: 224px; background: #fff; border: 1.5px solid var(--line);
  border-radius: 12px; box-shadow: 0 4px 14px rgba(15,27,61,.08); cursor: move;
  user-select: none; z-index: 2;
}
.wf-node.sel { border-color: var(--accent); box-shadow: 0 6px 18px rgba(255,122,0,.22); }
.wf-node.trigger { border-left: 5px solid var(--green); }
.wf-node.action { border-left: 5px solid #1d4ed8; }
.wf-node.condition { border-left: 5px solid #b45309; }
.wf-node.wait { border-left: 5px solid #7c3aed; }
.wf-node.crm { border-left: 5px solid #0e7490; }
.wf-node.end { border-left: 5px solid var(--red); }
.wf-node-dis { opacity: .5; filter: saturate(.3); }
.wf-node-dis .wf-node-head { background: #eef0f3; }
.wf-node-dis .wf-node-foot { background: #f2f4f7; }
.wf-node-head {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px;
  font-size: 13px; font-weight: 800; color: var(--navy); border-bottom: 1px dashed var(--line);
}
.wf-node-body { padding: 8px 12px 10px; font-size: 12px; color: var(--muted); line-height: 1.45; max-height: 120px; overflow: hidden; }
.wf-port {
  position: absolute; width: 14px; height: 14px; border-radius: 50%;
  background: #fff; border: 2.5px solid #1d4ed8; cursor: crosshair; z-index: 3;
}
.wf-port.out { right: -7px; top: 50%; transform: translateY(-50%); }
.wf-port.in { left: -7px; top: 50%; transform: translateY(-50%); }
.wf-port:hover { background: var(--accent); border-color: var(--accent); }
.wf-node .node-del {
  position: absolute; top: 6px; right: 6px; border: 0; background: var(--red-bg); color: var(--red);
  width: 20px; height: 20px; border-radius: 6px; font-size: 12px; line-height: 1;
}
.wf-node .node-del:hover { background: var(--red); color: #fff; }
.wf-node .node-dup {
  position: absolute; top: 6px; right: 30px; border: 0; background: var(--blue-bg); color: #1d4ed8;
  width: 20px; height: 20px; border-radius: 6px; font-size: 12px; line-height: 1;
}
.wf-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin: 10px 0 4px; }
.wf-legend span { display: inline-flex; align-items: center; gap: 5px; }
.wf-legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }

.node-palette { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0; }
.node-palette button {
  border: 1.5px solid var(--line); background: #fff; color: var(--navy);
  padding: 7px 12px; border-radius: 9px; font-size: 12.5px; font-weight: 700;
}
.node-palette button:hover { border-color: var(--accent); color: var(--accent-dark); }

.conv-row { display: flex; gap: 12px; align-items: center; padding: 12px 4px; border-bottom: 1px dashed var(--line); }
.conv-row:last-child { border-bottom: 0; }
.conv-avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--blue-bg); color: var(--navy); display: flex; align-items: center; justify-content: center; font-weight: 800; flex: 0 0 38px; }
.conv-body { flex: 1; min-width: 0; }
.conv-name { font-weight: 800; color: var(--navy); font-size: 14px; }
.conv-sub { font-size: 12.5px; color: var(--muted); }
.timeline { margin-top: 10px; }
.timeline .tmsg { padding: 8px 12px; border-radius: 10px; margin-bottom: 6px; font-size: 13px; }
.timeline .tmsg.cust { background: var(--blue-bg); color: #1d4ed8; margin-right: 24%; }
.timeline .tmsg.bot { background: #fff; border: 1.5px solid var(--line); color: var(--ink); margin-left: 24%; }
/* builder classes used by the current visual workflow editor */
.wf-builder { display: grid; grid-template-columns: 190px 1fr; gap: 12px; margin-top: 14px; }
@media (max-width: 900px) { .wf-builder { grid-template-columns: 1fr; } }
.wf-palette {
  border: 1.5px solid var(--line); border-radius: 12px; background: #fff;
  padding: 10px; display: flex; flex-direction: column; gap: 6px; max-height: 480px; overflow: auto;
}
.pal-item {
  display: flex; align-items: center; gap: 8px; text-align: left;
  border: 1.5px solid var(--line); background: #fafbfe; color: var(--navy);
  padding: 8px 10px; border-radius: 9px; font-size: 12.5px; font-weight: 700; cursor: pointer;
}
.pal-item i { font-style: normal; font-size: 15px; }
.pal-item:hover { border-color: var(--accent); color: var(--accent-dark); background: #fff; }
.wf-name { padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 10px; font-size: 14px; font-weight: 700; color: var(--navy); min-width: 200px; }
.wf-node-head { cursor: move; }
.wf-node-foot { display: flex; gap: 6px; padding: 6px 10px; border-top: 1px dashed var(--line); }
.wf-btn {
  border: 1.5px solid var(--line); background: #fff; color: var(--navy); width: 30px; height: 26px;
  border-radius: 7px; font-size: 13px; cursor: pointer; line-height: 1;
}
.wf-btn:hover { border-color: var(--accent); color: var(--accent-dark); }
.wf-node-x {
  margin-left: auto; border: 0; background: var(--red-bg); color: var(--red); width: 22px; height: 22px;
  border-radius: 6px; font-size: 14px; line-height: 1; cursor: pointer;
}
.wf-node-x:hover { background: var(--red); color: #fff; }
.wf-node.linking { outline: 3px solid var(--accent); outline-offset: 2px; }
.wf-edge { stroke: #9aa6cc; stroke-width: 2.2; fill: none; pointer-events: stroke; }
.wf-edge-label { fill: #64748b; font-size: 11px; font-weight: 700; paint-order: stroke; stroke: #fff; stroke-width: 4px; }
.wf-hint {
  position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%);
  background: rgba(15,27,61,.75); color: #fff; font-size: 11px; padding: 5px 12px; border-radius: 999px;
  white-space: nowrap; z-index: 1; max-width: 92%; overflow: hidden; text-overflow: ellipsis;
}
.wf-edit-l { display: block; font-size: 12px; font-weight: 700; color: var(--navy); margin: 10px 0 4px; }
.wf-edit-i {
  width: 100%; padding: 9px 10px; border: 1.5px solid var(--line); border-radius: 9px;
  font-size: 13px; font-family: inherit; box-sizing: border-box;
}
.wf-edit-i:focus { outline: none; border-color: var(--accent); }
.wf-test-line { padding: 7px 10px; border-radius: 8px; background: #f6f8fc; border: 1px solid var(--line); margin: 4px 0; font-size: 12.5px; color: var(--ink); }
.wf-test-line .err { color: var(--red); font-style: normal; }
.meta-modal-overlay {
  position: fixed; inset: 0; background: rgba(15,27,61,.45); display: flex;
  align-items: center; justify-content: center; z-index: 900; padding: 16px;
}
.meta-modal {
  background: #fff; border-radius: 14px; padding: 18px; width: 100%; max-width: 420px;
  box-shadow: 0 20px 60px rgba(15,27,61,.25);
  max-height: calc(100vh - 32px); overflow-y: auto;
}
.meta-modal h4 { margin: 0 0 4px; color: var(--navy); }
.meta-page-list { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.meta-page-row {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 12px; background: #fff;
}
.meta-test-line { padding: 7px 10px; border-radius: 8px; border: 1px solid var(--line); margin: 4px 0; font-size: 12.5px; }

/* --- Meta connections redesign --- */
.meta-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.meta-status {
  display: inline-flex; align-items: center; gap: 7px; border-radius: 999px; padding: 6px 12px;
  font-size: 12px; font-weight: 800; letter-spacing: .03em; border: 1.5px solid var(--line); background: #fff; white-space: nowrap;
}
.meta-status i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.meta-status.ok { color: #14532d; background: var(--green-bg); border-color: #bfe6cd; }
.meta-status.ok i { background: var(--green); box-shadow: 0 0 0 3px rgba(22,163,74,.15); }
.meta-status.no { color: #7f1d1d; background: var(--red-bg); border-color: #f3c1c1; }
.meta-status.no i { background: var(--red); box-shadow: 0 0 0 3px rgba(220,38,38,.15); }
.meta-active-card { border: 2px solid #bfe6cd; background: linear-gradient(180deg, #f3fcf6, #fff); }
.meta-active-label { font-size: 11px; font-weight: 800; letter-spacing: .12em; color: var(--green); }
.meta-active-name { font-size: 20px; font-weight: 800; color: var(--navy); margin: 4px 0 2px; }
.meta-active-sub { font-size: 12.5px; color: var(--muted); margin-bottom: 10px; }
.meta-active-checks { display: flex; gap: 10px; flex-wrap: wrap; margin: 6px 0; }
.meta-check {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700;
  border-radius: 999px; padding: 5px 11px; border: 1.5px solid var(--line); background: #fff;
}
.meta-check.ok { color: #14532d; border-color: #bfe6cd; background: var(--green-bg); }
.meta-check.no { color: #7f1d1d; border-color: #f3c1c1; background: var(--red-bg); }
.meta-active-features { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 8px; font-size: 13px; font-weight: 600; color: var(--ink); }
.meta-account-line { margin: 4px 0 6px; }
.meta-account-name { font-size: 17px; font-weight: 800; color: var(--navy); }
.meta-status-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 2px; border-bottom: 1px dashed var(--line); font-size: 13.5px; }
.meta-status-row:last-child { border-bottom: 0; }
.meta-status-key { color: var(--muted); font-weight: 600; }
.meta-page-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; margin-top: 12px; }
.meta-page-card {
  border: 1.5px solid var(--line); border-radius: 12px; background: #fff; padding: 14px;
  display: flex; flex-direction: column; gap: 12px; transition: border-color .15s ease, box-shadow .15s ease;
}
.meta-page-card:hover { border-color: #c9d2e8; box-shadow: 0 6px 18px rgba(15,27,61,.08); }
.meta-page-card.active { border-color: #16a34a; box-shadow: 0 0 0 3px rgba(22,163,74,.12); }
.meta-page-card-top { display: flex; gap: 10px; align-items: flex-start; }
.meta-page-icon { font-size: 22px; line-height: 1; }
.meta-page-card-txt { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.meta-page-card-txt strong { color: var(--navy); font-size: 14px; line-height: 1.3; }
.meta-page-card-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: auto; }
.meta-error-box { border: 1.5px solid #f3c1c1; background: var(--red-bg); border-radius: 12px; padding: 14px; color: #7f1d1d; }
.meta-tech { margin-top: 4px; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; padding: 12px 14px; }
.meta-tech summary { cursor: pointer; font-weight: 700; color: var(--navy); font-size: 13.5px; }
.meta-lead-strip { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; border-left: 4px solid var(--green); }

/* --- Facebook Automation home + quick wizard --- */
.fa-quick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.fa-quick {
  display: flex; align-items: center; gap: 12px; text-align: left; cursor: pointer;
  border: 1.5px solid var(--line); border-radius: 12px; background: #fff; padding: 13px 14px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.fa-quick:hover { border-color: #c9d2e8; box-shadow: 0 6px 18px rgba(15,27,61,.08); }
.fa-quick-ic { font-size: 22px; line-height: 1; }
.fa-quick strong { display: block; color: var(--navy); font-size: 13.5px; }
.fa-quick em { display: block; color: var(--muted); font-size: 12px; font-style: normal; margin-top: 1px; }
.fa-ready-row { display: flex; align-items: center; gap: 10px; padding: 7px 2px; font-size: 13.5px; font-weight: 600; color: var(--ink); border-bottom: 1px dashed var(--line); }
.fa-ready-row:last-child { border-bottom: 0; }
.fa-ready-ic {
  display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px;
  border-radius: 50%; font-size: 12px; font-weight: 800; flex: 0 0 auto;
}
.fa-ready-ic.ok { background: var(--green-bg); color: var(--green); }
.fa-ready-ic.no { background: var(--red-bg); color: var(--red); }
.meta-ready-line { margin-top: 10px; border-radius: 10px; padding: 11px 13px; font-size: 13.5px; font-weight: 700; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
/* ---- AI chat tester (section 7 + floating widget) ---- */
.ai-chat-box { display: flex; flex-direction: column; gap: 8px; max-height: 380px; min-height: 180px; overflow-y: auto; background: #f6f8fb; border: 1px solid #e5e7eb; border-radius: 12px; padding: 12px; }
.ai-chat-empty { color: #8a94a6; font-size: 13px; text-align: center; margin: auto; line-height: 1.5; }
.ai-chat-row { display: flex; }
.ai-chat-row.you { justify-content: flex-end; }
.ai-chat-row.ai { justify-content: flex-start; }
.ai-bubble { max-width: 82%; padding: 9px 13px; border-radius: 14px; font-size: 13.5px; line-height: 1.45; white-space: pre-wrap; word-break: break-word; }
.ai-chat-row.you .ai-bubble { background: var(--primary, #1d4ed8); color: #fff; border-bottom-right-radius: 4px; }
.ai-chat-row.ai .ai-bubble { background: #fff; color: #1f2937; border: 1px solid #e5e7eb; border-bottom-left-radius: 4px; }
.ai-chat-controls { display: flex; gap: 8px; margin-top: 10px; align-items: center; }
.ai-chat-controls input { flex: 1; }
.ai-typing { display: inline-flex; gap: 4px; padding: 12px 14px; }
.ai-typing span { width: 7px; height: 7px; border-radius: 50%; background: #9aa5b5; animation: aiBlink 1.2s infinite; }
.ai-typing span:nth-child(2) { animation-delay: .2s; }
.ai-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes aiBlink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
/* ---- System Health (Developer Settings) ---- */
.health-summary { padding: 12px 14px; border-radius: 10px; background: #f6f8fb; border: 1px solid #e5e7eb; font-weight: 700; font-size: 14px; }
.health-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 2px; border-bottom: 1px solid #f1f3f8; flex-wrap: wrap; }
.health-row:last-child { border-bottom: none; }
.health-row .hint { font-weight: 500; }
.health-row.no .hint { color: #b91c1c; }
/* ---- Chat inbox (Messages view) ---- */
.chat-wrap { display: grid; grid-template-columns: 300px 1fr; gap: 14px; min-height: 420px; }
.chat-side { border: 1px solid var(--line, #e5e7eb); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; background: #fff; }
.chat-side-title { padding: 10px 14px; font-weight: 700; font-size: 12px; letter-spacing: .06em; color: #6b7280; border-bottom: 1px solid #eef0f5; }
.chat-item { padding: 10px 14px; cursor: pointer; border-bottom: 1px solid #f1f3f8; }
.chat-item:hover { background: #f6f8fb; }
.chat-item.active { background: #eef3ff; border-left: 3px solid var(--primary, #1d4ed8); }
.chat-item-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.chat-item-prev { color: #8a94a6; font-size: 12.5px; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-main { border: 1px solid var(--line, #e5e7eb); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; background: #f6f8fb; min-width: 0; }
.chat-head { display: flex; align-items: center; gap: 8px; padding: 11px 14px; background: #fff; border-bottom: 1px solid #eef0f5; flex-wrap: wrap; }
.chat-head-empty { padding: 16px; color: #8a94a6; text-align: center; font-size: 13.5px; }
.chat-body { flex: 1; padding: 14px; overflow-y: auto; max-height: 420px; display: flex; flex-direction: column; gap: 8px; }
.chat-input-row { display: flex; gap: 8px; padding: 12px; background: #fff; border-top: 1px solid #eef0f5; }
.chat-input-row input { flex: 1; }
.ai-bubble-time { font-size: 10.5px; opacity: .7; margin-top: 4px; font-weight: 500; }
@media (max-width: 768px) { .chat-wrap { grid-template-columns: 1fr; } .chat-side { max-height: 220px; overflow-y: auto; } .chat-body { max-height: 300px; } }
/* Floating widget */
.ai-widget-btn { position: fixed; right: 22px; bottom: 22px; width: 58px; height: 58px; border-radius: 50%; border: none; background: linear-gradient(135deg, #1d4ed8, #2563eb); color: #fff; font-size: 26px; cursor: pointer; z-index: 9998; box-shadow: 0 8px 24px rgba(29, 78, 216, .35); }
.ai-widget-btn:hover { transform: scale(1.06); }
.ai-widget { position: fixed; right: 22px; bottom: 92px; width: 350px; max-width: calc(100vw - 32px); background: #fff; border: 1px solid #e5e7eb; border-radius: 14px; box-shadow: 0 18px 50px rgba(15, 23, 42, .22); z-index: 9999; display: none; overflow: hidden; }
.ai-widget.open { display: block; }
.ai-widget-head { display: flex; align-items: center; justify-content: space-between; padding: 11px 14px; background: linear-gradient(135deg, #1d4ed8, #2563eb); color: #fff; font-weight: 700; font-size: 14px; }
.ai-widget-x { cursor: pointer; font-size: 15px; opacity: .85; padding: 2px 6px; border-radius: 6px; }
.ai-widget-x:hover { background: rgba(255, 255, 255, .2); opacity: 1; }
.ai-widget .ai-chat-box { max-height: 300px; min-height: 140px; border: none; border-radius: 0; }
.ai-widget .ai-chat-controls { padding: 0 12px 12px; margin-top: 0; }
.meta-ready-line.ok { background: var(--green-bg); color: #14532d; border: 1px solid #bfe6cd; }
.meta-ready-line.ok b { color: var(--green); }
.meta-ready-line.no { background: var(--amber-bg); color: #7c4a03; border: 1px solid #f3d9a4; }
.fa-wiz-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.fa-wiz-head h4 { margin: 0; color: var(--navy); }
.fa-wiz-opts { display: flex; flex-direction: column; gap: 8px; }
.fa-wiz-opt {
  display: flex; flex-direction: column; gap: 2px; text-align: left; cursor: pointer;
  border: 1.5px solid var(--line); border-radius: 11px; background: #fff; padding: 11px 13px;
  transition: border-color .15s ease, background .15s ease;
}
.fa-wiz-opt:hover { border-color: #c9d2e8; }
.fa-wiz-opt.sel { border-color: var(--green); background: var(--green-bg); }
.fa-wiz-opt.dis { opacity: .55; cursor: not-allowed; border-style: dashed; }
.fa-wiz-opt.dis:hover { border-color: #e2e6ee; }
.fa-wiz-opt strong { color: var(--navy); font-size: 13.5px; }
.fa-wiz-opt span { color: var(--muted); font-size: 12.5px; }
.fa-wiz-summary { display: flex; flex-direction: column; gap: 10px; margin: 6px 0 12px; }
.fa-wiz-summary div { border: 1.5px solid var(--line); border-radius: 11px; padding: 11px 13px; background: #f8fafc; }
.fa-wiz-summary b { color: var(--muted); font-size: 11px; letter-spacing: .08em; }
.fa-wiz-summary p { color: var(--navy); font-size: 13.5px; font-weight: 600; margin-top: 2px; }
.meta-test-line.ok { background: var(--green-bg); border-color: #bfe6cd; color: #14532d; }
.meta-test-line.fail { background: var(--red-bg); border-color: #f3c1c1; color: #7f1d1d; }
.conn-pill {
  display: inline-flex; align-items: center; gap: 7px; border: 1.5px solid var(--line);
  border-radius: 999px; padding: 7px 13px; font-size: 12.5px; font-weight: 700; color: var(--navy); background: #fff;
}
.conn-pill .dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.conn-pill .dot.ok { background: #16a34a; box-shadow: 0 0 0 3px rgba(22,163,74,.18); }
.conn-pill .dot.no { background: #dc2626; box-shadow: 0 0 0 3px rgba(220,38,38,.18); }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 8px 2px; border-bottom: 1px dashed var(--line); font-size: 13px; }
.kv:last-child { border-bottom: 0; }
.kv span { color: var(--muted); }
.kv strong { color: var(--navy); text-align: right; }

.test-badge {
  display: inline-block; background: #7c3aed; color: #fff; font-size: 11px; font-weight: 800;
  padding: 3px 10px; border-radius: 999px; letter-spacing: .04em; margin-left: 8px; vertical-align: middle;
}
.live-badge {
  display: inline-block; background: var(--green); color: #fff; font-size: 11px; font-weight: 800;
  padding: 3px 10px; border-radius: 999px; letter-spacing: .04em; margin-left: 8px; vertical-align: middle;
}

/* --------------------------------------------------------- CRM statuses */
.badge.new_lead, .badge.registration_started, .badge.registered, .badge.payment_pending, .badge.abandoned, .badge.follow_up { background: var(--amber-bg); color: #b45309; }
.badge.payment_submitted { background: var(--blue-bg); color: #1d4ed8; }
.badge.attended, .badge.completed, .badge.converted, .badge.active { background: var(--green-bg); color: var(--green); }
.badge.no_show { background: var(--red-bg); color: var(--red); }
.badge.scheduled { background: var(--blue-bg); color: #1d4ed8; }
.badge.queued, .badge.sending { background: var(--amber-bg); color: #b45309; }

/* --------------------------------------------------------- tabs + timeline */
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.tab {
  border: 1.5px solid var(--line); background: #fff;
  border-radius: 100px; padding: 8px 14px; font-size: 13px; font-weight: 700; color: var(--muted);
}
.tab.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.tab-body { min-height: 60px; }
.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ""; position: absolute; left: 6px; top: 4px; bottom: 4px; width: 2px; background: var(--line); }
.tl-item { position: relative; padding: 6px 0 6px 8px; }
.tl-dot {
  position: absolute; left: -22px; top: 12px;
  width: 10px; height: 10px; border-radius: 50%; background: var(--gold); border: 2px solid #fff;
  box-shadow: 0 0 0 2px var(--gold);
}
.tl-email .tl-dot { background: var(--blue-bg); box-shadow: 0 0 0 2px #1d4ed8; }
.tl-sms .tl-dot { background: var(--green-bg); box-shadow: 0 0 0 2px var(--green); }
.tl-auto .tl-dot { background: var(--amber-bg); box-shadow: 0 0 0 2px var(--accent-dark); }
.tl-audit .tl-dot { background: #eef0f5; box-shadow: 0 0 0 2px var(--muted); }
.tl-note .tl-dot { background: var(--red-bg); box-shadow: 0 0 0 2px var(--red); }
.tl-text { font-size: 14px; font-weight: 600; color: var(--ink); }
.tl-time { font-size: 12px; color: var(--muted); }

/* ------------------------------------------------------------- toggle */
.toggle { position: relative; width: 46px; height: 26px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle .slider {
  position: absolute; inset: 0; border-radius: 100px;
  background: #cbd2e0; cursor: pointer; transition: background .15s;
}
.toggle .slider::before {
  content: ""; position: absolute; width: 20px; height: 20px;
  border-radius: 50%; background: #fff; top: 3px; left: 3px;
  transition: transform .15s; box-shadow: 0 2px 6px rgba(0,0,0,.2);
}
.toggle input:checked + .slider { background: var(--green); }
.toggle input:checked + .slider::before { transform: translateX(20px); }
.auto-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px;
  margin-bottom: 10px; background: #fff;
}
.auto-row .auto-name { font-weight: 700; font-size: 14px; color: var(--navy); }
.auto-row .auto-trigger { font-size: 12px; color: var(--muted); }
.auto-row.off { opacity: .6; }

/* -------------------------------------------------------------- preview */
.email-preview {
  border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
  background: #fff;
}
.email-preview .preview-head {
  background: var(--navy); color: #fff; padding: 12px 16px;
  font-size: 13px; font-weight: 700;
}
.email-preview .preview-body { padding: 16px; font-size: 14px; white-space: pre-wrap; }
.email-preview .preview-subject { font-weight: 800; color: var(--navy); font-size: 15px; margin-bottom: 6px; }

/* --------------------------------------------------------------- photos */
.photo-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
.photo-card { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; }
.photo-card .photo { width: 100%; height: 180px; object-fit: cover; background: #eef0f5; }
.photo-card .photo-fallback { width: 100%; height: 180px; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--navy), var(--navy-3)); color: var(--gold); font-size: 56px; font-weight: 800; }
.photo-card .photo-body { padding: 12px 14px; }
.photo-card .photo-name { font-weight: 800; font-size: 14px; color: var(--navy); }
.photo-card .photo-meta { font-size: 12px; color: var(--muted); margin: 2px 0 8px; }
.photo-card .photo-text { font-size: 13px; color: var(--ink); font-style: italic; }
.photo-actions { display: flex; gap: 8px; padding: 0 14px 14px; }

/* ---------------------------------------------------------------- modal */
.modal-overlay {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(10,18,43,.6); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal {
  background: #fff; border-radius: 18px; padding: 26px;
  width: 100%; max-width: 520px; max-height: 90dvh; overflow-y: auto;
  box-shadow: 0 30px 80px rgba(0,0,0,.4);
}
.modal.small { max-width: 420px; }
.modal h3 { font-size: 18px; font-weight: 800; color: var(--navy); margin-bottom: 8px; }
.modal p { font-size: 14px; color: var(--muted); margin-bottom: 18px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ----------------------------------------------------------------- toast */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  z-index: 400; background: var(--navy); color: #fff;
  padding: 12px 20px; border-radius: 12px; font-size: 14px; font-weight: 600;
  box-shadow: 0 16px 40px rgba(0,0,0,.3); max-width: 90vw; text-align: center;
}
.toast.ok { background: var(--green); }
.toast.err { background: var(--red); }

/* ------------------------------------------------------------- empty state */
.empty { text-align: center; padding: 40px 16px; color: var(--muted); }
.empty .big { font-size: 40px; margin-bottom: 8px; }

/* ------------------------------------------------------------ responsive */
@media (max-width: 480px) {
  .user-email { display: none; }
  .topbar h2 { font-size: 16px; }
  .stat-card .value { font-size: 22px; }
  .card { padding: 16px; }
}

@media (min-width: 768px) {
  .sidebar { transform: none; }
  .main { margin-left: 250px; }
  .hamburger { display: none; }
  .stat-grid { grid-template-columns: repeat(3, 1fr); }
  .form-grid { grid-template-columns: 1fr 1fr; }
  .detail-grid { grid-template-columns: 1fr 1fr; }
  .photo-grid { grid-template-columns: repeat(2, 1fr); }
  .view { padding: 26px 26px 60px; }
}
@media (min-width: 1100px) {
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* Facebook profile link in the lead CRM */
.fb-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  margin-top: 2px;
}
.fb-link:hover { text-decoration: underline; }
.tag-chip {
  display: inline-block;
  background: #eef2ff;
  color: #3730a3;
  border: 1px solid #c7d2fe;
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 11px;
  font-weight: 600;
  margin: 1px 2px 1px 0;
}

/* ============ GHL-style automation dashboard ============ */
.pipe-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin: 0 0 16px; }
.pipe-col { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px; cursor: pointer; min-height: 104px; transition: box-shadow .15s, transform .1s; }
.pipe-col:hover { box-shadow: 0 4px 14px rgba(15, 27, 61, .10); transform: translateY(-1px); }
.pipe-head { display: flex; justify-content: space-between; align-items: center; font-weight: 800; font-size: 12px; letter-spacing: .04em; text-transform: uppercase; color: var(--navy); margin-bottom: 8px; }
.pipe-head b { background: var(--navy); color: #fff; border-radius: 20px; padding: 1px 9px; font-size: 12px; font-weight: 800; }
.pipe-lead { font-size: 12.5px; color: #333; background: #f6f8fb; border: 1px solid #eef1f6; border-radius: 8px; padding: 5px 8px; margin-bottom: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pipe-lead .hint { font-size: 11px; }
.pipe-more { font-size: 11.5px; color: var(--muted); padding: 2px 0; }
.pipe-empty { font-size: 12px; color: var(--muted); padding: 8px 0; }
.dash-cols { display: grid; grid-template-columns: 1.6fr 1fr; gap: 14px; align-items: start; }
.conv-item { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px dashed var(--line); cursor: pointer; }
.conv-item:last-child { border-bottom: 0; }
.conv-avatar { width: 34px; height: 34px; min-width: 34px; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 800; font-size: 13px; display: flex; align-items: center; justify-content: center; }
.conv-body { min-width: 0; flex: 1; }
.conv-top { display: flex; justify-content: space-between; gap: 8px; font-size: 13.5px; }
.conv-time { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.conv-msg { font-size: 12.5px; color: #555; margin: 2px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-meta { font-size: 11.5px; color: var(--muted); }
@media (max-width: 980px) { .pipe-grid { grid-template-columns: repeat(3, 1fr); } .dash-cols { grid-template-columns: 1fr; } }
@media (max-width: 620px) { .pipe-grid { grid-template-columns: repeat(2, 1fr); } }
/* GHL-style action cards */
.action-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 0 0 16px; }
.action-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; cursor: pointer; display: flex; flex-direction: column; gap: 2px; transition: box-shadow .15s, transform .1s; }
.action-card:hover { box-shadow: 0 6px 18px rgba(15, 27, 61, .12); transform: translateY(-2px); }
.action-card .ac-label { font-size: 13px; font-weight: 700; color: var(--navy); display: flex; align-items: center; gap: 6px; }
.action-card .ac-value { font-size: 30px; font-weight: 800; color: var(--navy); line-height: 1.15; }
.action-card .ac-sub { font-size: 11.5px; color: var(--muted); }
.action-card.ac-hot { border-top: 3px solid var(--red); }
.action-card.ac-hot .ac-value { color: var(--red); }
.action-card.ac-fu { border-top: 3px solid var(--accent-dark); }
.action-card.ac-fu .ac-value { color: var(--accent-dark); }
.action-card.ac-pay { border-top: 3px solid var(--green); }
.action-card.ac-pay .ac-value { color: var(--green); }
@media (max-width: 720px) { .action-cards { grid-template-columns: 1fr; } }
.fu-item { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--line); cursor: pointer; }
.fu-item:last-child { border-bottom: 0; }
.pay-item { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--line); cursor: pointer; }
.pay-item:last-child { border-bottom: 0; }
.pay-item .pay-amt { font-weight: 800; color: var(--navy); }
.dash-cols2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
@media (max-width: 980px) { .dash-cols2 { grid-template-columns: 1fr; } }
/* Owner-friendly dashboard refinish */
.dash-sec { font-size: 15px; font-weight: 800; color: var(--navy); margin: 22px 0 10px; letter-spacing: .02em; }
.dash-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.dash-fb { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fb-status { font-size: 13px; font-weight: 600; padding: 6px 12px; border-radius: 20px; }
.fb-status.ok { background: #e8f7ee; color: var(--green); }
.fb-status.bad { background: #fdecec; color: var(--red); }
.stat-card.clickable { cursor: pointer; transition: box-shadow .15s, transform .1s; }
.stat-card.clickable:hover { box-shadow: 0 6px 18px rgba(15, 27, 61, .12); transform: translateY(-2px); }
.ac-btn { margin-top: 6px; font-size: 12px; font-weight: 700; color: var(--accent-dark); }
.pipe-grid-9 { grid-template-columns: repeat(9, 1fr); }
@media (max-width: 1280px) { .pipe-grid-9 { grid-template-columns: repeat(5, 1fr); } }
@media (max-width: 900px) { .pipe-grid-9 { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 560px) { .pipe-grid-9 { grid-template-columns: repeat(2, 1fr); } }
.attention-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.attention-item:last-child { border-bottom: 0; }
.att-icon { font-size: 20px; width: 30px; text-align: center; }
.att-body { flex: 1; min-width: 0; }
.att-actions { white-space: nowrap; }
.card-foot { padding-top: 10px; border-top: 1px solid var(--line); margin-top: 8px; text-align: right; }
.ai-work { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 12px; }
.ai-stat { background: #f6f8fb; border: 1px solid #eef1f6; border-radius: 10px; padding: 12px 14px; text-align: center; }
.ai-stat b { display: block; font-size: 24px; font-weight: 800; color: var(--navy); }
.ai-stat span { font-size: 12px; color: var(--muted); }
.ai-status-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.auto-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.auto-chip { background: #e8f7ee; color: #157a3c; font-size: 12.5px; font-weight: 700; padding: 5px 12px; border-radius: 20px; }
.pipe-stage-chip { font-size: 11.5px; font-weight: 700; color: var(--accent-dark); background: #eef4ff; border-radius: 12px; padding: 2px 8px; margin-left: 6px; white-space: nowrap; }
.conv-actions { margin-top: 6px; display: flex; gap: 6px; flex-wrap: wrap; }
.conv-msg.ai { color: var(--accent-dark); }
.pay-cust { min-width: 0; }
.pay-time { white-space: nowrap; }
.pay-item .pay-amt { margin-left: auto; }
@media (max-width: 620px) { .ai-work { grid-template-columns: 1fr; } .attention-item { flex-wrap: wrap; } .att-actions { width: 100%; } }
