:root {
  --brand: #16a34a;
  --bg: #f5f6f8;
  --card: #fff;
  --text: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --soft: #f3f4f6;
  --danger: #dc2626;
  --chat-bg: #efeae2;
  --out: #d9fdd3;
  --in: #fff;
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115; --card: #171a21; --text: #e5e7eb; --muted: #9ca3af; --line: #2a2f3a; --soft: #1f232c;
    --chat-bg: #0b141a; --out: #005c4b; --in: #202c33;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0; }
h3 { font-size: 15px; margin: 18px 0 8px; }
h3:first-child { margin-top: 0; }
h4 { margin: 14px 0 6px; font-size: 13px; }
code { background: var(--soft); padding: 1px 5px; border-radius: 4px; font-size: 12.5px; word-break: break-all; }
pre { background: #111827; color: #e5e7eb; padding: 12px; border-radius: 8px; overflow-x: auto; font-size: 12.5px; white-space: pre-wrap; word-break: break-all; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.center { text-align: center; }
.pad { padding: 24px; }
.hidden, [hidden] { display: none !important; }
.fail { color: var(--danger); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row-end { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }

/* Forms */
label { display: block; margin-bottom: 12px; font-weight: 500; font-size: 13px; }
label > input, label > select, label > textarea { margin-top: 4px; }
input, select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font: inherit;
  background: var(--card); color: var(--text);
}
.row input, .row select, .filters input, .filters select { width: auto; }
input[type=checkbox], input[type=radio] { width: auto; margin: 0 6px 0 0; }
input[type=color] { height: 38px; padding: 2px; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--brand) 40%, transparent); border-color: var(--brand); }
label.check { font-weight: 400; display: flex; align-items: center; }
textarea { resize: vertical; margin-bottom: 10px; }

.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--card); color: var(--text); font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--soft); text-decoration: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { filter: brightness(.95); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.danger { color: var(--danger); }
.btn.small { padding: 4px 10px; font-size: 12.5px; }
.btn.block { width: 100%; justify-content: center; }
.btn:disabled { opacity: .6; cursor: wait; }

/* Layout */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 230px; flex-shrink: 0; background: var(--card); border-right: 1px solid var(--line); display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.logo { display: flex; align-items: center; gap: 8px; padding: 18px 18px 10px; font-weight: 700; font-size: 17px; }
.logo img { height: 28px; }
.logo.center { justify-content: center; margin-bottom: 10px; }
.logo-mark { color: var(--brand); font-size: 22px; line-height: 1; }
.ws-name { margin: 0 12px 8px; padding: 8px 10px; background: var(--soft); border-radius: 8px; font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; }
.ws-name small { display: block; color: var(--muted); font-weight: 400; }
.sidebar nav { display: flex; flex-direction: column; padding: 0 8px; }
.sidebar nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--text); font-weight: 500; }
.sidebar nav a:hover { background: var(--soft); text-decoration: none; }
.sidebar nav a.active { background: color-mix(in srgb, var(--brand) 12%, transparent); color: var(--brand); }
.nav-label { padding: 16px 18px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.sidebar-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-top: 1px solid var(--line); }
.sidebar-foot .me small { display: block; color: var(--muted); }
.sidebar-foot a { color: var(--muted); }
.main { flex: 1; min-width: 0; padding: 24px 28px; max-width: 1280px; }
.main.full { max-width: none; padding: 0; }
.main.full > .alert, .main.full > .impersonate { margin: 8px 12px; }
.menu-btn { display: none; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 small { font-size: 14px; font-weight: 400; }
.impersonate { background: #fef3c7; color: #92400e; padding: 8px 12px; border-radius: 8px; margin-bottom: 14px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 18px; }
.card.flush { padding: 0; overflow-x: auto; }
.card.narrow { max-width: 620px; }
.card.highlight { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 6%, var(--card)); }
.card.sticky { position: sticky; top: 20px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.grid2.tight { gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; align-items: end; }
.grid3 label { margin-bottom: 0; }

.alert { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; border: 1px solid; }
.alert.success { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.alert.error { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.alert.warning { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.alert a { color: inherit; text-decoration: underline; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 11.5px; font-weight: 600; text-transform: capitalize; }
.badge.green { background: #dcfce7; color: #166534; }
.badge.blue { background: #dbeafe; color: #1e40af; }
.badge.amber { background: #fef3c7; color: #92400e; }
.badge.red { background: #fee2e2; color: #991b1b; }
.badge.gray { background: var(--soft); color: var(--muted); }
.chip { display: inline-block; background: var(--soft); border-radius: 99px; padding: 1px 8px; font-size: 12px; margin: 1px 3px 1px 0; }
label.chip { display: inline-flex; margin: 3px; padding: 4px 10px; }
.pill { background: var(--brand); color: #fff; border-radius: 99px; font-size: 11px; padding: 0 7px; margin-left: auto; font-weight: 600; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot.green { background: #22c55e; }

.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.table.compact td { padding: 7px 8px; }
.table tr:last-child td { border-bottom: 0; }
.table td input { min-width: 80px; }
.table .actions { display: flex; gap: 6px; justify-content: flex-end; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: var(--soft); }
.filters { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.pager { display: flex; gap: 4px; flex-wrap: wrap; }
.pager a { padding: 4px 10px; border: 1px solid var(--line); border-radius: 6px; }
.pager a.active { background: var(--brand); color: #fff; border-color: var(--brand); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat span { color: var(--muted); font-size: 12.5px; }
.stat b { display: block; font-size: 22px; margin-top: 2px; }
.stat b small { font-size: 13px; color: var(--muted); font-weight: 500; }
.bar { height: 6px; background: var(--soft); border-radius: 99px; overflow: hidden; margin-top: 6px; }
.bar i { display: block; height: 100%; background: var(--brand); }
.chart { display: flex; gap: 6px; height: 160px; align-items: flex-end; }
.chart .col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; }
.chart .bars { flex: 1; display: flex; gap: 2px; align-items: flex-end; width: 100%; justify-content: center; }
.chart .bars i { width: 40%; border-radius: 3px 3px 0 0; min-height: 2px; }
.chart small { color: var(--muted); font-size: 11px; }
i.out { background: var(--brand); }
i.in { background: #93c5fd; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin-top: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }

/* Auth */
.auth-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 16px; }
.auth-card { width: 100%; max-width: 400px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 28px; }
.auth-card h1 { margin-bottom: 16px; text-align: center; }
.checklist { list-style: none; padding: 0; }
.checklist .ok { color: #16a34a; }
.checklist .bad { color: var(--danger); font-weight: 600; }

/* Modal */
dialog.modal { border: 0; border-radius: 14px; padding: 22px; width: min(460px, calc(100vw - 32px)); background: var(--card); color: var(--text); box-shadow: 0 20px 50px rgba(0, 0, 0, .25); }
dialog.modal.wide { width: min(620px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(0, 0, 0, .4); }

/* Inbox */
.inbox { display: flex; height: 100vh; }
.inbox-list { width: 340px; flex-shrink: 0; border-right: 1px solid var(--line); background: var(--card); display: flex; flex-direction: column; }
.inbox-list-head { padding: 12px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.search input { width: 100%; }
.tabs { display: flex; gap: 2px; flex-wrap: wrap; }
.tabs a { padding: 4px 9px; border-radius: 99px; color: var(--muted); font-size: 12.5px; }
.tabs a.active { background: color-mix(in srgb, var(--brand) 14%, transparent); color: var(--brand); font-weight: 600; }
.conv-list { overflow-y: auto; flex: 1; }
.conv { display: flex; gap: 10px; padding: 11px 12px; border-bottom: 1px solid var(--line); color: var(--text); }
.conv:hover { background: var(--soft); text-decoration: none; }
.conv.active { background: color-mix(in srgb, var(--brand) 10%, transparent); }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: color-mix(in srgb, var(--brand) 20%, var(--soft)); color: var(--brand); display: flex; align-items: center; justify-content: center; font-weight: 700; flex-shrink: 0; }
.conv-body { flex: 1; min-width: 0; }
.conv-top { display: flex; justify-content: space-between; gap: 6px; }
.conv-top b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-top small { color: var(--muted); white-space: nowrap; font-size: 11.5px; }
.conv-last { display: flex; justify-content: space-between; gap: 6px; color: var(--muted); font-size: 13px; }
.conv-last span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.chat { flex: 1; display: flex; flex-direction: column; min-width: 0; position: relative; background: var(--chat-bg); }
.empty-chat { flex: 1; display: flex; align-items: center; justify-content: center; color: var(--muted); }
.chat-head { display: flex; align-items: center; gap: 8px 12px; padding: 10px 16px; background: var(--card); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.chat-head small { display: block; color: var(--muted); }
/* the buttons wrap onto a second line instead of pushing Info off the screen */
.chat-actions { margin-left: auto; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; min-width: 0; }
.chat-actions select { width: auto; padding: 4px 8px; font-size: 12.5px; }
.back-link { display: none; font-size: 20px; }
.messages { flex: 1; overflow-y: auto; padding: 16px 6%; display: flex; flex-direction: column; gap: 4px; }
.msg { display: flex; }
.msg.out { justify-content: flex-end; }
.bubble { max-width: min(560px, 80%); background: var(--in); padding: 6px 9px 4px; border-radius: 8px; box-shadow: 0 1px .5px rgba(0, 0, 0, .13); word-wrap: break-word; }
.msg.out .bubble { background: var(--out); }
.bubble .meta { display: flex; justify-content: flex-end; gap: 4px; font-size: 11px; color: var(--muted); margin-top: 2px; }
.bubble .tick .read { color: #53bdeb; }
.bubble .err { color: var(--danger); font-size: 12px; margin-top: 2px; }
.bubble .media { max-width: 100%; max-height: 320px; border-radius: 6px; display: block; margin-bottom: 4px; }
.bubble .doc { display: block; padding: 8px; background: rgba(0, 0, 0, .05); border-radius: 6px; margin-bottom: 4px; }
.tag-tpl { font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
.window-note { background: #fffbeb; color: #92400e; padding: 10px 16px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; border-top: 1px solid #fde68a; }
.composer { display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px; background: var(--card); border-top: 1px solid var(--line); }
.composer-main { flex: 1; position: relative; }
.composer textarea { margin: 0; resize: none; max-height: 160px; }
.attach { margin: 0; font-size: 20px; cursor: pointer; padding: 6px; }
.quick-pop { position: absolute; bottom: 100%; left: 0; right: 0; background: var(--card); border: 1px solid var(--line); border-radius: 8px; max-height: 220px; overflow-y: auto; box-shadow: 0 6px 20px rgba(0, 0, 0, .12); }
.quick-pop div { padding: 8px 10px; cursor: pointer; font-size: 13px; }
.quick-pop div:hover { background: var(--soft); }
.info-panel { position: absolute; right: 0; top: 57px; bottom: 0; width: 300px; background: var(--card); border-left: 1px solid var(--line); padding: 16px; transform: translateX(100%); transition: transform .2s; overflow-y: auto; z-index: 5; }
.info-panel.show { transform: none; }

/* WhatsApp style preview */
.wa-preview { background: var(--chat-bg); padding: 14px; border-radius: 8px; margin: 10px 0; }
.wa-preview > * { background: var(--in); }
.wa-preview > div:first-child { border-radius: 8px 8px 0 0; }
.wa-preview { display: flex; flex-direction: column; }
.wa-preview > div { padding: 4px 10px; }
.wa-preview > div:first-child { padding-top: 8px; }
.wa-preview > div:last-child { padding-bottom: 8px; border-radius: 0 0 8px 8px; }
.wa-preview > div:only-child { border-radius: 8px; }
.wa-h { font-weight: 700; }
.wa-f { color: var(--muted); font-size: 12px; }
.wa-btn { text-align: center; color: #0284c7; border-top: 1px solid var(--line); font-weight: 500; }
.wa-preview mark { background: #fef08a; color: #000; border-radius: 3px; padding: 0 2px; }
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.tpl-head { display: flex; justify-content: space-between; gap: 8px; align-items: center; word-break: break-all; }
.btn-row { display: grid; grid-template-columns: 140px 1fr 1.4fr; gap: 6px; margin-bottom: 6px; }

.connected { display: flex; align-items: center; gap: 12px; padding: 12px; background: var(--soft); border-radius: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.connected form { margin-left: auto; }
.es-box { padding: 14px; border: 1px dashed var(--brand); border-radius: 8px; margin-bottom: 14px; }
details { margin-bottom: 10px; }
summary { cursor: pointer; color: var(--muted); margin-bottom: 10px; }
.copy { cursor: copy; }
.copy.copied { outline: 2px solid var(--brand); }
code.copy { display: inline-block; padding: 6px 8px; }
.docs h3 { margin-top: 22px; }
.tag-picks { margin: 0 0 12px 22px; }

/* Mobile */
@media (max-width: 900px) {
  .grid2 { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; z-index: 20; transform: translateX(-100%); transition: transform .2s; box-shadow: 0 0 30px rgba(0, 0, 0, .2); }
  .sidebar.open { transform: none; }
  .menu-btn { display: block; position: fixed; top: 10px; right: 10px; z-index: 21; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; font-size: 18px; color: var(--text); }
  .main { padding: 56px 16px 16px; }
  .main.full { padding-top: 0; }
  .inbox-list { width: 100%; }
  .inbox[data-contact]:not([data-contact=""]) .inbox-list { display: none; }
  .inbox[data-contact=""] .chat { display: none; }
  .back-link { display: block; }
  .messages { padding: 12px; }
  .chat-head { padding-right: 56px; flex-wrap: wrap; }
  .btn-row { grid-template-columns: 1fr; }
  .card.sticky { position: static; }
}

/* Plans */
.plan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; align-items: start; }
.plan-card.new { border-style: dashed; }
.plan-card h3 small { font-weight: 400; }

/* Auth & sign-up */
.auth-card .logo img, .signup .logo img { width: 28px; height: 28px; border-radius: 7px; }
.auth-card a.logo { color: var(--text); text-decoration: none; display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 17px; margin-bottom: 10px; }
.right { text-align: right; margin-top: -4px; }
.signup { display: grid; grid-template-columns: 1fr minmax(320px, 440px); gap: 48px; max-width: 980px; width: 100%; align-items: center; }
.signup .auth-card { max-width: none; }
.signup-side h2 { font-size: 30px; margin: 20px 0 14px; line-height: 1.2; }
.signup-side .logo { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 18px; color: var(--text); }
.ticks { list-style: none; padding: 0; }
.ticks li { padding: 6px 0 6px 28px; position: relative; }
.ticks li::before { content: "✓"; position: absolute; left: 0; color: var(--brand); font-weight: 700; }
.verify-bar { background: #eff6ff; color: #1e3a8a; border: 1px solid #bfdbfe; padding: 8px 12px; border-radius: 8px; margin-bottom: 14px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.verify-bar form { display: inline; }
@media (max-width: 760px) { .signup { grid-template-columns: 1fr; gap: 20px; } .signup-side ul, .signup-side p { display: none; } .signup-side h2 { font-size: 22px; } }

/* Contacts */
.stats.six { grid-template-columns: repeat(6, minmax(0, 1fr)); }
a.stat { color: inherit; text-decoration: none; }
a.stat:hover { border-color: var(--brand); }
.stat b.ok { color: #16a34a; }
.stat b.fail { color: var(--danger); }
.contacts-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 18px; align-items: start; }
.list-side { padding: 10px; position: sticky; top: 16px; }
.list-side .nav-label { padding: 12px 8px 4px; }
.list-item { display: flex; justify-content: space-between; gap: 8px; padding: 7px 8px; border-radius: 8px; color: var(--text); }
.list-item:hover { background: var(--soft); text-decoration: none; }
.list-item.active { background: color-mix(in srgb, var(--brand) 12%, transparent); color: var(--brand); font-weight: 600; }
.list-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item small { color: var(--muted); }
.new-list { display: flex; gap: 6px; margin-top: 10px; }
.new-list input { min-width: 0; }
.pad-s { padding: 4px 8px; }
.list-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.list-head h2 { margin: 0; font-size: 18px; }
.filters.card { padding: 12px; display: block; }
.filters .row { flex-wrap: wrap; }
.filters .row input[name=q] { flex: 1; min-width: 180px; }
.cond { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.cond select, .cond input { width: auto; flex: 1; min-width: 120px; }
.bulk-bar { position: sticky; top: 0; z-index: 4; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; background: var(--card); border: 1px solid var(--brand); border-radius: 10px; padding: 8px 12px; margin-bottom: 12px; box-shadow: 0 6px 16px rgba(0, 0, 0, .08); }
.bulk-bar select, .bulk-bar input { width: auto; padding: 4px 8px; font-size: 13px; }
.bulk-bar .tag-input { width: 110px; }
.bulk-bar .sep { flex: 1; }
.table .chk { width: 36px; }
.nowrap { white-space: nowrap; }
.chip.list { background: color-mix(in srgb, var(--brand) 12%, transparent); color: var(--brand); }
a.chip { color: inherit; }
.pager-row { justify-content: space-between; margin-top: 12px; }
.per { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.per select { width: auto; padding: 4px 6px; }
.list-picks { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin-bottom: 12px; }
.list-picks .tag-input { width: 140px; padding: 4px 8px; }
.steps-bar { display: flex; gap: 8px; list-style: none; padding: 0; margin: 0 0 18px; flex-wrap: wrap; }
.steps-bar li { padding: 6px 12px; border-radius: 99px; background: var(--soft); color: var(--muted); font-size: 13px; font-weight: 600; }
.steps-bar li.on { background: color-mix(in srgb, var(--brand) 14%, transparent); color: var(--brand); }
.drop { display: flex; flex-direction: column; align-items: center; gap: 4px; border: 2px dashed var(--line); border-radius: 12px; padding: 28px; text-align: center; cursor: pointer; position: relative; }
.drop:hover { border-color: var(--brand); }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.new-col { display: flex; gap: 6px; margin-top: 6px; }
.new-col input, .new-col select { width: auto; flex: 1; }
.import-map .table td { vertical-align: top; }
@media (max-width: 1100px) { .stats.six { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 900px) { .contacts-layout { grid-template-columns: 1fr; } .list-side { position: static; } }

/* Template builder */
.tb { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.tb-side { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 14px; }
.cat-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.cat-cards label { position: relative; border: 1px solid var(--line); border-radius: 10px; padding: 12px; cursor: pointer; margin: 0; display: flex; flex-direction: column; gap: 2px; }
.cat-cards input { position: absolute; opacity: 0; }
.cat-cards span { font-weight: 400; font-size: 12.5px; color: var(--muted); }
.cat-cards label:has(input:checked) { border-color: var(--brand); box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 30%, transparent); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; margin-bottom: 12px; flex-wrap: wrap; }
.seg label { margin: 0; }
.seg input { position: absolute; opacity: 0; }
.seg span { display: block; padding: 6px 14px; cursor: pointer; font-weight: 500; }
.seg input:checked + span { background: var(--brand); color: #fff; }
.counter { text-align: right; font-size: 12px; color: var(--muted); margin: -6px 0 6px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin-bottom: 6px; }
.toolbar > button:not(.btn), .emojis button { border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: 6px; padding: 3px 8px; cursor: pointer; font: inherit; }
.emojis { display: inline-flex; flex-wrap: wrap; gap: 2px; }
.emojis button { padding: 2px 4px; border: 0; background: transparent; font-size: 16px; }
.var-row { display: grid; grid-template-columns: 90px 1fr 1fr; gap: 8px; align-items: center; margin-bottom: 6px; }
.tb-warn { color: #b45309; font-size: 13px; padding-left: 18px; margin: 6px 0 0; }
.tb-btn { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.tb-btn input { width: auto; flex: 1; min-width: 140px; }
.small-drop { padding: 16px; }
.phone { background: #0b141a; border-radius: 26px; padding: 10px; box-shadow: 0 20px 40px -20px rgba(0, 0, 0, .5); }
.phone-top { display: flex; align-items: center; gap: 8px; color: #e9edef; padding: 6px 8px 10px; font-size: 14px; }
.phone-top .avatar { width: 28px; height: 28px; font-size: 12px; }
.phone-chat { background: #efeae2; border-radius: 16px; padding: 14px 12px; min-height: 360px; }
.wa-bubble { background: #fff; color: #111b21; border-radius: 8px; padding: 6px 8px; font-size: 14px; display: flex; flex-direction: column; gap: 4px; box-shadow: 0 1px .5px rgba(0, 0, 0, .13); max-width: 100%; word-wrap: break-word; }
.wa-bubble .wa-btn { border-top: 1px solid #e9edef; color: #0284c7; text-align: center; padding-top: 6px; }
.wa-bubble .wa-f { color: #667781; font-size: 12px; }
.wa-bubble mark { background: #fef08a; color: #000; border-radius: 3px; padding: 0 2px; }
.wa-media { width: 100%; max-height: 220px; object-fit: cover; border-radius: 6px; display: block; }
.wa-media.ph { background: #d1d7db; color: #54656f; height: 140px; display: grid; place-items: center; font-weight: 600; }
.wa-media.ph.doc { height: 56px; }
.wa-media.ph small { display: block; font-weight: 400; }
.wa-preview .wa-mediawrap { padding: 6px 6px 0; }
.var-legend { border-top: 1px solid var(--line); padding-top: 8px; margin-bottom: 8px; display: flex; flex-direction: column; gap: 3px; }
.alert.small { font-size: 12.5px; padding: 6px 10px; margin: 8px 0 0; }
.tips h4 { margin-top: 0; }
@media (max-width: 1000px) { .tb { grid-template-columns: 1fr; } .tb-side { position: static; } .cat-cards { grid-template-columns: 1fr; } }

/* Campaign wizard */
.wz-top { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.wz-top h1 { margin: 0; font-size: 22px; }
.stepper { display: flex; list-style: none; padding: 0; margin: 0 0 22px; counter-reset: st; }
.stepper li { flex: 1; position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--muted); text-align: center; }
.stepper li::before { content: ""; position: absolute; top: 15px; left: -50%; right: 50%; height: 2px; background: var(--line); z-index: 0; }
.stepper li:first-child::before { display: none; }
.stepper li.done::before, .stepper li.on::before { background: var(--brand); }
.st-dot { position: relative; z-index: 1; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--card); border: 2px solid var(--line); font-size: 13px; transition: .2s; }
.st-dot i { font-style: normal; }
.st-dot svg { display: none; }
.stepper li.on .st-dot { border-color: var(--brand); color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 18%, transparent); }
.stepper li.on { color: var(--text); }
.stepper li.done { cursor: pointer; color: var(--text); }
.stepper li.done .st-dot { background: var(--brand); border-color: var(--brand); color: #fff; }
.stepper li.done .st-dot i { display: none; }
.stepper li.done .st-dot svg { display: block; }
.wiz { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 22px; align-items: start; }
.wz-card { padding: 0; overflow: visible; }
.wz-head { padding: 22px 26px 4px; }
.wz-head small { font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--brand); }
.wz-head h2 { margin: 4px 0 4px; font-size: 20px; }
.wz-head p { margin: 0; color: var(--muted); font-size: 13.5px; }
.wz-panel { padding: 18px 26px 22px; }
.wz-panel h4 { margin: 4px 0 8px; font-size: 13.5px; }
.wz-big { font-size: 13px; font-weight: 600; }
.wz-big input { font-size: 17px; padding: 12px 14px; margin-top: 6px; }
.wz-suggest { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 12px; font-size: 12.5px; color: var(--muted); }
.chip-btn { border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: 999px; padding: 5px 12px; font-size: 12.5px; cursor: pointer; font-weight: 500; }
.chip-btn:hover { border-color: var(--brand); }
.chip-btn.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip-btn em { font-style: normal; opacity: .7; margin-left: 2px; }
.wiz-nav { position: sticky; bottom: 0; z-index: 4; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 26px; border-top: 1px solid var(--line); background: var(--card); border-radius: 0 0 12px 12px; }
.wz-err { color: var(--danger); flex: 1; text-align: center; font-size: 13px; font-weight: 600; }
#wz-next { min-width: 130px; }
#wz-next.send { background: #16a34a; border-color: #16a34a; }
/* option cards (audience, schedule) */
.opt-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; margin-bottom: 18px; }
.opt-cards.two { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.opt-card { position: relative; display: flex; gap: 12px; align-items: flex-start; border: 1.5px solid var(--line); border-radius: 12px; padding: 14px; cursor: pointer; margin: 0; transition: border-color .15s, background .15s; }
.opt-card:hover { border-color: color-mix(in srgb, var(--brand) 50%, var(--line)); }
.opt-card input { position: absolute; opacity: 0; pointer-events: none; }
.oc-ico { flex-shrink: 0; width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--soft); color: var(--muted); }
.oc-text { display: flex; flex-direction: column; gap: 2px; padding-right: 18px; }
.oc-text b { font-size: 14px; }
.oc-text small { font-size: 12.5px; color: var(--muted); font-weight: 400; }
.oc-check { position: absolute; top: 12px; right: 12px; width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line); }
.opt-card:has(input:checked) { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 6%, var(--card)); }
.opt-card:has(input:checked) .oc-ico { background: var(--brand); color: #fff; }
.opt-card:has(input:checked) .oc-check { border-color: var(--brand); background: var(--brand) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5 9-10'/%3E%3C/svg%3E") center/11px no-repeat; }
.aud-detail { margin-bottom: 14px; padding: 14px 16px; border-radius: 12px; background: var(--soft); }
.aud-detail textarea, .aud-detail input:not([type=file]):not([type=checkbox]):not([type=radio]) { background: var(--card); }
.pill-grid { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.wz-pill { margin: 0; cursor: pointer; }
.wz-pill input { display: none; }
.wz-pill span { display: inline-flex; gap: 6px; align-items: center; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); font-size: 13px; font-weight: 500; }
.wz-pill em { font-style: normal; color: var(--muted); font-size: 11.5px; }
.wz-pill input:checked + span { background: var(--brand); border-color: var(--brand); color: #fff; }
.wz-pill input:checked + span em { color: #fff; opacity: .8; }
.drop { display: block; border: 2px dashed var(--line); border-radius: 12px; padding: 18px; text-align: center; cursor: pointer; margin-bottom: 12px; background: var(--card); }
.drop:hover { border-color: var(--brand); }
.drop input { display: none; }
.drop span { display: flex; flex-direction: column; gap: 2px; }
.drop small { color: var(--muted); font-weight: 400; }
.small-seg span { padding: 5px 12px; font-size: 13px; }
.picker { border: 1px solid var(--line); border-radius: 12px; margin-bottom: 14px; overflow: hidden; }
.picker-bar { display: flex; gap: 6px; align-items: center; padding: 10px; border-bottom: 1px solid var(--line); background: var(--soft); flex-wrap: wrap; }
.picker-bar input { flex: 1; min-width: 160px; width: auto; }
.picker-list { max-height: 320px; overflow-y: auto; padding: 0 10px; }
.person { display: flex; align-items: center; gap: 8px; padding: 8px 4px; border-bottom: 1px solid var(--line); margin: 0; font-weight: 400; }
.aud-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 0 4px; border-top: 1px solid var(--line); }
.aud-foot .check { margin: 0; }
.count-pill { padding: 8px 14px; border-radius: 999px; background: color-mix(in srgb, var(--brand) 12%, transparent); color: var(--brand); font-size: 13.5px; }
.count-pill b { font-size: 16px; }
.count-pill.zero { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.count-pill.busy { opacity: .6; }
/* templates */
.tpl-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.tpl-tools input { width: 240px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.tpl-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; align-items: start; }
.tpl-card { position: relative; display: flex; flex-direction: column; border: 1.5px solid var(--line); border-radius: 12px; padding: 12px; cursor: pointer; margin: 0; transition: border-color .15s; }
.tpl-card:hover { border-color: color-mix(in srgb, var(--brand) 50%, var(--line)); }
.tpl-card input { position: absolute; opacity: 0; pointer-events: none; }
.tpl-card.on { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 20%, transparent); }
.tpl-card-head { display: flex; justify-content: space-between; gap: 6px; align-items: center; margin-bottom: 4px; word-break: break-all; font-size: 13.5px; }
.sel-badge { flex-shrink: 0; font-size: 11px; font-weight: 700; color: #fff; background: var(--brand); border-radius: 999px; padding: 2px 8px; }
.tpl-meta { font-size: 11.5px; color: var(--muted); margin-bottom: 8px; }
.badge.amber { background: #fef3c7; color: #92400e; }
.tpl-card-chat { background: #efeae2; border-radius: 8px; padding: 8px; max-height: 210px; overflow: hidden; position: relative; }
.tpl-card-chat::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 30px; background: linear-gradient(transparent, #efeae2); }
.tpl-card-chat .wa-bubble { font-size: 12.5px; max-width: 100%; }
.tpl-card .hdr, .tpl-card .hdr-doc { margin-bottom: 6px; }
.empty-box { text-align: center; padding: 30px; border: 2px dashed var(--line); border-radius: 12px; }
/* variables */
.map-table { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.map-row { display: grid; grid-template-columns: 110px minmax(130px, 1fr) minmax(170px, 1.1fr) minmax(170px, 1.1fr); gap: 10px; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.map-row:last-child { border-bottom: 0; }
.map-headrow { background: var(--soft); font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 9px 14px; }
.map-ph code { background: color-mix(in srgb, var(--brand) 12%, transparent); color: var(--brand); padding: 3px 7px; border-radius: 6px; font-size: 12px; white-space: nowrap; }
.map-label { display: flex; flex-direction: column; font-size: 13px; }
.map-label small { color: var(--muted); }
.map-row input[hidden] { display: none; }
.media-box { margin-top: 16px; padding: 14px 16px; border-radius: 12px; background: var(--soft); }
.media-box p { margin: 0 0 8px; }
/* preview */
.previews { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; background: #efeae2; border-radius: 12px; padding: 16px; margin-bottom: 16px; }
.preview-card small { display: block; color: #54656f; margin-bottom: 4px; font-size: 12px; }
.test-box { display: grid; gap: 8px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; }
.test-box p { margin: 2px 0 0; }
.test-row { display: flex; gap: 8px; }
.test-row input { flex: 1; max-width: 300px; }
.later-box { display: flex; gap: 12px; align-items: flex-end; padding: 14px 16px; border-radius: 12px; background: var(--soft); }
.later-box label { margin: 0; }
/* review */
.review-list { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin-bottom: 14px; }
.rv-row { display: grid; grid-template-columns: 150px 1fr auto; gap: 12px; align-items: start; padding: 13px 16px; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.rv-row:last-child { border-bottom: 0; }
.rv-k { color: var(--muted); font-weight: 600; }
.rv-v small { display: block; color: var(--muted); margin-top: 2px; }
.link-btn { border: 0; background: none; color: var(--brand); font-weight: 600; cursor: pointer; padding: 0; font-size: 13px; }
.link-btn:hover { text-decoration: underline; }
.cost-box { display: flex; gap: 16px; align-items: center; padding: 14px 16px; border-radius: 12px; background: color-mix(in srgb, #f59e0b 12%, transparent); border: 1px solid color-mix(in srgb, #f59e0b 35%, transparent); margin-bottom: 12px; }
.cost-box small { display: block; font-size: 12px; color: var(--muted); }
.cost-box b { font-size: 22px; white-space: nowrap; }
.cost-box p { margin: 0; font-size: 12.5px; color: var(--muted); }
/* side: phone + summary */
.wiz-side { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 14px; }
.phone { border: 8px solid #1f2937; border-radius: 30px; overflow: hidden; background: #efeae2; box-shadow: 0 10px 30px rgba(0,0,0,.15); }
.phone-bar { display: flex; gap: 10px; align-items: center; padding: 10px 12px; background: #075e54; color: #fff; }
.phone-bar b { display: block; font-size: 13.5px; }
.phone-bar small { font-size: 11px; opacity: .8; }
.phone-av { width: 32px; height: 32px; border-radius: 50%; background: #25d366; display: grid; place-items: center; font-weight: 700; }
.phone-chat { min-height: 300px; max-height: 470px; overflow-y: auto; padding: 14px 10px; background: #efeae2 radial-gradient(rgba(0,0,0,.035) 1px, transparent 1px) 0 0/14px 14px; }
.phone-empty { margin: 90px 16px 0; text-align: center; color: #667781; font-size: 13px; background: #fff; border-radius: 8px; padding: 12px; }
.phone-msg { max-width: 92%; font-size: 13px; position: relative; padding-bottom: 18px; }
.pm-h { display: block; margin-bottom: 4px; }
.pm-f { display: block; color: #667781; font-size: 11.5px; margin-top: 4px; }
.pm-time { position: absolute; right: 8px; bottom: 4px; font-size: 10.5px; color: #667781; }
.pm-btns { display: flex; flex-direction: column; gap: 3px; max-width: 92%; margin-top: 3px; }
.pm-btns span { background: #fff; color: #0284c7; border-radius: 8px; text-align: center; padding: 7px; font-size: 13px; font-weight: 500; }
.wz-sum { margin: 0; padding: 4px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.wz-sum div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.wz-sum div:last-child { border-bottom: 0; }
.wz-sum dt { color: var(--muted); }
.wz-sum dd { margin: 0; font-weight: 600; text-align: right; word-break: break-word; }
@media (max-width: 1100px) { .wiz { grid-template-columns: 1fr; } .wiz-side { position: static; } .phone { max-width: 340px; } }
@media (max-width: 700px) {
  .stepper .st-label { display: none; } .stepper li.on .st-label { display: block; position: absolute; top: 38px; white-space: nowrap; } .stepper { margin-bottom: 36px; }
  .wz-head, .wz-panel, .wiz-nav { padding-left: 16px; padding-right: 16px; }
  .map-row { grid-template-columns: 1fr; } .map-headrow { display: none; } .rv-row { grid-template-columns: 1fr auto; } .rv-k { grid-column: 1 / -1; }
  .wiz-nav { bottom: calc(58px + env(safe-area-inset-bottom)); }
}

/* Team & routing */
.presence { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--muted); background: transparent; cursor: pointer; padding: 0; }
.presence.on { background: #22c55e; border-color: #22c55e; }
.sidebar-foot { gap: 8px; }
.sidebar-foot .me { flex: 1; min-width: 0; overflow: hidden; color: inherit; border-radius: 6px; padding: 2px 4px; margin: -2px -4px; }
.sidebar-foot .me:hover { background: var(--soft); text-decoration: none; }
.bell { position: relative; text-decoration: none !important; font-size: 16px; }
.bell .pill { position: absolute; top: -8px; right: -10px; }
.conv-owner { font-size: 11.5px; color: var(--brand); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg.note { justify-content: center; }
.msg.note .bubble { background: #fef9c3; color: #713f12; border: 1px dashed #eab308; max-width: 70%; }
.history { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.member-row td { vertical-align: top; }
.team-card { border: 1px solid var(--line); border-radius: 10px; padding: 14px; margin-bottom: 12px; }
.rule-card { border: 1px solid var(--line); border-radius: 10px; padding: 14px; margin-bottom: 12px; }
.rule-cond { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.rule-cond select, .rule-cond input { width: auto; flex: 1; min-width: 120px; }
.dot.gray { background: var(--line); }

/* Bot builder */
.fb { display: flex; flex-direction: column; height: 100vh; background: var(--soft); }
.fb-top { display: flex; gap: 10px; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--card); }
.fb-name { font-weight: 700; font-size: 15px; width: 260px !important; border-color: transparent !important; background: transparent; padding: 6px 8px; }
.fb-name:hover, .fb-name:focus { border-color: var(--line) !important; background: var(--card); }
.fb-status { flex: 1; text-align: right; font-size: 12.5px; color: var(--muted); }
.fb-status.warn { color: #b45309; }
.fb-status.err { color: var(--danger); font-weight: 600; }
.switch { display: inline-flex; align-items: center; gap: 8px; margin: 0; cursor: pointer; font-size: 13px; }
.switch input { display: none; }
.switch span { width: 38px; height: 22px; border-radius: 22px; background: var(--line); position: relative; transition: .2s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: .2s; }
.switch input:checked + span { background: #16a34a; }
.switch input:checked + span::after { left: 19px; }
.fb-body { flex: 1; display: flex; min-height: 0; }
.fb-palette { width: 236px; flex-shrink: 0; border-right: 1px solid var(--line); background: var(--card); padding: 10px 12px 20px; overflow-y: auto; }
.fb-group { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 14px 4px 6px; }
.fb-group:first-child { margin-top: 4px; }
.fb-block { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 10px; margin-bottom: 2px; cursor: grab; border: 1px solid transparent; user-select: none; }
.fb-block:hover { background: var(--soft); border-color: var(--line); }
.fb-block b { display: block; font-size: 13px; font-weight: 600; }
.fb-block small { display: block; font-size: 11.5px; color: var(--muted); line-height: 1.3; }
.fb-ico { flex-shrink: 0; width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; color: var(--c); background: color-mix(in srgb, var(--c) 13%, transparent); }
.fb-canvas { flex: 1; position: relative; overflow: hidden; background: var(--soft); background-image: radial-gradient(color-mix(in srgb, var(--muted) 35%, transparent) 1px, transparent 1px); background-size: 20px 20px; }
.fb-empty { position: absolute; top: 18px; left: 50%; transform: translateX(-50%); z-index: 4; background: var(--card); border: 1px dashed var(--line); border-radius: 999px; padding: 8px 16px; font-size: 13px; color: var(--muted); pointer-events: none; }
.fb-zoom { position: absolute; right: 14px; bottom: 14px; z-index: 5; display: flex; background: var(--card); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.fb-zoom button { min-width: 36px; height: 34px; border: 0; border-right: 1px solid var(--line); background: transparent; color: var(--text); cursor: pointer; font-size: 14px; }
.fb-zoom button:last-child { border-right: 0; }
.fb-zoom button:hover { background: var(--soft); }
/* side panels */
.fb-inspector, .fb-test { width: 340px; flex-shrink: 0; border-left: 1px solid var(--line); background: var(--card); display: flex; flex-direction: column; min-height: 0; }
.ins-head { display: flex; gap: 10px; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.ins-head > div { flex: 1; }
.ins-head b { display: block; font-size: 15px; }
.ins-head small { color: var(--muted); font-size: 12px; }
.ins-ico { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; color: var(--c); background: color-mix(in srgb, var(--c) 13%, transparent); }
.ins-body { flex: 1; overflow-y: auto; padding: 14px 16px; }
.ins-body h4 { margin: 0 0 10px; font-size: 14px; }
.ins-body label { display: block; font-size: 12.5px; font-weight: 600; margin: 0 0 12px; }
.ins-body label > input, .ins-body label > select, .ins-body label > textarea { margin-top: 5px; font-weight: 400; }
.ins-body .small { font-size: 12px; }
.ins-foot { display: flex; justify-content: space-between; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); }
.btn.danger { color: var(--danger); }
.ins-tokens { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; font-size: 12px; color: var(--muted); margin: -6px 0 14px; }
.ins-tokens button { border: 1px solid var(--line); background: var(--soft); color: var(--text); border-radius: 999px; padding: 2px 8px; font-size: 11.5px; cursor: pointer; }
.ins-tokens button:hover { border-color: var(--brand); }
.opt-list { display: flex; flex-direction: column; gap: 6px; margin: 6px 0 8px; }
.opt-row { display: flex; align-items: center; gap: 6px; }
.opt-row span { width: 22px; height: 22px; flex-shrink: 0; border-radius: 50%; background: var(--soft); font-size: 11px; display: grid; place-items: center; color: var(--muted); }
.opt-row input { flex: 1; }
.opt-row button { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 13px; padding: 4px; }
.opt-row button:hover { color: var(--danger); }
.ins-row { display: flex; gap: 8px; margin: 5px 0 12px; }
.ins-row input { width: 90px; }
.ins-help { margin-top: 18px; background: var(--soft); border-radius: 10px; padding: 12px 14px; font-size: 12.5px; }
.ins-help ol { margin: 6px 0 0; padding-left: 18px; }
.ins-help li { margin-bottom: 4px; }
.upload-btn { display: inline-block !important; border: 1px dashed var(--line); border-radius: 8px; padding: 7px 12px; cursor: pointer; font-weight: 600; margin-bottom: 12px !important; }
.upload-btn:hover { border-color: var(--brand); }
.fb-test-head { display: flex; gap: 6px; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.fb-test-head b { flex: 1; }
.fb-test-note { margin: 0; padding: 8px 14px; border-bottom: 1px solid var(--line); }
.fb-chat { flex: 1; overflow-y: auto; padding: 12px; background: var(--chat-bg); display: flex; flex-direction: column; gap: 6px; }
.fb-chat .fbm { max-width: 85%; padding: 6px 9px; border-radius: 8px; font-size: 13.5px; }
.fb-chat .fbm.me { align-self: flex-end; background: var(--out); }
.fb-chat .fbm.bot { align-self: flex-start; background: var(--in); }
.fb-chat .fbm.sys { align-self: center; background: transparent; color: var(--muted); font-size: 12px; text-align: center; }
.tb-opts { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.tb-opts button { border: 1px solid var(--line); background: var(--card); color: #0284c7; border-radius: 6px; padding: 5px; cursor: pointer; font: inherit; }
.fb-test-input { display: flex; gap: 6px; padding: 10px; border-top: 1px solid var(--line); }
/* blocks on the canvas */
#drawflow .drawflow-node { width: 230px; padding: 0; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--text); box-shadow: 0 2px 10px rgba(0,0,0,.06); min-height: 0; align-items: stretch; }
#drawflow .drawflow-node:hover { box-shadow: 0 4px 16px rgba(0,0,0,.1); }
#drawflow .drawflow-node.selected { background: var(--card); }
#drawflow .drawflow-node.picked { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 30%, transparent); }
#drawflow .drawflow-node.start { width: 210px; }
#drawflow .drawflow-node .drawflow_content_node { width: 100%; }
#drawflow .drawflow-node .inputs, #drawflow .drawflow-node .outputs { align-self: flex-start; padding-top: 12px; }
#drawflow .drawflow-node .input, #drawflow .drawflow-node .output { width: 14px; height: 14px; border: 2px solid #94a3b8; background: var(--card); }
#drawflow .drawflow-node .input { left: -8px; }
#drawflow .drawflow-node .output { right: -8px; }
#drawflow .drawflow-node .output:hover, #drawflow .drawflow-node .input:hover { background: var(--brand); border-color: var(--brand); }
#drawflow .drawflow-node.multi .outputs { align-self: stretch; display: flex; flex-direction: column; justify-content: flex-end; padding: 0 0 8px; }
#drawflow .drawflow-node.multi .output { margin: 6px 0; }
#drawflow .connection .main-path { stroke: #94a3b8; stroke-width: 2.5px; }
#drawflow .connection .main-path:hover, #drawflow .connection .main-path.selected { stroke: var(--brand); }
#drawflow .drawflow-delete { background: var(--danger); border-color: var(--danger); color: #fff; }
.nb-head { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-bottom: 1px solid var(--line); font-size: 13px; }
.nb-ico { width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; color: #fff; background: var(--c); }
.nb-sum { padding: 9px 12px; font-size: 12.5px; line-height: 1.4; color: var(--text); white-space: pre-line; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }
.nb-empty { color: var(--muted); font-style: italic; }
.nb-outs { border-top: 1px solid var(--line); padding: 4px 0 6px; }
.nb-out { height: 26px; line-height: 26px; padding: 0 16px 0 12px; font-size: 12px; text-align: right; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nb-out.other { color: var(--muted); font-weight: 400; font-style: italic; }
@media (max-width: 1100px) { .fb-palette { width: 190px; } .fb-block small { display: none; } .fb-inspector, .fb-test { width: 300px; } }
@media (max-width: 800px) { .fb-palette { width: 64px; padding: 8px; } .fb-block b, .fb-group { display: none; } .fb-inspector, .fb-test { position: fixed; right: 0; top: 0; bottom: 0; z-index: 30; width: 88vw; box-shadow: -4px 0 20px rgba(0,0,0,.15); } .fb-name { width: 140px !important; } }

/* Developer page */
.page-tabs { margin-bottom: 14px; }
.log-table { max-height: 420px; overflow-y: auto; }
.key-form { margin-top: 14px; }

/* Phone bottom bar */
.bottom-nav { display: none; }
@media (max-width: 760px) {
  .bottom-nav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; background: var(--card); border-top: 1px solid var(--line); padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); }
  .bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; color: var(--muted); font-size: 11px; position: relative; text-decoration: none; }
  .bottom-nav a.active { color: var(--brand); }
  .bottom-nav .pill { position: absolute; top: 2px; left: 54%; font-style: normal; }
  .has-bottom .main { padding-bottom: 80px; }
  .has-bottom .main.full { padding-bottom: 0; }
  .has-bottom .inbox { height: calc(100vh - 58px); }
  .has-bottom .menu-btn { display: none; }
}

/* Template media headers: same look everywhere. WhatsApp crops header images/videos to ~1.91:1 */
.hdr { display: block; width: 100%; aspect-ratio: 1.91 / 1; border-radius: 6px; overflow: hidden; background: #d1d7db; position: relative; }
.hdr img, .hdr video { width: 100%; height: 100%; object-fit: cover; display: block; background: #000; }
.hdr.ph { display: grid; place-items: center; color: #54656f; font-weight: 600; font-size: 13px; }
.hdr-doc { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 6px; background: rgba(0, 0, 0, .06); color: inherit; text-decoration: none !important; min-width: 0; }
.hdr-doc .doc-ico { flex-shrink: 0; width: 34px; height: 40px; border-radius: 4px; background: #e53935; color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; }
.hdr-doc .doc-name { flex: 1; min-width: 0; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hdr-doc .doc-open { font-size: 12px; color: #0284c7; }
.wa-preview > .hdr, .wa-preview > .hdr-doc { margin: 6px 6px 2px; width: auto; padding: 0; }
.wa-preview > .hdr-doc { padding: 10px; }
.wa-bubble .hdr, .bubble .hdr { margin-bottom: 4px; }
.bubble .hdr { width: 280px; max-width: 100%; }
.bubble .hdr-doc { margin-bottom: 4px; }
.tpl-grid { align-items: start; }
/* header joined to its bubble in template previews */
.wa-preview > .hdr { margin: 0; border: 6px solid var(--in); border-bottom: 0; border-radius: 8px 8px 0 0; width: auto; }
.wa-preview > .hdr + div, .wa-preview > .hdr-doc + div { border-radius: 0; }
.wa-preview > .hdr-doc { margin: 0; border-radius: 8px 8px 0 0; background: var(--in); box-shadow: inset 0 0 0 6px var(--in); }
.wa-preview > .hdr-doc .doc-ico { margin-left: 2px; }

/* Contact form: extra fields */
.cf-input { display: flex; gap: 6px; align-items: center; margin-top: 4px; }
.cf-input input { margin: 0; }
.cf-remove { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 14px; padding: 4px 6px; border-radius: 6px; }
.cf-remove:hover { background: var(--soft); color: var(--danger); }
.cf-add { margin: 0 0 12px; }
.cf-add select { width: auto; border-style: dashed; color: var(--brand); font-weight: 600; cursor: pointer; }
.cf-new-row { display: grid; grid-template-columns: 1.2fr 110px 1.4fr auto; gap: 8px; align-items: center; margin-bottom: 8px; }
@media (max-width: 600px) { .cf-new-row { grid-template-columns: 1fr 1fr; } }
/* the bot builder gets the whole screen; "← Bots" leads back */
body:has(.fb) .sidebar, body:has(.fb) .bottom-nav, body:has(.fb) .menu-btn { display: none !important; }
body:has(.fb) .main { margin-left: 0 !important; padding: 0 !important; max-width: none !important; }
.ok { color: #16a34a; }
.check-grid { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 10px; }

/* Round-1 fixes */
@media (max-width: 900px) { .contacts-layout { grid-template-columns: minmax(0, 1fr); } }
/* full-screen pages (inbox, bot builder) leave room for the super-admin bar */
.main.full { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
.main.full > .inbox, .main.full > .fb { flex: 1; min-height: 0; height: auto; }
.main.full > .impersonate { flex-shrink: 0; }
body:has(.fb) .main.full > .impersonate { margin: 0; border-radius: 0; }
@media (max-width: 760px) {
  .has-bottom .main.full { height: calc(100dvh - 58px); }
  .has-bottom .main.full > .inbox { height: auto; }
  body:has(.fb) .main.full { height: 100dvh; }
  .chat-actions { margin-left: 0; width: 100%; flex-wrap: wrap; }
}
.bot-new input { flex: 1; min-width: 240px; }
/* sign-up on phones: one heading, even spacing */
@media (max-width: 760px) {
  .signup-side h2 { display: none; }
  .signup-side .logo { justify-content: center; }
  .signup .grid2.tight { gap: 0; }
}
.signup-sub { display: none; margin: -6px 0 16px; }
@media (max-width: 760px) { .signup-sub { display: block; } }
.info-panel:not(.show) { visibility: hidden; }
.inbox { overflow: hidden; }
@media (max-width: 760px) { .info-panel { width: 88vw; } }
.info-panel { transition: transform .2s, visibility .2s; }
/* bot builder on phones: panel opens only when a block is tapped or Settings is pressed */
.fb-settings-btn, .ins-hide { display: none; }
@media (max-width: 800px) {
  .fb-settings-btn, .ins-hide { display: inline-flex; }
  .fb-inspector:not(.open) { display: none; }
  .fb-top { flex-wrap: wrap; gap: 6px; padding: 8px 10px; }
  .fb-status { order: 10; flex-basis: 100%; text-align: left; }
}
/* bot list on phones: one card per bot */
@media (max-width: 760px) {
  .bot-table thead { display: none; }
  .bot-table tr { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; padding: 14px; border-bottom: 1px solid var(--line); }
  .bot-table td { display: block; padding: 0; border: 0; }
  .bot-table td:first-child, .bot-table td.actions { grid-column: 1 / -1; }
  .bot-table td[data-label]::before { content: attr(data-label); display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
  .bot-table td.actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
}
/* OAuth consent */
.consent { max-width: 460px; }
.consent-box { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin: 14px 0; background: var(--soft); }
.consent-box ul { margin: 8px 0; padding-left: 20px; }
.consent-box li { margin: 4px 0; }
.consent-actions { display: flex; gap: 10px; justify-content: flex-end; }
.consent-actions .btn { flex: 1; justify-content: center; }
/* Settings: AI assistants */
.ai-url { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px; border-radius: 10px; background: var(--soft); border: 1px solid var(--line); margin: 10px 0; }
.ai-url span { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.ai-url code { font-size: 14px; cursor: pointer; word-break: break-all; }
.ai-how { margin: 6px 0 14px; }
.ai-how summary { cursor: pointer; font-weight: 600; color: var(--brand); }
.ai-how li { margin: 6px 0; }
.ai-app { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.ai-app small { display: block; }
/* action buttons inside table rows: keep the cell a real table cell so row dividers line up */
.table td.actions { display: table-cell; text-align: right; white-space: nowrap; }
.table td.actions > * { display: inline-block; vertical-align: middle; margin-left: 4px; }
.table td.actions form { margin: 0; }
@media (max-width: 760px) { .table.bot-table td.actions { display: flex; text-align: left; white-space: normal; } .table.bot-table td.actions > * { margin-left: 0; } }
.bot-table code { word-break: normal; overflow-wrap: break-word; }
/* monthly spend */
.spend-filter { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin: 0 0 14px; }
.spend-filter label { margin: 0; display: flex; align-items: center; gap: 8px; font-weight: 600; }
.spend-filter select { width: auto; }
.table th.num, .table td.num { text-align: right; white-space: nowrap; }
.spend-card .spend-rows { margin: 8px 0 0; }
.spend-card .spend-rows div { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.spend-card .spend-rows div:last-child { border-bottom: 0; font-weight: 700; font-size: 16px; }
.spend-card .spend-rows small { color: var(--muted); }
.spend-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.spend-head select { width: auto; padding: 4px 8px; }
.table-scroll { overflow-x: auto; }
.nowrap { white-space: nowrap; }
.main:not(.full) { max-width: 1480px; }
.spend-refresh { margin: -6px 0 14px; }
.period-pick { display: inline-flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 0; }
.period-pick select, .period-pick input { width: auto; padding: 5px 8px; }
.period-dates { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.period-dates[hidden] { display: none; }
.spend-filter form { margin: 0; }
.spend-note { margin: -4px 0 14px; }
/* sidebar: never squeeze the logo, business name or footer when the menu is taller than the screen; the menu scrolls instead */
.sidebar > * { flex-shrink: 0; }
.ws-name { white-space: nowrap; }
.ws-name small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ind-table td.center, .ind-table th.center { text-align: center; }
.ind-group td { background: var(--soft); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.ind-table input[type=checkbox] { width: 18px; height: 18px; }
.switch-table select { width: auto; }
.card.narrow + .card.narrow, .card.narrow + form.card.narrow, form.card.narrow + .card.narrow { margin-top: 16px; }
.tabs-inline { display: flex; gap: 6px; }
.req-card { margin-bottom: 12px; }
.req-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.req-msg { background: var(--soft); border-radius: 8px; padding: 8px 12px; }
.req-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; align-items: end; margin-top: 10px; }
.req-form label { margin: 0; }
.req-actions { display: flex; gap: 8px; justify-content: flex-end; }
/* Integrations */
.integ { margin-bottom: 16px; }
.integ-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.integ-head h3 { margin: 0; }
.integ-status { font-size: 12.5px; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: var(--soft); color: var(--muted); }
.integ-status.ok { background: color-mix(in srgb, #16a34a 14%, transparent); color: #16a34a; }
.integ-status.warn { background: #fef3c7; color: #92400e; }
.integ-status.info { background: color-mix(in srgb, #2563eb 12%, transparent); color: #2563eb; }
.integ-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin: 14px 0; }
.integ-panel { padding: 14px 16px; border-radius: 12px; background: var(--soft); }
.integ-panel input, .integ-panel select, .integ-panel textarea { background: var(--card); }
.svc-set { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; margin: 0 0 12px; }
.svc-set legend { font-weight: 700; font-size: 13.5px; padding: 0 6px; }

/* ---------- Knowledge base ---------- */
.kb-howto { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.kb-howto h3 { margin: 0 0 6px; }
.kb-steps { margin: 0; padding-left: 20px; line-height: 1.7; }
.kb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 16px; }
.kb-card { margin: 0; display: flex; flex-direction: column; }
.kb-card .row-end { margin-top: auto; padding-top: 12px; }
.kb-card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.kb-card-head h3 { margin: 0 0 8px; }
.kb-mini { list-style: none; margin: 0; padding: 0; }
.kb-mini li { display: flex; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }
.kb-mini li:last-child { border-bottom: 0; }
.kb-mini li a { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kb-pct { margin-top: 10px; font-size: 12.5px; color: var(--muted); }
.kb-bar { display: inline-block; width: 60px; vertical-align: middle; margin: 0 4px 0 0; }
.kb-title-cell { display: flex; align-items: center; gap: 10px; }
.kb-thumb { width: 40px; height: 40px; border-radius: 6px; background: var(--soft) center/cover no-repeat; flex-shrink: 0; }
.kb-star { color: #d97706; font-style: normal; font-size: 12px; }
.kb-edit { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 18px; align-items: start; }
.kb-main fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.kb-side { position: sticky; top: 16px; }
.kb-side h3 { margin-top: 0; }
.kb-jump { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 14px; position: sticky; top: 0; z-index: 3; background: var(--bg); padding: 6px 0; }
.kb-jump a { padding: 4px 10px; border-radius: 99px; background: var(--card); border: 1px solid var(--line); font-size: 12.5px; color: var(--text); }
.kb-group { scroll-margin-top: 50px; }
.kb-group h3 { margin-top: 0; }
.kb-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.kb-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.kb-field.wide { grid-column: 1 / -1; }
.kb-label { display: flex; justify-content: space-between; gap: 8px; font-weight: 600; font-size: 13.5px; }
.kb-by { font-weight: 500; font-size: 11px; color: #6d28d9; background: #ede9fe; border-radius: 99px; padding: 1px 8px; white-space: nowrap; }
.kb-checks { display: flex; flex-wrap: wrap; }
.kb-tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
.kb-rows th, .kb-rows td { padding: 6px 8px; }
.kb-rows td input, .kb-rows td textarea { min-width: 110px; }
.kb-rows td:last-child { width: 40px; }
.kb-row-add { align-self: flex-start; margin-top: 6px; }
.kb-file-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 6px; }
.kb-file { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; }
.kb-file-img { width: 44px; height: 44px; border-radius: 6px; background: var(--soft) center/cover no-repeat; flex-shrink: 0; }
.kb-file-ico { width: 44px; height: 44px; border-radius: 6px; background: #fee2e2; color: #991b1b; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.kb-file-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kb-savebar { position: sticky; bottom: 0; z-index: 4; display: flex; gap: 10px; align-items: center; padding: 12px 16px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 -4px 16px rgba(0,0,0,.06); }
.kb-versions { list-style: none; margin: 0; padding: 0; max-height: 360px; overflow-y: auto; }
.kb-versions li { display: flex; justify-content: space-between; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.kb-versions li:last-child { border-bottom: 0; }
.kb-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 18px; align-items: start; }
.kb-types h3 { margin-top: 0; }
.kb-types ul { list-style: none; margin: 0 0 12px; padding: 0; }
.kb-types li { display: flex; justify-content: space-between; gap: 6px; padding: 8px 10px; border-radius: 8px; }
.kb-types li.active { background: color-mix(in srgb, var(--brand) 10%, var(--card)); }
.kb-types li.active a { font-weight: 600; }
.kb-types li.is-hidden a, .kb-fieldlist tr.is-hidden td { opacity: .55; }
.kb-newtype summary { list-style: none; cursor: pointer; display: inline-block; }
.kb-newtype summary::-webkit-details-marker { display: none; }
.kb-newtype form { margin-top: 10px; }
.kb-rename { align-items: flex-end; }
.kb-rename label { margin: 0; }
.kb-fieldlist .actions { flex-wrap: nowrap; align-items: center; }
.kb-fieldlist .actions .row { flex-wrap: nowrap; gap: 4px; }
.kb-fieldlist td:last-child { width: 1%; white-space: nowrap; }
.kb-fieldlist .actions form { margin: 0; }
.kb-text { white-space: pre-wrap; word-break: break-word; font: 13px/1.6 inherit; font-family: inherit; background: var(--soft); border-radius: 8px; padding: 14px; max-height: 70vh; overflow-y: auto; margin: 0; }
@media (max-width: 900px) {
  .kb-edit, .kb-layout { grid-template-columns: 1fr; }
  .kb-side { position: static; }
  .kb-fields { grid-template-columns: 1fr; }
  .hide-sm { display: none; }
  .kb-savebar { bottom: 64px; }
}
.kb-review { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.kb-claude { flex-basis: 100%; }
.kb-claude textarea { width: 100%; font-size: 13px; margin: 6px 0 8px; }
.kb-sg-page { margin: 18px 0 8px; }
.kb-sg { display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; margin-bottom: 10px; }
.kb-sg-body { flex: 1; min-width: 0; }
.kb-sg-act { display: flex; gap: 6px; flex-shrink: 0; }
.kb-diff { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 8px 0; }
.kb-old, .kb-new { border-radius: 8px; padding: 8px 10px; font-size: 13px; word-break: break-word; }
.kb-old { background: #fef2f2; color: #7f1d1d; }
.kb-new { background: #ecfdf5; color: #065f46; }
.kb-sg-vals { margin: 6px 0; padding-left: 18px; }
@media (max-width: 900px) { .kb-sg { flex-direction: column; } .kb-diff { grid-template-columns: 1fr; } }
.kb-pend { background: #fef3c7; color: #92400e; }
.audit-list { list-style: none; margin: 0; padding: 0; }
.audit-list li { display: flex; flex-direction: column; gap: 2px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; word-break: break-word; }
.audit-list li:last-child { border-bottom: 0; }
.kb-ways-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.kb-ways-grid p { margin: 4px 0 10px; }
.kb-ways h3 { margin-top: 0; }
.kb-rv-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.kb-rv-head label { margin: 0; }
.kb-rv-chk { width: 34px; }
.kb-bulkbar { margin-top: 12px; }
.kb-bulk-count { font-weight: 600; margin-right: auto; }
@media (max-width: 900px) { .kb-ways-grid { grid-template-columns: 1fr; } }
/* arrange the side menu */
.nav-arrange { margin: 8px 18px 4px; padding: 4px 8px; background: none; border: 1px dashed var(--line); border-radius: 8px; color: var(--muted); font-size: 12px; cursor: pointer; align-self: flex-start; }
.nav-arrange:hover { color: var(--text); border-color: var(--muted); }
.sidebar.arranging .nav-arrange { background: var(--brand); color: #fff; border: 1px solid var(--brand); }
.sidebar.arranging .nav-sortable a { cursor: grab; touch-action: none; user-select: none; border: 1px dashed var(--line); margin-bottom: 3px; }
.sidebar.arranging .nav-sortable a::after { content: '⋮⋮'; margin-left: auto; color: var(--muted); letter-spacing: -2px; }
.sidebar.arranging .nav-sortable a.dragging { cursor: grabbing; background: var(--soft); box-shadow: 0 4px 14px rgba(0,0,0,.15); border-style: solid; }
.kb-what { margin-top: 16px; }
.kb-what summary { cursor: pointer; }
.kb-what-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin-top: 12px; }
.kb-what h4 { margin: 0 0 6px; }
.kb-what ul { margin: 0; padding-left: 18px; font-size: 13.5px; line-height: 1.6; }
@media (max-width: 900px) { .kb-what-grid { grid-template-columns: 1fr; } }
.bar.warn i { background: #d97706; }
.warn-text { color: #b45309; font-weight: 600; }
.storage-box { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin-bottom: 14px; }
.storage-box .row { margin-bottom: 6px; }
.storage-line { margin-bottom: 4px; }
.badge.nocap { text-transform: none; }

/* knowledge base: build automatically */
.kb-auto { flex-basis: 100%; border-top: 1px solid var(--line); padding-top: 12px; }
.kb-auto h4 { margin: 0 0 4px; }
.kb-auto p { margin: 0 0 8px; }
.kb-auto .row { flex-wrap: wrap; gap: 8px; }
.kb-auto .row form { margin: 0; }
.kb-ai-status { font-weight: 500; overflow-wrap: anywhere; }
.kb-ai-status.running::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #f59e0b; margin-right: 6px; animation: kbpulse 1.2s infinite; }
.kb-ai-status.failed, .kb-ai-status.stopped { color: #b45309; }
.kb-auto .pre { white-space: pre-wrap; margin-top: 6px; }
@keyframes kbpulse { 50% { opacity: .3; } }

/* settings sections */
.settings-tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin: -4px 0 16px; }
.settings-tabs a { padding: 9px 14px; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.settings-tabs a:hover { color: var(--text); }
.settings-tabs a.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }
.settings-h2 { margin: 0 0 6px; font-size: 20px; }
.integ-glance h3 { margin: 0 0 6px; }
.integ-row { display: grid; grid-template-columns: 1fr auto 14px; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); color: inherit; text-decoration: none; }
.integ-row:first-of-type { border-top: 0; }
.integ-row small { display: block; }
.integ-row .integ-go { color: var(--muted); font-size: 18px; }
.integ-row.soon { opacity: .7; }
.integ-what { margin: 2px 0 0; }
@media (max-width: 600px) {
  .settings-tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .settings-tabs a { padding: 9px 10px; }
  .integ-row { grid-template-columns: 1fr 14px; }
  .integ-row .integ-status { grid-column: 1; grid-row: 2; justify-self: start; }
  .integ-row .integ-go { grid-row: 1 / span 2; grid-column: 2; }
}

/* client requests waiting */
.req-bell { display: inline-flex; align-items: center; gap: 2px; vertical-align: middle; background: #dc2626; color: #fff; border-radius: 99px; padding: 2px 7px 2px 5px; font-size: 11.5px; font-weight: 700; line-height: 1; text-decoration: none; }
.req-bell:hover { background: #b91c1c; color: #fff; }
.req-alert { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.req-alert .btn { margin-left: auto; text-decoration: none; }
p .bell, .req-alert .bell { vertical-align: -3px; }

/* inbox: knowledge base panel */
.kb-panel-head { display: flex; justify-content: space-between; align-items: center; }
.kb-panel-head h3 { margin: 0; }
.kb-panel input[type=search] { width: 100%; margin: 10px 0 4px; }
.kbp { border-top: 1px solid var(--line); padding: 8px 0; }
.kbp summary { cursor: pointer; }
.kbp-fact { display: block; width: 100%; text-align: left; background: none; border: 1px solid transparent; border-radius: 8px; padding: 6px 8px; margin: 2px 0; color: inherit; font: inherit; font-size: 13px; cursor: pointer; overflow-wrap: anywhere; }
.kbp-fact:hover { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 6%, transparent); }
.kbp-fact span { display: block; font-size: 11.5px; }
.kbp-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; padding: 4px 0 4px 8px; overflow-wrap: anywhere; }
.kbp-row > span { min-width: 0; }
.kbp-row .btn { flex-shrink: 0; }
.kbp-row.fact { padding-left: 0; }
.kbp-row.fact .kbp-fact { margin: 0; }
.kb-topic { border: 1px solid var(--brand); border-radius: 10px; padding: 8px 10px; margin: 10px 0; background: color-mix(in srgb, var(--brand) 5%, transparent); }
.kb-topic-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.kb-topic-head select { width: auto; max-width: 50%; font-size: 12.5px; padding: 3px 6px; }
.kb-more { margin: 10px 0 0; }
.ins-kbvar { display: block; width: 100%; margin-top: 6px; font-size: 12.5px; }
.kb-topic-q { width: 100%; font-size: 12.5px; padding: 5px 8px; margin: 2px 0 6px; }

/* ready-made bots */
.bot-head-actions { gap: 8px; flex-wrap: wrap; }
.lib-filters { display: grid; gap: 10px; }
.lib-filter { display: grid; grid-template-columns: 70px 1fr; gap: 8px; align-items: center; }
.lib-filter .chips { display: flex; gap: 6px; flex-wrap: wrap; }
.lib-filter .chip { border: 1px solid var(--line); background: none; color: inherit; border-radius: 99px; padding: 5px 12px; font: inherit; font-size: 13px; cursor: pointer; }
.lib-filter .chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.lib-filter .chip:disabled { opacity: .5; cursor: not-allowed; }
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 16px; }
.lib-card { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.lib-card-head { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.lib-card-head h3 { margin: 0; font-size: 16px; }
.lib-card p { margin: 0; }
.lib-badges { display: flex; gap: 4px; flex-wrap: wrap; }
.lib-card .row-end { margin-top: auto; padding-top: 8px; }
.lib-card ol { margin: 6px 0 0; padding-left: 18px; }
@media (max-width: 600px) { .lib-filter { grid-template-columns: 1fr; gap: 4px; } }

/* inbox: buttons and list menus as the customer sees them */
.wa-btns { display: grid; margin: 4px -9px -4px; border-top: 1px solid rgba(127, 127, 127, .25); }
.wa-btn { display: block; text-align: center; color: #53bdeb; font-weight: 500; padding: 8px 6px; font-size: 14px; }
.wa-btns .wa-btn + .wa-btn { border-top: 1px solid rgba(127, 127, 127, .25); }
.wa-list { margin: 4px -9px -4px; border-top: 1px solid rgba(127, 127, 127, .25); }
.wa-list summary { list-style: none; cursor: pointer; }
.wa-list summary::-webkit-details-marker { display: none; }
.wa-list-row { padding: 6px 12px; border-top: 1px solid rgba(127, 127, 127, .15); font-size: 13.5px; }
.wa-list-row small { display: block; color: var(--muted); }

/* bots: AI understanding */
.bot-ai { display: flex; gap: 16px; justify-content: space-between; align-items: center; flex-wrap: wrap; }
.bot-ai > div { flex: 1; min-width: min(100%, 320px); }
.bot-ai h3 { margin: 0 0 4px; }
.bot-ai p { margin: 0 0 4px; }
.bot-ai.on { border-color: var(--brand); }

/* bots: create by chatting */
.bot-create h3 { margin: 0 0 4px; }
.bot-create textarea { width: 100%; margin: 6px 0; }
.bot-create-ideas { display: flex; gap: 6px; flex-wrap: wrap; }
.bot-create-ideas .chip { border: 1px solid var(--line); background: none; color: inherit; cursor: pointer; font: inherit; font-size: 12.5px; padding: 4px 10px; text-align: left; }
.fbm.ai { white-space: pre-wrap; }

/* inbox: who replies in this chat */
.chat-mode.ai { border-color: var(--brand); color: var(--brand); }
.chat-mode.human { border-color: #d97706; color: #b45309; }
.bot-rules { flex-basis: 100%; border-top: 1px solid var(--line); padding-top: 10px; display: grid; gap: 8px; }
.bot-rules label { margin: 0; }
.bot-rules .num-sm { width: 70px; display: inline-block; margin: 0 4px; }

/* file preview on hover (tap on phones) */
.peek { cursor: zoom-in; text-decoration: underline dotted; text-underline-offset: 3px; }
.file-peek { position: fixed; z-index: 60; width: 260px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 6px; box-shadow: 0 10px 30px rgba(0, 0, 0, .3); pointer-events: none; max-height: 380px; }
.file-peek img { display: block; max-width: 100%; max-height: 306px; margin: 0 auto; border-radius: 6px; }
.peek-pdf img { display: block; max-width: 100%; max-height: 330px; margin: 0 auto; border-radius: 4px; background: #fff; }
.peek-pdf { min-height: 40px; display: flex; align-items: center; justify-content: center; }
.file-peek a { pointer-events: auto; display: block; padding: 6px 4px 2px; text-align: center; }
@media (hover: none) { .file-peek { pointer-events: auto; } }

/* chats waiting for a person */
.pill.needs { background: #d97706; }
.needs-tab .pill { margin-left: 4px; }
.needs-badge { font-size: 11px; font-weight: 600; color: #fff; background: #d97706; border-radius: 99px; padding: 1px 7px; white-space: nowrap; }
.msg.system { justify-content: center; }
.msg.system span { font-size: 12px; color: var(--muted); background: var(--soft); border: 1px solid var(--line); border-radius: 99px; padding: 3px 12px; text-align: center; max-width: 90%; }
.toast-stack { position: fixed; right: 16px; bottom: 16px; z-index: 80; display: grid; gap: 8px; max-width: min(360px, calc(100vw - 32px)); }
.toast { display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; background: var(--card); color: var(--text); border: 1px solid #d97706; border-left: 4px solid #d97706; border-radius: 10px; padding: 10px 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, .3); font-size: 14px; text-decoration: none; animation: toastin .2s ease-out; }
.toast button { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 13px; padding: 0 2px; }
@keyframes toastin { from { transform: translateY(10px); opacity: 0; } }
@media (max-width: 760px) { .toast-stack { bottom: 72px; right: 12px; left: 12px; max-width: none; } }

/* admin: a client's AI */
.ai-admin h3 { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ai-admin h4 { margin: 14px 0 6px; }
.ai-usage { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin-bottom: 8px; }
.ai-usage > div { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; display: grid; }
.ai-usage b { font-size: 20px; }
.ai-admin-form { border-top: 1px solid var(--line); margin-top: 12px; display: grid; gap: 6px; }
.ai-admin-form > .btn { justify-self: start; margin-top: 6px; }
.ai-admin-form .chk span { display: inline; }
.ai-cell a { color: inherit; text-decoration: none; }

/* billing */
.bill-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 16px; margin-bottom: 16px; }
.bill-cards .card { margin: 0; display: grid; gap: 3px; align-content: start; }
.bill-cards .big, .statement .big { font-size: 22px; }
.bill-due { border-color: #d97706; }
.bill-lines .num { width: 30%; }
.bill-total td { border-top: 2px solid var(--line); }
.statement-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.statement-head .right { text-align: right; }
@media print {
  .sidebar, .bottom-nav, .no-print, .topbar, .toast-stack, .impersonate { display: none !important; }
  body, .main, .card { background: #fff !important; color: #000 !important; box-shadow: none !important; }
  .statement { border: 0; }
}
.invoice-form { border-top: 1px solid var(--line); margin-top: 12px; display: grid; gap: 6px; }
.ai-guide td.small { color: var(--muted); }
.integ-models { margin: 12px 0 4px; }

/* AI credit at the bottom of the side menu */
.ai-credit { display: grid; gap: 2px; margin: 8px 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; color: inherit; text-decoration: none; font-size: 12.5px; }
.ai-credit:hover { border-color: var(--brand); }
.ai-credit b { font-size: 15px; }
.ai-credit small { color: var(--muted); }
.ai-credit .bar { display: block; height: 5px; margin: 3px 0 1px; }
.ai-credit.low { border-color: #d97706; }
.ai-credit.low b { color: #b45309; }

/* Settings → Integrations: AI replies on/off */
.ai-replies { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 10px 0; }
.ai-replies > div { display: grid; gap: 2px; flex: 1; min-width: min(100%, 260px); }
.ai-replies.on { border-color: var(--brand); }
.ai-replies.off { border-color: #d97706; }

/* Website chat settings */
.linklike { background: none; border: 0; padding: 0; color: var(--primary, #16a34a); text-decoration: underline; cursor: pointer; font: inherit; }
.webchat-form input[type=color] { height: 38px; padding: 2px; width: 90px; }
.webchat-form .switch { margin-bottom: 12px; }
.web-tag { color: #0f766e; }
.reply-via { width: auto; flex: none; align-self: center; padding: 6px 4px; font-size: 13px; }

/* Inbox: contact in the Info panel, unsaved and blocked bars */
.info-head { display: flex; justify-content: space-between; align-items: center; }
.info-head h3 { margin: 0; }
.cform { display: flex; flex-direction: column; gap: 2px; margin: 10px 0 14px; }
.cform label { margin-bottom: 8px; }
.tag-pick { margin-bottom: 10px; }
.tag-pick .lbl { display: block; font-weight: 500; font-size: 13px; margin-bottom: 6px; }
.tag-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.tag-chip { border: 1px solid var(--border, #d5d9dd); background: transparent; color: inherit; border-radius: 999px; padding: 3px 10px; font-size: 12.5px; cursor: pointer; }
.tag-chip.on { background: var(--brand, #16a34a); border-color: var(--brand, #16a34a); color: #fff; }
.tag-chip.on::before { content: '✓ '; }
.tag-new { display: flex; gap: 6px; }
.tag-new input { flex: 1; min-width: 0; }
.cform-unsaved { background: #fff4e5; color: #7a4a00; border-radius: 8px; padding: 8px 10px; font-size: 13px; margin-bottom: 8px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: space-between; }
.cform-unsaved.flash { animation: cflash 0.5s 2; }
@keyframes cflash { 50% { box-shadow: 0 0 0 3px #f59e0b; } }
.chat-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; padding: 8px 14px; font-size: 13.5px; border-bottom: 1px solid var(--border, #e5e7eb); }
.chat-bar.unsaved { background: rgba(22, 163, 74, 0.08); }
.chat-bar.blocked { background: rgba(192, 38, 45, 0.1); }
.btn.danger { color: #c0262d; }
.err { color: #c0262d; }
.cform-unsaved .btn.ghost { color: #7a4a00; border-color: #e3b46b; }

/* Admin → a client: header icons, sections, product boxes, side panels (Notifications, Requests, Resolve) */
.client-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 18px; }
.client-head h1 { margin: 2px 0 6px; }
.client-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.client-icons { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.client-icons form { margin: 0; }
.icon-btn { position: relative; display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); color: inherit; font: inherit; font-size: 13.5px; cursor: pointer; }
.icon-btn:hover { border-color: var(--brand); }
.icon-btn .pill { position: static; background: #f59e0b; color: #fff; border-radius: 999px; padding: 0 7px; font-size: 11.5px; font-style: normal; line-height: 18px; }
.icon-btn.red .pill { background: #dc2626; }
.client-section { margin-bottom: 26px; scroll-margin-top: 16px; }
.client-section > h2 { font-size: 18px; margin: 0 0 8px; }
.client-section > .card, .client-section details.card { margin-bottom: 12px; }
.client-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.client-facts span { display: block; font-size: 12px; color: var(--muted); }
.client-facts b { display: block; overflow-wrap: anywhere; }
.client-form h3 { margin: 18px 0 8px; font-size: 15px; }
details.card > summary { cursor: pointer; font-weight: 600; }
details.card[open] > summary { margin-bottom: 10px; }
.prod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.prod-box { margin: 0; display: flex; flex-direction: column; gap: 8px; }
.prod-box.off { opacity: .85; background: var(--soft, #f9fafb); }
.prod-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.prod-head h3 { margin: 0; font-size: 15px; }
.prod-ctl form { margin: 0; }
.prod-ctl .inline { display: inline; }
.prod-set { display: block; margin-top: 4px; }
.prod-lines { list-style: none; padding: 0; margin: 0; font-size: 13px; display: flex; flex-direction: column; gap: 4px; }
.bill-grid { align-items: start; }
.bill-grid .card { margin: 0; }
.invoice-add > summary { list-style: none; margin-top: 8px; }
.drawer-shade { position: fixed; inset: 0; background: rgba(0, 0, 0, .3); z-index: 60; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(420px, 100vw); background: var(--card); z-index: 61; overflow-y: auto; padding: 16px 18px 28px; box-shadow: -8px 0 24px rgba(0, 0, 0, .15); }
.drawer.wide { width: min(560px, 100vw); }
.drawer[hidden], .drawer-shade[hidden] { display: none; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.drawer-head h3 { margin: 0; }
.drawer-close { background: none; border: 0; font-size: 18px; cursor: pointer; color: inherit; padding: 4px 8px; }
.drawer-item { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; }
.alert-link { display: block; text-decoration: none; color: inherit; margin-bottom: 8px; }
.ticket-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; text-decoration: none; color: inherit; }
.ticket-row span:first-child { display: flex; flex-direction: column; min-width: 0; }
.ticket-row.unread { border-left: 3px solid #f59e0b; }
.ticket-top { display: flex; justify-content: space-between; gap: 10px; margin: 10px 0; }
.ticket-thread { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.tmsg { max-width: 88%; display: flex; flex-direction: column; gap: 3px; }
.tmsg-body { padding: 8px 12px; border-radius: 12px; background: var(--soft, #f3f4f6); overflow-wrap: anywhere; font-size: 14px; }
.tmsg.nezler { align-self: flex-end; text-align: right; }
.tmsg.nezler .tmsg-body { background: rgba(234, 88, 12, .12); text-align: left; }
.tmsg.internal .tmsg-body { background: #fef9c3; color: #713f12; border: 1px dashed #eab308; }
.ticket-reply textarea, .ticket-new textarea { width: 100%; }
.ticket-reply .row-end { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 6px; }
.ticket-reply .row-end .chk { margin: 0 auto 0 0; }
.ticket-new { margin-top: 12px; }
.ticket-new > summary { list-style: none; }
.ticket-new form { margin-top: 10px; }
/* client side: Help & support */
.support-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.tmsg.client.mine, .support-thread .tmsg.client { align-self: flex-end; text-align: right; }
.support-thread .tmsg.client .tmsg-body { background: rgba(22, 163, 74, .12); text-align: left; }
.support-thread .tmsg.nezler { align-self: flex-start; text-align: left; }
@media (max-width: 760px) {
  .client-head { align-items: flex-start; }
  .icon-btn span { display: none; }
  .support-layout { grid-template-columns: 1fr; }
  .prod-grid { grid-template-columns: 1fr; }
}
.prod-icon { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 32px; height: 32px; border-radius: 8px; background: color-mix(in srgb, var(--brand) 12%, transparent); color: var(--brand); margin-right: 10px; vertical-align: middle; }
.prod-box.off .prod-icon { background: var(--soft, #f3f4f6); color: var(--muted); }
.client-section > h2 { display: flex; align-items: center; }
.prod-head h3 { display: flex; align-items: center; }
fieldset.plain { border: 0; padding: 0; margin: 0; min-width: 0; }
/* Admin → Nezler team */
.staff-card { margin-bottom: 10px; }
.staff-top { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.staff-areas { margin: 8px 0; }
.staff-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.staff-actions form { margin: 0; }
.staff-access { margin-top: 10px; }
.staff-access summary { cursor: pointer; font-weight: 600; font-size: 14px; }
.staff-access form { margin-top: 10px; }
.roles-table th, .roles-table td { vertical-align: middle; }
.roles-table td.center, .roles-table th.center { text-align: center; }
.role-name { width: 110px; text-align: center; padding: 4px 6px; font-weight: 600; }
.roles-foot { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; justify-content: space-between; margin-top: 12px; }
.roles-foot label { margin: 0; flex: 1; min-width: 200px; max-width: 320px; }
/* Knowledge base: where a page sits (Company → Brand → levels) */
.kb-where h3 { margin: 0 0 10px; }
.kb-where-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 10px; }
.kb-where .chk { margin-top: 6px; }
.levels-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 18px; margin-bottom: 12px; }
.levels-ind h3 { margin: 0 0 2px; }
/* Team only details: the team sees them; customers, the AI and bots never do */
.kb-team { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .02em; border-radius: 99px; padding: 1px 8px; background: #fef3c7; color: #92400e; white-space: nowrap; }
.kbp-fact.team { cursor: default; }
/* Knowledge base: company row, brand cards, Add a brand window, brand page */
.kb-company { display: grid; grid-template-columns: 44px minmax(0, 1fr) 120px; gap: 12px; align-items: center; text-decoration: none; color: inherit; margin-bottom: 18px; }
.kb-company:hover, .kb-brand:hover { border-color: var(--brand); }
.kb-company-text b { display: block; font-size: 16px; }
.kb-company-pct { display: grid; gap: 2px; justify-items: end; }
.kb-company-pct .bar { width: 100%; }
.kb-logo { width: 40px; height: 40px; border-radius: 10px; display: inline-grid; place-items: center; flex: none; font-weight: 700; font-size: 14px; color: #fff; background: #334155 center / cover no-repeat; }
.kb-logo.own { background-color: #16a34a; } .kb-logo.sub { background-color: #7c3aed; } .kb-logo.represented { background-color: #1d4ed8; }
.kb-logo.big { width: 56px; height: 56px; font-size: 18px; border-radius: 12px; }
.kb-brands { margin-bottom: 20px; }
.kb-brands-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.kb-brands-head h2 { margin: 0; font-size: 18px; }
.kb-pick select { width: auto; }
.kb-brand-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr)); gap: 12px; }
.kb-brand { display: grid; gap: 8px; align-content: start; margin: 0; text-decoration: none; color: inherit; }
.kb-brand.picked { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.kb-brand-top { display: flex; gap: 10px; align-items: center; min-width: 0; }
.kb-brand-top b { overflow-wrap: anywhere; }
.kb-brand.add { border-style: dashed; color: var(--brand); font: inherit; font-weight: 700; cursor: pointer; place-content: center; text-align: center; min-height: 120px; background: transparent; }
.kb-kind { justify-self: start; font-size: 11.5px; font-weight: 700; border-radius: 99px; padding: 2px 9px; }
.kb-kind.own { background: rgba(22, 163, 74, .12); color: #15803d; } .kb-kind.sub { background: rgba(124, 58, 237, .12); color: #6d28d9; }
.kb-kind.rep { background: rgba(29, 78, 216, .12); color: #1d4ed8; } .kb-kind.same { background: transparent; color: var(--muted); border: 1px dashed var(--muted); }
.kb-picked { margin-bottom: 12px; }
.kb-dialog { border: 1px solid var(--line); border-radius: 14px; padding: 0; width: min(560px, calc(100vw - 24px)); background: var(--card); color: inherit; }
.kb-dialog::backdrop { background: rgba(0, 0, 0, .35); }
.kb-dialog form { padding: 18px 20px; display: grid; gap: 12px; }
.kb-dialog-head { display: flex; justify-content: space-between; align-items: center; }
.kb-dialog-head h2 { margin: 0; font-size: 20px; }
.kb-dialog-x { background: none; border: 0; font-size: 18px; cursor: pointer; color: inherit; }
.kb-choices { border: 0; padding: 0; margin: 0; display: grid; gap: 6px; }
.kb-choices legend { font-weight: 600; font-size: 13px; margin-bottom: 6px; }
.kb-choice { display: grid; grid-template-columns: 18px 1fr; gap: 10px; align-items: start; border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; cursor: pointer; margin: 0; }
.kb-choice:has(input:checked) { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 8%, transparent); }
.kb-choice input { margin-top: 3px; }
.kb-choice small { display: block; color: var(--muted); }
.kb-dialog-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.kb-brand-head { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 14px; align-items: center; margin-bottom: 14px; }
.kb-brand-head h1 { margin: 2px 0 6px; }
@media (max-width: 600px) { .kb-brand-head { grid-template-columns: 56px minmax(0, 1fr); } .kb-brand-head > .row { grid-column: 1 / -1; } .kb-company { grid-template-columns: 44px minmax(0, 1fr); } .kb-company-pct { display: none; } }
.kb-brand-tabs { margin-bottom: 12px; }
.kb-about { display: grid; gap: 0; }
.kb-about-row { display: grid; grid-template-columns: minmax(120px, 220px) minmax(0, 1fr); gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); }
.kb-about-row:first-child { border-top: 0; }
@media (max-width: 560px) { .kb-about-row { grid-template-columns: 1fr; gap: 2px; } }
.kb-tab-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
/* Settings: who each number speaks for */
.speaks-row { display: grid; grid-template-columns: minmax(140px, 220px) minmax(0, 1fr); gap: 6px 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.speaks-row:first-of-type { border-top: 0; }
.speaks-row select { width: 100%; }
.speaks-row .chk { grid-column: 2; margin: 0; }
@media (max-width: 560px) { .speaks-row { grid-template-columns: 1fr; } .speaks-row .chk { grid-column: 1; } }
.kb-chats { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.kb-chats > span { display: grid; gap: 2px; min-width: 0; flex: 1 1 280px; }
.kb-chats.off { border-color: #f59e0b; }
.kb-chats form { margin: 0; }
.kb-chats button.switch { background: none; border: 0; padding: 0; font: inherit; color: inherit; }
/* "Use in chats" switches beside each kind and page */
.kb-chat-switch { display: inline-flex; margin: 0; }
.kb-chat-switch button.switch { background: none; border: 0; padding: 0; font: inherit; font-size: 12.5px; color: var(--muted); cursor: pointer; }
.kb-chat-switch button.switch.dim span { opacity: .45; }
.kb-card-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.kb-card-head h3 { margin-right: auto; }
.kb-nochat { display: inline-block; font-size: 11px; font-weight: 700; border-radius: 99px; padding: 1px 8px; background: rgba(245, 158, 11, .15); color: #b45309; white-space: nowrap; }
.kb-section-title { margin: 0 0 10px; font-size: 18px; }
.kb-company, .kb-company *, .kb-brand, .kb-brand * { text-decoration: none !important; }
/* Knowledge base: Start here */
.kb-start { margin-bottom: 16px; border-color: var(--brand); }
.kb-start > summary { cursor: pointer; display: grid; gap: 2px; list-style: none; }
.kb-start > summary b { font-size: 16px; }
.kb-start[open] > summary { margin-bottom: 12px; }
.kb-start-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.kb-start-tabs button { border: 1px solid var(--line); background: transparent; color: inherit; border-radius: 99px; padding: 6px 14px; font: inherit; font-weight: 600; cursor: pointer; }
.kb-start-tabs button.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.kb-start-pane { display: grid; gap: 8px; max-width: 720px; }
.kb-start-pane button { justify-self: start; }
.kb-start-added { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; }
.kb-start-added h4 { margin: 0 0 6px; display: flex; gap: 10px; align-items: baseline; }
.kb-start-added ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 14px; }
.kb-start-build { margin-top: 14px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 12px; }
.kb-start-build form { margin: 0; }
.btn.big { padding: 10px 18px; font-size: 15px; }
/* two-step delete confirmation */
.del-dialog { max-width: min(460px, calc(100vw - 24px)); }
.del-dialog h3 { margin: 0 0 8px; }
.del-dialog .del-step2 { margin: 10px 0; }
.del-dialog .del-extra { margin: 6px 0; }
.btn.danger-fill { background: #dc2626; border-color: #dc2626; color: #fff; }
.btn.danger-fill:disabled { opacity: .45; cursor: not-allowed; }
/* Choose what to build from */
.kb-choose-group { display: grid; gap: 4px; margin-bottom: 12px; }
.kb-choose-head { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; margin-bottom: 6px; }
.kb-choose-head .row { margin-left: auto; }
.kb-choose-row { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 10px; align-items: start; padding: 6px 4px; border-top: 1px solid var(--line); margin: 0; cursor: pointer; }
.kb-choose-row span { display: grid; min-width: 0; overflow-wrap: anywhere; }
.kb-choose-row.bad { opacity: .6; }
.kb-choose-foot { position: sticky; bottom: 8px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: flex-end; box-shadow: 0 6px 20px rgba(0, 0, 0, .15); }
.kb-choose-foot > span:first-child { margin-right: auto; }
/* Start here: the five steps */
.kb-guide { list-style: none; margin: 0 0 12px; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; counter-reset: s; }
.kb-guide li { display: flex; gap: 8px; align-items: center; padding: 8px; border-radius: 10px; background: var(--soft, rgba(127, 127, 127, .08)); min-width: 0; }
.kb-guide li span:last-child { display: grid; min-width: 0; }
.kb-guide li small { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.kb-step-n { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; flex: none; border: 2px solid var(--line); font-size: 13px; }
.kb-guide li.done .kb-step-n { background: var(--brand); border-color: var(--brand); color: #fff; }
.kb-guide li.now { outline: 2px solid var(--brand); }
.kb-guide li.now .kb-step-n { border-color: var(--brand); color: var(--brand); }
.kb-guide li.todo { opacity: .6; }
@media (max-width: 720px) { .kb-guide { grid-template-columns: 1fr; } }
.kb-next { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; padding: 10px 12px; border-radius: 10px; background: color-mix(in srgb, var(--brand) 10%, transparent); margin-bottom: 12px; }
/* From your website: logo and colours */
.kb-look { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 14px; }
.kb-look-logo { width: 56px; height: 56px; object-fit: contain; border-radius: 10px; background: #fff; padding: 4px; border: 1px solid var(--line); }
.kb-look-logo.on-dark { background: #1f2937; }
.kb-look-text { display: grid; gap: 4px; flex: 1 1 240px; min-width: 0; }
.kb-look-colors { display: flex; gap: 6px; flex-wrap: wrap; }
.kb-look-colors form { margin: 0; }
.kb-swatch { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--line); cursor: pointer; padding: 0; }
@media (max-width: 720px) { .kb-guide li { padding: 6px 8px; } }

/* ---------- Build my knowledge base (kb/build): four steps on one screen ---------- */
.kbb-i { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; vertical-align: -3px; }
.kbb-steps { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 16px; }
.kbb-steps a { display: flex; align-items: center; gap: 8px; padding: 6px 14px 6px 6px; border-radius: 99px; border: 1px solid var(--line); background: var(--card); color: var(--muted); text-decoration: none; font-weight: 600; font-size: 13px; }
.kbb-steps a b { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--soft); color: var(--muted); font-size: 12px; }
.kbb-steps a.done b { background: var(--brand); color: #fff; }
.kbb-steps a.now { border-color: var(--brand); color: var(--text); }
.kbb-steps a.now b { background: var(--brand); color: #fff; }
.kbb-card { display: grid; gap: 12px; }
.kbb-h { font-size: 18px; margin: 0; }
.kbb-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.kbb-row > input, .kbb-row > textarea { flex: 1 1 200px; min-width: 0; width: auto; }
.kbb-row.spread { justify-content: space-between; }
.kbb-row .btn { display: inline-flex; gap: 6px; align-items: center; }
.kbb-drop label { border: 1.5px dashed var(--line); border-radius: 10px; padding: 18px; display: grid; gap: 6px; justify-items: center; text-align: center; cursor: pointer; }
.kbb-drop.over label { border-color: var(--brand); background: var(--soft); }
.kbb-drop-kinds { display: flex; gap: 16px; font-weight: 600; }
.kbb-drop-kinds span { display: flex; gap: 6px; align-items: center; }
.kbb-list { display: grid; gap: 6px; }
.kbb-item, .kbb-pickrow { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; min-width: 0; }
.kbb-t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn.big { padding: 12px 18px; font-size: 14px; }
.kbb-next { justify-self: start; }
.kbb-group { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.kbb-group summary { display: flex; align-items: center; gap: 8px; padding: 10px 12px; background: var(--soft); cursor: pointer; flex-wrap: wrap; }
.kbb-group .kbb-pickrow { border: 0; border-top: 1px solid var(--line); border-radius: 0; cursor: pointer; }
.kbb-pickrow input { width: auto; margin: 0; }
.kbb-meter { height: 8px; border-radius: 5px; background: var(--soft); overflow: hidden; }
.kbb-meter i { display: block; height: 100%; background: var(--brand); border-radius: 5px; transition: width .4s; }
.kbb-log { display: grid; gap: 6px; font-size: 13px; max-height: 340px; overflow-y: auto; }
.kbb-log div { display: flex; gap: 8px; align-items: flex-start; }
.kbb-log .kbb-i { color: var(--brand); margin-top: 2px; }
.kbb-note { display: flex; gap: 10px; align-items: flex-start; background: var(--soft); border-radius: 10px; padding: 12px; }
.kbb-split { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 900px) { .kbb-split { grid-template-columns: 1fr; } }
.kbb-tree { display: grid; gap: 2px; }
.kbb-node { display: flex; gap: 8px; align-items: center; padding: 7px 8px; border-radius: 6px; color: var(--text); text-decoration: none; min-width: 0; }
.kbb-node:hover { background: var(--soft); }
.kbb-node.d0 { font-weight: 600; }
.kbb-node.d1 { padding-left: 22px; font-weight: 600; }
.kbb-node.d2 { padding-left: 46px; }
.kbb-node.d3 { padding-left: 64px; font-size: 13px; }
.kbb-health { display: grid; gap: 6px; font-size: 13px; }
.kbb-health div { display: flex; gap: 8px; align-items: flex-start; padding: 8px 10px; border-radius: 8px; background: var(--soft); }
.kbb-health .bad { background: #fef2f2; color: #991b1b; }
.kbb-health .warn .kbb-i { color: #b45309; }
.kbb-health .ok .kbb-i { color: var(--brand); }
.kbb-ask label { display: grid; gap: 6px; font-size: 13.5px; }
.kbb-ask { padding: 10px; border: 1px solid var(--line); border-radius: 8px; }
.kbb-publish { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; border-top: 1px solid var(--line); padding-top: 14px; }
.kbb-test { position: sticky; top: 12px; }
.kbb-chat { background: var(--chat-bg); border-radius: 10px; padding: 12px; display: grid; gap: 8px; align-content: start; min-height: 260px; max-height: 460px; overflow-y: auto; }
.kbb-msg { max-width: 88%; padding: 8px 10px; border-radius: 8px; font-size: 13.5px; line-height: 1.45; box-shadow: 0 1px 0 rgba(0,0,0,.08); }
.kbb-msg.in { background: var(--in); justify-self: start; }
.kbb-msg.out { background: var(--out); justify-self: end; }
.kbb-msg.none { color: var(--muted); }
.kbb-msg.typing { color: var(--muted); }
.kbb-msg.meta { background: none; box-shadow: none; padding: 0 4px; font-size: 11.5px; color: var(--muted); max-width: 100%; }
.kbb-msg.meta a { color: inherit; }
.kbb-file { margin-top: 6px; font-size: 12px; color: var(--muted); }
.kbb-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.kbb-chip { border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: 99px; padding: 4px 10px; font-size: 12.5px; cursor: pointer; }
.kbb-chip:hover { border-color: var(--brand); }
@media (prefers-color-scheme: dark) { .kbb-health .bad { background: #2e1919; color: #f08a8a; } }
.kb-start-head { display: flex; gap: 14px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.kb-start-head > span { display: grid; gap: 4px; flex: 1 1 320px; min-width: 0; }
.kb-start-steps { list-style: none; padding: 0; margin: 14px 0 0; }
.kb-start-steps li a { display: flex; align-items: center; gap: 8px; padding: 6px 14px 6px 6px; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); text-decoration: none; font-weight: 600; font-size: 13px; }
.kb-start-steps li b { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--soft); font-size: 12px; }
.kb-start-steps li.done b, .kb-start-steps li.now b { background: var(--brand); color: #fff; }
.kb-start-steps li.now a { border-color: var(--brand); color: var(--text); }

/* ---------- Admin → AI prompts and training ---------- */
.prompt-toc { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.prompt-toc a { text-decoration: none; font-weight: 600; }
.prompt-group { font-size: 17px; margin: 22px 0 10px; }
.prompt-card { display: grid; gap: 10px; }
.prompt-card textarea { font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; width: 100%; }
.prompt-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: flex-start; }
.prompt-head > span { display: grid; gap: 4px; min-width: 0; }
.prompt-actions { display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap; }
.prompt-versions { flex: 1 1 100%; }
.prompt-version { border-top: 1px solid var(--line); padding: 8px 0; display: grid; gap: 4px; }
.prompt-card pre, .prompt-sample pre { white-space: pre-wrap; word-break: break-word; background: var(--soft); padding: 10px; border-radius: 8px; font-size: 12.5px; max-height: 420px; overflow: auto; margin: 0; }
.prompt-sample h4 { margin: 12px 0 6px; }

/* Back from a knowledge base page lands on the row it was opened from */
[id^="p"]:target { scroll-margin-top: 90px; animation: kb-here 2.4s ease-out; }
@keyframes kb-here { from { box-shadow: 0 0 0 3px var(--brand); } to { box-shadow: 0 0 0 3px transparent; } }

/* A website chat started from the client's own test page */
.test-badge { display: inline-block; font-size: 10.5px; font-weight: 600; padding: 1px 6px; border-radius: 9px; background: var(--soft); color: var(--muted); border: 1px solid var(--line); vertical-align: 1px; }

/* Build step 1: numbered websites, the loader while they're read */
.kbb-sites { display: grid; gap: 8px; margin-bottom: 14px; }
.kbb-sub { display: flex; gap: 6px; align-items: center; margin: 4px 0 0; font-size: 15px; }
.kbb-sitelist { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.kbb-sitelist li { display: flex; gap: 8px; align-items: center; }
.kbb-sitelist input { flex: 1; min-width: 0; }
.kbb-no { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 12.5px; font-weight: 700; background: var(--soft); color: var(--muted); }
.kbb-row.wrap { flex-wrap: wrap; justify-content: space-between; }
.kbb-loading { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; padding: 10px 12px; border-radius: 8px; background: var(--soft); }
.kbb-loading small { flex-basis: 100%; padding-left: 28px; }
.kbb-spin { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid var(--line); border-top-color: var(--brand); animation: kbb-spin .8s linear infinite; flex: none; }
@keyframes kbb-spin { to { transform: rotate(360deg); } }
.kbb-sitesprog { display: grid; gap: 6px; margin-bottom: 14px; }
.kbb-siteline { display: flex; justify-content: space-between; gap: 10px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 13.5px; }
.kbb-siteline span { color: var(--muted); text-align: right; }
.kbb-siteline.err span { color: var(--danger); }

/* Knowledge base page: built and not tested yet */
.kb-ready { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; border-color: var(--brand); background: color-mix(in srgb, var(--brand) 8%, var(--card)); }
.kb-ready span { display: grid; gap: 2px; min-width: 0; }

/* Build step 4: the whole knowledge base as a table, Company → brands → projects → units */
.kbb-kbcard { margin-bottom: 18px; }
.kbb-kbhead { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; margin-bottom: 10px; }
.kbb-kbhead .kbb-h { margin: 0; }
.kbb-kbtools { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.kbb-tablewrap { overflow-x: auto; margin: 0 -4px; }
.kbb-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.kbb-table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.kbb-table td { padding: 5px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.kbb-table tr:last-child td { border-bottom: 0; }
.kbb-table tr:hover td { background: var(--soft); }
.kbb-table th.kbb-pub, .kbb-table td.kbb-pub { text-align: right; white-space: nowrap; }
.kbb-table th.kbb-pub .switch { justify-content: flex-end; text-transform: none; letter-spacing: 0; font-size: 12.5px; color: var(--text); }
.kbb-kind { color: var(--muted); white-space: nowrap; }
.kbb-tn { display: flex; gap: 8px; align-items: center; color: var(--text); text-decoration: none; position: relative; min-width: 0; padding: 3px 0; }
.kbb-tn:hover .kbb-t { text-decoration: underline; }
.kbb-tr.d0 .kbb-tn, .kbb-tr.d1 .kbb-tn { font-weight: 600; }
/* branch lines: each level steps in, with an elbow from the page above */
.kbb-tr.d1 .kbb-tn { margin-left: 22px; } .kbb-tr.d2 .kbb-tn { margin-left: 44px; } .kbb-tr.d3 .kbb-tn { margin-left: 66px; } .kbb-tr.d4 .kbb-tn { margin-left: 88px; }
.kbb-tr:not(.d0) .kbb-tn::before { content: ""; position: absolute; left: -15px; top: -12px; width: 11px; height: calc(50% + 12px); border-left: 1.5px solid var(--line); border-bottom: 1.5px solid var(--line); border-bottom-left-radius: 5px; }
.kbb-tr:not(.d0) .kbb-tn::after { content: ""; position: absolute; left: -6px; top: 50%; margin-top: -3.5px; border: 3.5px solid transparent; border-left-color: var(--muted); border-right: 0; }
.kbb-missbtn { display: inline-flex; gap: 6px; align-items: center; max-width: 340px; padding: 3px 10px; border-radius: 99px; border: 1px solid color-mix(in srgb, var(--warn, #d97706) 45%, transparent); color: var(--warn, #b45309); background: color-mix(in srgb, var(--warn, #d97706) 9%, transparent); text-decoration: none; font-size: 12.5px; white-space: nowrap; overflow: hidden; }
.kbb-missbtn span { color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.kbb-missbtn em { font-style: normal; }
.kbb-missbtn:hover { text-decoration: none; border-color: var(--warn, #d97706); }
.kbb-missbtn .kbb-i { width: 14px; height: 14px; flex: none; }
.kbb-ok { display: inline-flex; gap: 6px; align-items: center; color: var(--brand); font-size: 13px; }
.kbb-ok .kbb-i { width: 15px; height: 15px; }
.kbb-gate { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; justify-content: space-between; margin-top: 12px; padding: 10px 12px; border-radius: 8px; background: var(--soft); font-size: 13.5px; }
.kbb-gate form { margin: 0; }
.kbb-below { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; margin-bottom: 18px; align-items: start; }
.kbb-test .kbb-chat { max-height: 520px; }
.kbb-msg.media { padding: 4px; background: transparent; box-shadow: none; }
.kbb-msg.media img { display: block; max-width: 240px; max-height: 200px; border-radius: 10px; object-fit: cover; }
.kbb-doc { display: flex; gap: 10px; align-items: center; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--text); text-decoration: none; max-width: 300px; }
.kbb-doc small { display: block; color: var(--muted); font-size: 11.5px; }
.kbb-docic { flex: none; width: 36px; height: 42px; border-radius: 6px; display: grid; place-items: center; font-size: 10.5px; font-weight: 700; color: #fff; background: #dc2626; }
.kbb-doc .kbb-docic:not(:empty) + span { min-width: 0; overflow-wrap: anywhere; }
.kbb-checkbot { display: grid; gap: 8px; margin: 12px 0; }
@media (max-width: 700px) {
  .kbb-kind, .kbb-table th:nth-child(3), .kbb-status { display: none; }
  .kbb-table th { font-size: 11px; }
  .kbb-tn { align-items: flex-start; }
  .kbb-tn .badge.blue, .kbb-missbtn em { display: none; }
  .kbb-tn .kbb-t { white-space: normal; overflow: visible; }
  .kbb-missbtn { padding: 2px 8px; }
  .kbb-table th.kbb-pub .switch b, td.kbb-pub small { display: none; }
  .kbb-table td, .kbb-table th { padding-left: 5px; padding-right: 5px; }
  .kbb-missbtn span { display: none; }
  .kbb-tr.d1 .kbb-tn { margin-left: 16px; } .kbb-tr.d2 .kbb-tn { margin-left: 30px; } .kbb-tr.d3 .kbb-tn { margin-left: 44px; } .kbb-tr.d4 .kbb-tn { margin-left: 58px; }
  .kbb-tr:not(.d0) .kbb-tn::before { left: -12px; width: 8px; }
}

/* Page editor: important details still empty */
.kb-missbar { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; padding: 10px 14px; margin-bottom: 12px; border-radius: 10px; border: 1px solid color-mix(in srgb, #d97706 45%, transparent); background: color-mix(in srgb, #d97706 9%, var(--card)); font-size: 13.5px; }
.kb-misstag { display: inline-block; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 1px 6px; border-radius: 99px; background: #d97706; color: #fff; vertical-align: 1px; }
.kb-field.is-missing { border-left: 3px solid #d97706; padding-left: 9px; }
.kb-group.kb-nomiss { display: none; }

/* Website chat in the side menu, with its on/off switch */
.nav-has-switch .nav-switch { margin-left: auto; display: inline-flex; }
.switch.sm span { width: 30px; height: 18px; }
.switch.sm span::after { width: 12px; height: 12px; }
.switch.sm input:checked + span::after { left: 15px; }
.page-head .switch b { font-size: 13.5px; }

/* Admin → Platform messages */
.msg-card summary { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; cursor: pointer; }
.msg-card summary small { flex: 1 1 200px; }
.msg-card[open] summary { margin-bottom: 10px; }
.msg-card label { display: block; margin-top: 8px; }
.test-email-form { margin: -6px 0 18px; }

/* Settings → WhatsApp: connected by Nezler's team */
.onboard-box { padding: 12px 14px; border-radius: 10px; background: var(--soft); margin: 8px 0 12px; }
.onboard-box p { margin: 0 0 8px; }
fieldset.greyed { opacity: .5; }

/* AI credit: the "i", add credit, earn credit */
.info-i { width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--muted); background: transparent; color: var(--muted); font: italic 700 12px/1 Georgia, serif; cursor: pointer; vertical-align: 2px; margin-left: 4px; padding: 0; }
.info-i:hover { border-color: var(--brand); color: var(--brand); }
.credits-info { background: var(--soft); border-radius: 10px; padding: 10px 14px; margin-bottom: 12px; font-size: 13.5px; }
.credits-info ul { margin: 6px 0; padding-left: 18px; }
.topup { display: grid; gap: 8px; max-width: 520px; }
.topup-amounts { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-btn { border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: 99px; padding: 5px 12px; font-size: 13px; cursor: pointer; }
.chip-btn:hover { border-color: var(--brand); }
.earn-list { list-style: none; padding: 0; margin: 0 0 10px; display: grid; gap: 4px; max-width: 520px; }
.earn-list li { display: flex; justify-content: space-between; gap: 10px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 13.5px; }
.earn-list li b { color: var(--brand); white-space: nowrap; }
.earn-list li.done { opacity: .6; }
td.neg { color: var(--danger); }

/* CP center: stage chips, the lead page */
.stage-chips, .stage-pick { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.chip-btn.on { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 12%, var(--card)); color: var(--text); font-weight: 600; }
a.chip-btn { text-decoration: none; }
.stage-pick label { cursor: pointer; }
.stage-pick input { display: none; }
.cp-form-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 10px 0; border-bottom: 1px solid var(--line, #e5e7eb); }
.cp-form-row .check { margin: 0; }
.cp-form-row .btn { margin-left: auto; }
.cp-form-fields, .cp-form-row .alert { flex-basis: 100%; margin: 0; }
.cp-fields input, .cp-fields select, .cp-fields textarea { margin: 0; }
.cp-extra { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 0; }
.cp-extra dd { margin: 0; }
.lead-history { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.lead-history li { display: grid; grid-template-columns: 130px 1fr; gap: 10px; font-size: 14px; }
@media (max-width: 600px) { .lead-history li { grid-template-columns: 1fr; gap: 0; } }
.row.tight { gap: 6px; flex-wrap: nowrap; }
