/* Bynix Chat dashboard — layout & components on top of brand.css */
[hidden] { display: none !important; }
kbd { font: 600 11px var(--bx-font-body); background: var(--surface-2); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; }
code { font-size: 13px; }

/* ---------- Auth ---------- */
.auth { min-height: 100%; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.auth-side { background: var(--bx-charcoal); color: #fff; padding: 48px max(32px, env(safe-area-inset-left, 0px)); display: flex; flex-direction: column; gap: 22px; justify-content: center; position: relative; overflow: hidden; }
.auth-side::after { content: ""; position: absolute; right: -120px; bottom: -120px; width: 360px; height: 360px; border-radius: 50%;
  background-image: radial-gradient(circle, rgba(255,255,255,.22) 1.6px, transparent 1.8px); background-size: 14px 14px; mask-image: radial-gradient(circle, #000 35%, transparent 70%); }
.auth-mark { color: #fff; font-size: 24px; }
.auth-mark .sub { color: #a2a2ab; }
.auth-hero { font-size: clamp(32px, 4vw, 48px); line-height: 1.05; font-weight: 800; max-width: 14ch; }
.auth-copy { color: #c2c2c8; max-width: 44ch; margin: 0; font-size: 16px; }
.auth-points { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 12px; color: #e6e6e9; }
.auth-points .bx-tech { color: var(--red-text); font-size: 12px; margin-right: 10px; }
.auth-main { display: grid; place-items: center; padding: 32px max(20px, env(safe-area-inset-right, 0px)) 32px 20px; }
.auth-form { width: 100%; max-width: 380px; display: grid; gap: 16px; }
.auth-form h2 { font-size: 28px; font-weight: 800; }
.auth-form > p { margin: -8px 0 4px; }
.auth-submit { justify-content: center; padding: 13px; font-size: 15px; }
.auth-switch { text-align: center; font-size: 14px; margin: 0; }
.auth-switch button { background: none; border: 0; color: var(--fg); font: 700 14px var(--bx-font-body); text-decoration: underline; cursor: pointer; }
.form-err { color: var(--danger); font-size: 13.5px; font-weight: 600; margin: 0; }
@media (max-width: 860px) { .auth { grid-template-columns: 1fr; } .auth-side { padding: 32px 20px; } .auth-points { display: none; } }

/* ---------- App shell ---------- */
.app { height: 100%; display: grid; grid-template-columns: 64px minmax(0, 1fr); }
.rail { background: var(--bx-charcoal); display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 0 calc(14px + env(safe-area-inset-bottom, 0px)); padding-left: env(safe-area-inset-left, 0px); }
.rail-mark { font: 800 22px var(--bx-font-display); color: #fff; margin-bottom: 14px; position: relative; }
.rail-mark .bx-reddot { position: absolute; top: 2px; right: -9px; }
.rail-btn { width: 44px; height: 44px; border-radius: 12px; border: 0; background: transparent; color: #8c8c95; display: grid; place-items: center; cursor: pointer; position: relative; }
.rail-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.rail-btn:hover { color: #fff; background: #1e1e22; }
.rail-btn.on { color: #fff; background: #26262b; }
.rail-btn.on::before { content: ""; position: absolute; left: -10px; top: 12px; bottom: 12px; width: 3px; border-radius: 2px; background: var(--bx-red); }
.rail-btn .bx-badge { position: absolute; top: 2px; right: 0; }
.rail-spacer { flex: 1; }
.rail-me { width: 36px; height: 36px; border-radius: 50%; border: 0; background: #2a2a2f; color: #fff; font: 700 14px var(--bx-font-body); cursor: pointer; }
.view { min-height: 0; min-width: 0; }

/* ---------- Inbox ---------- */
.inbox { display: grid; grid-template-columns: 320px minmax(0, 1fr) auto; height: 100%; }
.list-pane { border-right: 1px solid var(--line); background: var(--surface); display: flex; flex-direction: column; min-height: 0; }
.list-head { padding: 18px 16px 10px; display: grid; gap: 10px; border-bottom: 1px solid var(--line); }
.list-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tabs, .set-tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tab { border: 0; background: transparent; padding: 7px 12px; border-radius: 8px; font: 600 13.5px var(--bx-font-body); color: var(--muted); cursor: pointer; }
.tab:hover { background: var(--surface-2); color: var(--fg); }
.tab.on { background: var(--fg); color: var(--bg); }
.conv-list { list-style: none; margin: 0; padding: 6px; overflow-y: auto; flex: 1; }
.conv { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; gap: 10px; padding: 11px 10px; border-radius: 10px; cursor: pointer; align-items: start; }
.conv:hover { background: var(--surface-2); }
.conv.on { background: var(--surface-3); }
.conv-av { width: 38px; height: 38px; border-radius: 50%; background: var(--surface-3); display: grid; place-items: center; font-weight: 800; font-size: 14px; position: relative; }
.conv-av .bx-online { position: absolute; right: 0; bottom: 0; border: 2px solid var(--surface); width: 11px; height: 11px; }
.conv-main { min-width: 0; }
.conv-name { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-last { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv.unread .conv-last { color: var(--fg); font-weight: 600; }
.conv-side { display: grid; justify-items: end; gap: 4px; font-size: 11.5px; color: var(--muted); }
.conv-tags { display: flex; gap: 4px; margin-top: 4px; flex-wrap: wrap; }
.conv-tags .bx-pill { font-size: 10.5px; padding: 1px 7px; }
.list-empty { padding: 32px 16px; text-align: center; color: var(--muted); font-size: 14px; }

.chat-pane { display: flex; flex-direction: column; min-height: 0; min-width: 0; background: var(--bg); }
.chat-empty { margin: auto; max-width: 440px; text-align: center; display: grid; gap: 8px; padding: 24px; }
/* Getting started checklist */
.onboard { text-align: left; margin-top: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--bx-r-lg); padding: 16px; display: grid; gap: 10px; }
.onboard-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.onboard-head h3 { font-size: 16px; }
.onboard-count { font-size: 12px; color: var(--muted); }
.onboard-bar { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.onboard-bar i { display: block; height: 100%; background: var(--bx-red-ink); border-radius: 3px; transition: width .3s; }
.onboard-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.onboard-steps li { display: grid; grid-template-columns: 22px 1fr; gap: 10px; align-items: start; }
.onboard-mark { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; font-size: 12px; font-weight: 800; }
.onboard-steps li.done .onboard-mark { background: var(--ok); border-color: var(--ok); color: var(--on-ok); }
.onboard-txt { display: grid; gap: 2px; font-size: 14px; min-width: 0; }
.onboard-txt .bx-muted { font-size: 13px; }
.onboard-steps li.done strong { color: var(--muted); font-weight: 600; }
.onboard-link { font-weight: 700; color: var(--fg); text-decoration: underline; text-decoration-color: var(--bx-red); text-underline-offset: 3px; }
.onboard-foot { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
@media (prefers-reduced-motion: reduce) { .onboard-bar i { transition: none; } }
.chat { display: flex; flex-direction: column; min-height: 0; height: 100%; }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--surface); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.chat-who { display: grid; min-width: 0; flex: 1; }
.chat-who strong { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-who span { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.assign { width: auto; padding: 6px 8px; font-size: 13px; }
.bot-toggle { font-size: 13px; }
.back { display: none; }
.msgs { flex: 1; overflow-y: auto; padding: 20px 20px 8px; display: flex; flex-direction: column; gap: 4px; }
.m { max-width: min(72%, 560px); display: grid; gap: 2px; }
.m .who { font-size: 11.5px; color: var(--muted); font-weight: 600; margin: 8px 4px 0; }
.m .b { padding: 10px 13px; border-radius: 14px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14.5px; }
.m .t { font-size: 11px; color: var(--muted); margin: 0 4px; }
.m.visitor { align-self: flex-start; }
.m.visitor .b { background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.m.agent, .m.bot { align-self: flex-end; text-align: left; }
.m.agent .who, .m.bot .who, .m.agent .t, .m.bot .t, .m.note .who, .m.note .t { text-align: right; }
.m.agent .b { background: var(--bubble-me); color: var(--bubble-me-fg); border-bottom-right-radius: 4px; }
.m.bot .b { background: var(--surface-3); border-bottom-right-radius: 4px; }
.m.note { align-self: flex-end; }
.m.note .b { background: var(--note); border: 1px dashed var(--glow); border-bottom-right-radius: 4px; }
.m.system { align-self: center; max-width: 100%; }
.m.system .b { background: transparent; color: var(--muted); font-size: 12px; padding: 4px 8px; text-align: center; }
.typing-line { padding: 0 20px 6px; font-size: 12.5px; color: var(--muted); font-style: italic; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.composer { background: var(--surface); border-top: 1px solid var(--line); padding: 10px 16px calc(12px + env(safe-area-inset-bottom, 0px)); position: relative; display: grid; gap: 8px; }
.composer.note-mode { background: var(--note); }
.composer-tabs { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.ctab { border: 0; background: transparent; font: 700 13px var(--bx-font-body); color: var(--muted); padding: 4px 10px; border-radius: 6px; cursor: pointer; }
.ctab.on { color: var(--fg); background: var(--surface-2); }
.composer.note-mode .ctab.on { background: var(--glow-soft); }
.hint { font-size: 12px; margin-left: auto; }
.composer-row { display: flex; gap: 10px; align-items: flex-end; }
.composer-row .bx-textarea { min-height: 48px; max-height: 200px; }
.canned-pop { position: absolute; bottom: calc(100% - 4px); left: 16px; right: 16px; max-height: 240px; overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; z-index: 5; }
.canned-pop button { display: grid; width: 100%; text-align: left; border: 0; background: transparent; padding: 8px 10px; border-radius: 8px; cursor: pointer; color: var(--fg); font: 14px var(--bx-font-body); }
.canned-pop button.on, .canned-pop button:hover { background: var(--surface-2); }
.canned-pop b { font-size: 13px; }
.canned-pop span { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.info-pane { width: 280px; border-left: 1px solid var(--line); background: var(--surface); padding: 18px 16px; display: flex; flex-direction: column; gap: 12px; overflow-y: auto; }
.info { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 12px; margin: 0; font-size: 13px; }
.info dt { color: var(--muted); }
.info dd { margin: 0; overflow-wrap: anywhere; }

@media (max-width: 1100px) { .info-pane { position: fixed; right: 0; top: 0; bottom: 0; z-index: 20; box-shadow: var(--shadow); } }
@media (max-width: 760px) {
  .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
  .rail { flex-direction: row; justify-content: space-around; padding: 6px max(8px, env(safe-area-inset-left, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)); grid-row: 2; }
  .rail-mark, .rail-spacer { display: none; }
  .rail-btn.on::before { display: none; }
  .inbox { grid-template-columns: minmax(0, 1fr); }
  .inbox.chat-open .list-pane { display: none; }
  .inbox:not(.chat-open) .chat-pane { display: none; }
  .back { display: inline-flex; }
  .hint { display: none; }
  .m { max-width: 88%; }
  .info-pane { width: 100%; }
}

/* ---------- Pages (analytics / settings) ---------- */
.page { overflow-y: auto; padding: 28px max(20px, env(safe-area-inset-right, 0px)) 48px max(20px, env(safe-area-inset-left, 0px)); display: flex; flex-direction: column; gap: 20px; }
.page > * { width: 100%; max-width: 1080px; margin-inline: auto; }
.page-head { display: flex; justify-content: space-between; align-items: end; gap: 16px; flex-wrap: wrap; }
.page-head h1 { margin-top: 4px; }
.range { width: auto; }
.kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 760px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--bx-r-lg); padding: 16px 18px; display: grid; gap: 4px; }
.kpi .v { font-family: var(--bx-font-tech); font-weight: 700; font-size: 28px; font-variant-numeric: tabular-nums; }
.kpi .l { color: var(--muted); font-size: 13px; }
.kpi.lead .v { color: var(--red-text); }
.grid2 { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 900px) { .grid2 { grid-template-columns: minmax(0, 1fr); } }
.chart { margin-top: 12px; overflow-x: auto; }
.chart svg { display: block; width: 100%; height: auto; min-width: 360px; }
.chart text { fill: var(--muted); font: 11px var(--bx-font-body); }
.tbl { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 14px; }
.tbl td { padding: 9px 4px; border-bottom: 1px solid var(--line); }
.tbl td:last-child { text-align: right; font-family: var(--bx-font-tech); font-variant-numeric: tabular-nums; }

.stack { display: grid; gap: 16px; }
.row-gap { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.grow { flex: 1; min-width: 200px; }
.code { background: var(--bx-charcoal); color: #f2f2f4; padding: 16px; border-radius: var(--bx-r); overflow-x: auto; font: 13px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; margin: 0; white-space: pre; }
.swatch { width: 64px; height: 42px; border: 1px solid var(--line); border-radius: var(--bx-r); background: var(--surface); padding: 3px; cursor: pointer; }
.kb { min-height: 260px; font-size: 13.5px; }
.ai-status { font-size: 14px; font-weight: 600; padding: 10px 12px; border-radius: var(--bx-r); }
.ai-status.on { background: color-mix(in srgb, var(--ok) 12%, transparent); color: var(--ok); }
.ai-status.off { background: var(--glow-soft); color: var(--warn-ink); }
.faq-list { display: grid; gap: 10px; }
.faq { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) auto; gap: 8px; align-items: start; }
@media (max-width: 640px) { .faq { grid-template-columns: minmax(0, 1fr); } }
.canned-form { display: flex; gap: 8px; flex-wrap: wrap; }
.canned-form > .bx-input:first-child:not(.grow) { width: 180px; }
.simple-list { list-style: none; padding: 0; margin: 0; display: grid; }
.simple-list li { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.simple-list li > div { flex: 1; min-width: 0; }
.simple-list .sub { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }

.preview-wrap { display: grid; gap: 10px; justify-items: center; }
.preview { width: 100%; max-width: 330px; border-radius: 18px; overflow: hidden; box-shadow: var(--shadow); background: #fff; color: #111113; border: 1px solid var(--line); }
.pv-head { background: #111113; color: #fff; padding: 14px; display: flex; gap: 10px; align-items: center; }
.pv-head small { display: block; color: #b9b9c0; font-size: 11.5px; }
.pv-av { width: 34px; height: 34px; border-radius: 50%; background: #26262b; display: grid; place-items: center; font-weight: 800; }
.pv-body { background: #f6f6f7; padding: 14px; display: grid; gap: 8px; min-height: 180px; align-content: start; }
.pv-b { padding: 9px 12px; border-radius: 14px; font-size: 13.5px; max-width: 85%; white-space: pre-wrap; }
.pv-b.them { background: #fff; border: 1px solid #e6e6ea; justify-self: start; }
.pv-b.me { justify-self: end; color: #fff; }
.pv-foot { border-top: 1px solid #ececef; padding: 12px 14px; color: #63636b; font-size: 13px; }

/* ---------- Attachments & tags ---------- */
.attach-btn { padding: 10px; height: 48px; }
.attach-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.m .b.has-att { padding: 6px; }
.m .att-img { display: block; max-width: 260px; max-height: 260px; border-radius: 10px; }
.m .att-file { display: flex; gap: 10px; align-items: center; color: inherit; text-decoration: none; padding: 4px 6px; }
.m .att-file i { font-style: normal; font-weight: 800; font-size: 11px; background: color-mix(in srgb, currentColor 14%, transparent); border-radius: 6px; padding: 6px 7px; }
.m .att-file small { display: block; opacity: .7; font-size: 12px; }
.search-row { display: grid; grid-template-columns: minmax(0, 1fr) 120px; gap: 6px; }
.search-row .bx-select { padding: 10px 8px; font-size: 13px; }
.tag-edit { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-chip { display: inline-flex; align-items: center; gap: 4px; background: var(--glow-soft); color: var(--warn-ink); font-weight: 700; font-size: 12px; border-radius: 999px; padding: 3px 4px 3px 10px; }
.tag-chip button { border: 0; background: transparent; color: inherit; cursor: pointer; font-size: 14px; line-height: 1; padding: 0 4px; border-radius: 50%; }
.uploading { font-size: 12.5px; color: var(--muted); }

/* ---------- AI agent settings ---------- */
.ai-grid { align-items: start; }
.kb-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.kb-usage { font-size: 12.5px; font-variant-numeric: tabular-nums; }
.kb-crawl { font-weight: 500; font-size: 13.5px; }
.kb-hint { font-size: 12.5px; }
.kb-list { list-style: none; margin: 0; padding: 0; display: grid; border-top: 1px solid var(--line); }
.kb-item { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--line); }
.kb-kind { font: 700 10px var(--bx-font-tech); letter-spacing: .06em; text-align: center; padding: 6px 0; border-radius: 6px; background: var(--surface-2); color: var(--muted); }
.kb-kind.url { background: var(--accent-soft); color: var(--red-text); }
.kb-kind.pdf { background: var(--glow-soft); color: var(--warn-ink); }
.kb-kind.article { background: color-mix(in srgb, var(--ok-ink) 14%, transparent); color: var(--ok-ink); }
.kb-title { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; color: var(--fg); text-decoration: none; }
a.kb-title:hover { text-decoration: underline; }
.kb-meta { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kb-meta.err { color: var(--danger); white-space: normal; }
.kb-actions { display: flex; gap: 4px; }
.kb-empty { padding: 16px 0; color: var(--muted); font-size: 14px; }
.spin { display: inline-block; width: 10px; height: 10px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: bxspin .8s linear infinite; vertical-align: -1px; margin-right: 4px; }
@keyframes bxspin { to { transform: rotate(360deg); } }
.ai-test-out { display: grid; gap: 10px; }
.ai-answer { background: var(--surface-2); border-radius: 14px; border-bottom-left-radius: 4px; padding: 12px 14px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14.5px; }
.ai-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12.5px; color: var(--muted); }
.ai-sources { margin: 0; padding-left: 18px; font-size: 13px; color: var(--muted); }
.ai-sources a { color: var(--fg); }
.gap-list li { align-items: flex-start; }
.gap-list .q { font-weight: 600; font-size: 14px; overflow-wrap: anywhere; }
.stack > p, .stack > h3 { margin: 0; }

/* ---------- Google sign-in ---------- */
.auth-or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.google-btn { justify-content: center; padding: 12px; font-size: 15px; text-decoration: none; }
.google-btn svg { width: 20px; height: 20px; }

/* ---------- Bulk actions & departments in inbox ---------- */
.select-btn { margin: 6px 10px 0; justify-self: start; align-self: flex-start; }
.bulk-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.bulk-bar .bx-select { width: auto; flex: 1; min-width: 140px; padding: 6px 8px; font-size: 13px; }
.bulk-bar .bx-check { font-size: 13px; }
.bulk-bar #bulkTag { width: 120px; padding: 6px 8px; font-size: 13px; }
.conv .pick { width: 18px; height: 18px; accent-color: var(--bx-red); margin: 10px 0 0; }
.conv.selecting { grid-template-columns: 22px 38px minmax(0, 1fr) auto; }
#deptFilter { padding: 8px; font-size: 13px; }

/* ---------- Widget rules ---------- */
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg label { display: inline-flex; gap: 6px; align-items: center; border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; font-size: 13.5px; font-weight: 600; cursor: pointer; }
.seg input { accent-color: var(--bx-red); }
.seg label:has(input:checked) { border-color: var(--fg); background: var(--surface-2); }

/* ---------- Working hours ---------- */
.hours-card { max-width: 640px; }
.hours-grid { display: grid; gap: 8px; }
.hours-row { display: grid; grid-template-columns: 150px 130px 20px 130px; justify-content: start; gap: 10px; align-items: center; }
.hours-row .bx-input { padding: 7px 8px; width: 120px; }
.hours-row.closed .bx-input { opacity: .4; }
@media (max-width: 520px) { .hours-row { grid-template-columns: 1fr 1fr; } .hours-row > span { display: none; } }
.canned-form .bx-select { width: auto; }

/* ---------- Departments ---------- */
.dept-card-set { margin-top: 16px; }
.dept-members { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 6px; }
.dept-members label { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; }
.dept-members input { accent-color: var(--bx-red); }

/* ---------- Phase 2: channels, tickets, contacts, visitors ---------- */
.filter-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 6px; }
.filter-row .bx-select { padding: 8px; font-size: 13px; }
.chat-subject { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status-sel { font-weight: 700; }
/* text mixed toward the page's text color keeps 4.5:1 on the tinted pill in both themes */
.bx-pill-danger { background: color-mix(in srgb, var(--danger) 14%, transparent); color: color-mix(in srgb, var(--danger) 72%, var(--fg)); }
.ch-icon { font: 700 10px var(--bx-font-tech); letter-spacing: .05em; padding: 5px 7px; border-radius: 6px; background: var(--surface-2); color: var(--muted); flex: none; }
.ch-icon.email { background: var(--glow-soft); color: var(--warn-ink); }
.ch-icon.web { background: var(--accent-soft); color: var(--red-text); }
.channel-row { display: flex; gap: 12px; align-items: center; padding: 10px 0; }
.channel-row .sub, .simple-list .url { font-size: 12.5px; overflow-wrap: anywhere; }
.ch-soon { font-size: 13px; }
.composer-hint { font-size: 12.5px; color: var(--muted); }
.rail-count { background: var(--ok); }
.table-card { padding: 0; overflow: hidden; }
.table-wrap { overflow-x: auto; }
.data-tbl { margin: 0; min-width: 640px; }
.data-tbl th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.data-tbl td { padding: 11px 16px; font-size: 14px; vertical-align: middle; }
.data-tbl td:last-child { text-align: right; font-family: inherit; }
.data-tbl tbody tr { cursor: default; }
.data-tbl tbody tr.click { cursor: pointer; }
.data-tbl tbody tr.click:hover, .data-tbl tbody tr.on { background: var(--surface-2); }
.data-tbl .muted { color: var(--muted); font-size: 13px; }
.data-tbl .clip { max-width: 260px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.empty-note { padding: 24px 16px; margin: 0; text-align: center; }
.pager { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; border-top: 1px solid var(--line); gap: 8px; }
.contacts-filters #contactTag { width: 160px; }
.contacts-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
.contacts-layout.with-panel { grid-template-columns: minmax(0, 1fr) 360px; }
@media (max-width: 1000px) { .contacts-layout.with-panel { grid-template-columns: minmax(0, 1fr); } }
.contact-panel h2 { font-size: 18px; }
.start-chat { display: flex; gap: 6px; justify-content: flex-end; }
.start-chat .bx-input { width: 220px; padding: 7px 10px; font-size: 13px; }
.sla-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.conv-subject { font-weight: 700; color: var(--fg); }
.ch-pill.email { background: var(--glow-soft); color: var(--warn-ink); }
.composer-hint:empty { display: none; }
#channelList li { align-items: flex-start; }
#channelList code { display: block; margin: 4px 0 8px; font-size: 12px; background: var(--surface-2); padding: 6px 8px; border-radius: 6px; overflow-wrap: anywhere; }

/* ---------- Messaging channels ---------- */
.ch-icon.whatsapp, .ch-pill.whatsapp { background: color-mix(in srgb, #25d366 18%, transparent); color: color-mix(in srgb, #128c4b 70%, var(--fg)); }
.ch-icon.messenger, .ch-pill.messenger { background: color-mix(in srgb, #0866ff 16%, transparent); color: color-mix(in srgb, #0866ff 72%, var(--fg)); }
.ch-icon.instagram, .ch-pill.instagram { background: color-mix(in srgb, #e1306c 16%, transparent); color: color-mix(in srgb, #c13584 72%, var(--fg)); }
.ch-icon.telegram, .ch-pill.telegram { background: color-mix(in srgb, #229ed9 16%, transparent); color: color-mix(in srgb, #1b84b5 70%, var(--fg)); }
:root[data-theme="dark"] .ch-icon.whatsapp, :root[data-theme="dark"] .ch-pill.whatsapp { color: #4ade80; }
.steps { margin: 0; padding-left: 20px; display: grid; gap: 4px; font-size: 13.5px; color: var(--muted); }
.steps b { color: var(--fg); }
.ch-pick label { font-size: 13px; }
.window-box { background: var(--glow-soft); border-radius: var(--bx-r); padding: 10px 12px; display: grid; gap: 8px; font-size: 13.5px; }
.window-box p { margin: 0; }
.window-box .bx-input { padding: 7px 10px; font-size: 13px; }
.tpl-lang { width: 70px; }
.m .st { font-size: 11px; color: var(--muted); text-align: right; margin: 0 4px; }
.m .st.failed { color: var(--danger); }
.m audio, .m video { display: block; max-width: 280px; border-radius: 10px; }
#channelList .verify { font-size: 12px; color: var(--muted); }

/* ---------- Flows ---------- */
.switch { appearance: none; width: 38px; height: 22px; border-radius: 11px; background: var(--surface-3); position: relative; cursor: pointer; transition: background .15s; vertical-align: middle; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: left .15s; }
.switch:checked { background: var(--bx-red); }
.switch:checked::after { left: 19px; }
.switch:disabled { opacity: .5; cursor: default; }
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.tpl { text-align: left; display: grid; gap: 4px; padding: 14px 16px; border-radius: var(--bx-r-lg); border: 1px solid var(--line); background: var(--surface); color: var(--fg); cursor: pointer; font: inherit; }
.tpl:hover, .tpl:focus-visible { border-color: var(--bx-red); }
.tpl span { color: var(--muted); font-size: 13px; }

#view-flows.page { padding-bottom: 0; }
.flow-editor { display: flex; flex-direction: column; height: calc(100vh - 40px); max-width: none !important; margin: -12px -4px 0 !important; width: auto !important; }
.fe-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 0 0 12px; border-bottom: 1px solid var(--line); }
.fe-name { width: 260px; font-weight: 700; }
.fe-ch { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 13px; }
.fe-ch label { display: inline-flex; gap: 5px; align-items: center; }
.fe-ch input { accent-color: var(--bx-red); }
.fe-on { margin-left: auto; }
.fe-state { font-size: 12.5px; min-width: 110px; text-align: right; }
.fe-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 190px minmax(0, 1fr) 320px; gap: 0; }
.fe-palette { overflow-y: auto; padding: 12px 10px 12px 0; display: grid; gap: 6px; align-content: start; border-right: 1px solid var(--line); }
.pal { text-align: left; display: grid; gap: 1px; padding: 8px 10px; border: 1px solid var(--line); border-left: 3px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--fg); cursor: pointer; font: inherit; }
.pal strong { font-size: 13px; } .pal span { font-size: 11.5px; color: var(--muted); }
.pal:hover:not(:disabled) { background: var(--surface-2); }
.pal-ink { border-left-color: var(--fg); } .pal-orange { border-left-color: var(--bx-orange); } .pal-grey { border-left-color: var(--surface-3); }
.fe-canvas { overflow: auto; position: relative; background: var(--bg); }
.fe-inner { position: relative; width: 2400px; height: 1800px; background-image: radial-gradient(circle, var(--line) 1.2px, transparent 1.4px); background-size: 22px 22px; }
.fe-edges { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.fe-edges .edge { fill: none; stroke: var(--muted); stroke-width: 2; }
.fe-edges .edge.temp { stroke: var(--bx-red); stroke-dasharray: 6 5; }
.fe-edges .edge-hit { fill: none; stroke: transparent; stroke-width: 14; pointer-events: stroke; cursor: pointer; }
.fe-edges .edge-hit:hover + .edge, .fe-edges .edge-hit:hover { stroke: color-mix(in srgb, var(--danger) 35%, transparent); }
.fn { position: absolute; width: 220px; background: var(--surface); border: 1.5px solid var(--line); border-radius: 12px; box-shadow: 0 2px 8px rgba(17,17,19,.06); user-select: none; }
.fn.sel { border-color: var(--fg); box-shadow: 0 0 0 3px var(--accent-soft); }
.fn:focus-visible { outline: 2px solid var(--glow); outline-offset: 2px; }
.fn-h { font: 700 11px var(--bx-font-tech); letter-spacing: .06em; text-transform: uppercase; padding: 8px 12px 4px; cursor: grab; color: var(--muted); }
.fn-red .fn-h { color: var(--red-text); } .fn-orange .fn-h { color: var(--warn-ink); }
.fn-red { border-top: 3px solid var(--bx-red); } .fn-orange { border-top: 3px solid var(--bx-orange); } .fn-ink { border-top: 3px solid var(--fg); }
.fn-b { padding: 0 12px 10px; font-size: 13px; line-height: 1.35; max-height: 72px; overflow: hidden; overflow-wrap: anywhere; white-space: pre-wrap; }
.fn-in { position: absolute; top: -6px; left: 50%; width: 12px; height: 12px; margin-left: -6px; border-radius: 50%; background: var(--surface); border: 2px solid var(--muted); }
.fn-outs { display: flex; flex-wrap: wrap; gap: 4px 6px; justify-content: center; padding: 6px 8px 10px; border-top: 1px dashed var(--line); }
.fn-port { display: grid; justify-items: center; gap: 3px; cursor: crosshair; font-size: 11px; color: var(--muted); max-width: 96px; }
.fn-port span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 96px; }
.fn-port i { width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 2px solid var(--muted); display: block; }
.fn-port.on i { background: var(--fg); border-color: var(--fg); }
.fn-port:hover i { border-color: var(--bx-red); }
.fe-inspector { overflow-y: auto; padding: 12px 0 24px 16px; border-left: 1px solid var(--line); display: grid; gap: 12px; align-content: start; }
.fe-inspector h3 { font-size: 15px; }
.fe-inspector .small { font-size: 12.5px; margin: 0; }
.fe-inspector .next-h { margin-top: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.fld-label { font-size: 13px; font-weight: 600; }
@media (max-width: 1100px) { .fe-body { grid-template-columns: 150px minmax(0, 1fr) 260px; } }
@media (max-width: 760px) { .fe-body { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 420px auto; } .fe-palette { grid-template-columns: repeat(2, minmax(0, 1fr)); border-right: 0; } .fe-inspector { border-left: 0; padding-left: 0; } .flow-editor { height: auto; } }
.m .qr-view { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; justify-content: flex-end; }
.m .qr-view span { font-size: 12px; border: 1px solid var(--line); border-radius: 999px; padding: 2px 9px; color: var(--muted); }

/* ---------- Copilot & developers ---------- */
.copilot-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.cp-btn { color: var(--red-text); border-color: color-mix(in srgb, var(--bx-red) 35%, transparent); }
.cp-rewrite { width: auto; padding: 6px 8px; font-size: 13px; }
.summary-box { display: grid; gap: 8px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.summary-box dl { margin: 0; display: grid; gap: 6px; font-size: 13px; }
.summary-box dt { font-weight: 700; } .summary-box dd { margin: 0; color: var(--fg); }
.m .tr { font-size: 12.5px; color: var(--muted); margin: 2px 4px 0; max-width: 100%; white-space: pre-wrap; overflow-wrap: anywhere; }
.m .tr b { font-weight: 700; color: var(--warn-ink); }
.secret-box { background: var(--glow-soft); border-radius: var(--bx-r); padding: 12px; display: grid; gap: 8px; font-size: 13.5px; }
.secret-box code { display: block; padding: 8px; border-radius: 6px; background: var(--surface); overflow-wrap: anywhere; font-size: 12.5px; }
.hook-events { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; }
.hook-events label { display: inline-flex; gap: 5px; align-items: center; }
.hook-events input { accent-color: var(--bx-red); }
.dl-pills { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.dl-pills span { font-size: 11px; padding: 1px 7px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.dl-pills .ok { color: var(--ok); } .dl-pills .bad { color: var(--danger); }
.my-lang { max-width: 360px; }
.secret-box button { justify-self: start; }

/* ---------- Analytics (M19) ---------- */
/* Categorical series colors, fixed order by channel; validated for both themes */
:root { --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4; --s6: #008300;
  --h1: #cde2fb; --h2: #8fbcf2; --h3: #4f92e0; --h4: #2263b3; --h5: #0d366b; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #0ca30c;
  --h1: #12305a; --h2: #1d4f8f; --h3: #2f73c6; --h4: #5f9ce6; --h5: #a9cbf5; } }
:root[data-theme="dark"] { --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #0ca30c;
  --h1: #12305a; --h2: #1d4f8f; --h3: #2f73c6; --h4: #5f9ce6; --h5: #a9cbf5; }
.rep-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.rep-filters .bx-select, .rep-filters .bx-input { width: auto; }
.rep-filters #customDates { display: inline-flex; gap: 6px; align-items: center; }
.rep-filters #customDates[hidden] { display: none; }
.rep-weekly { margin-left: auto; font-size: 13.5px; }
.kpi .sub { color: var(--muted); font-size: 12px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.seg-sm label { padding: 4px 10px; font-size: 12.5px; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 8px; font-size: 13px; color: var(--muted); }
.legend .lg { display: inline-flex; align-items: center; gap: 6px; }
.legend i, .ch-name i, .chart-tip i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex: none; }
.ch-name { display: inline-flex; align-items: center; gap: 8px; }
.chart line.grid { stroke: var(--line); stroke-width: 1; }
.chart .hit { fill: transparent; }
.chart .hit:hover { fill: var(--surface-2); }
.chart .tbl th, .tbl th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 6px 4px; border-bottom: 1px solid var(--line); }
.tbl th.num, .tbl td.num { text-align: right; font-family: var(--bx-font-tech); font-variant-numeric: tabular-nums; }
.chart-tip { position: fixed; z-index: 90; pointer-events: none; background: var(--surface); color: var(--fg); border: 1px solid var(--line); box-shadow: var(--shadow);
  border-radius: 10px; padding: 8px 10px; font-size: 12.5px; display: grid; gap: 4px; min-width: 150px; }
.chart-tip[hidden] { display: none; }
.chart-tip .tr { display: flex; align-items: center; gap: 8px; }
.chart-tip .tr span { flex: 1; color: var(--muted); }
.chart-tip strong { font-family: var(--bx-font-tech); font-variant-numeric: tabular-nums; }
.heatmap { margin-top: 10px; overflow-x: auto; }
.hm-grid { display: grid; grid-template-columns: 34px repeat(24, minmax(10px, 1fr)); gap: 2px; min-width: 330px; }
.hm-h, .hm-d { font-size: 10.5px; color: var(--muted); }
.hm-h { text-align: left; }
.hm-d { align-self: center; }
.hm-c { aspect-ratio: 1; border-radius: 3px; background: var(--surface-2); display: block; }
.hm-grid .hm-c:hover { outline: 2px solid var(--fg); outline-offset: -1px; }
.hm-c.l1 { background: var(--h1); } .hm-c.l2 { background: var(--h2); } .hm-c.l3 { background: var(--h3); } .hm-c.l4 { background: var(--h4); } .hm-c.l5 { background: var(--h5); }
.hm-key { display: flex; align-items: center; gap: 3px; justify-content: flex-end; margin-top: 8px; font-size: 11px; color: var(--muted); }
.hm-key .hm-c { width: 12px; } .hm-key span:first-child { margin-right: 4px; } .hm-key span:last-child { margin-left: 4px; }
.hbars { display: grid; gap: 8px; margin-top: 10px; }
.hb { display: grid; grid-template-columns: minmax(60px, 120px) 1fr auto; gap: 10px; align-items: center; font-size: 13.5px; }
.hb-l { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hb-track { height: 10px; }
.hb-track span { display: block; height: 100%; background: var(--s1); border-radius: 0 4px 4px 0; }
.hb-v { font-family: var(--bx-font-tech); font-variant-numeric: tabular-nums; min-width: 2ch; text-align: right; }
.gaps { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 8px; font-size: 14px; }
.gaps a { color: var(--fg); }
.small { font-size: 12.5px; }

/* ---------- Install / store ---------- */
.install-more { align-items: start; }
.set-panel.stack[hidden] { display: none; }
.store-row { display: flex; align-items: center; gap: 14px; }
.store-row > div { flex: 1; }
.store-kind { font-weight: 700; font-size: 12px; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); }

/* ---------- Orders panel ---------- */
.orders { display: grid; gap: 8px; }
.orders .cust { font-size: 14px; }
.order { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: grid; gap: 4px; background: var(--surface); }
.order .o-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-weight: 700; }
.order a { color: var(--fg); }
.o-st { font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); text-transform: capitalize; }
.o-st.st-shipped, .o-st.st-completed, .o-st.st-fulfilled { color: var(--ok); }
.o-st.st-cancelled, .o-st.st-refunded, .o-st.st-payment-failed { color: var(--danger); }
.order .bx-btn { justify-self: start; margin-top: 4px; }

/* ---------- Product picker ---------- */
.product-pop { position: absolute; bottom: calc(100% + 6px); left: 12px; right: 12px; max-width: 420px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: var(--shadow); padding: 10px; display: grid; gap: 8px; z-index: 20; }
.product-pop[hidden] { display: none; }
.product-list { display: grid; gap: 4px; max-height: 300px; overflow: auto; }
.prod { display: flex; gap: 10px; align-items: center; text-align: left; background: none; border: 0; padding: 6px; border-radius: 10px; cursor: pointer; color: var(--fg); font: inherit; }
.prod:hover, .prod:focus-visible { background: var(--surface-2); }
.prod img, .prod .img-ph { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; background: var(--surface-2); flex: none; }
.prod .pt { display: grid; }

.tbl td.bx-muted { text-align: left; font-family: inherit; }

/* ---------- Billing (M18) ---------- */
.plan-banner { position: fixed; top: 10px; left: 50%; transform: translateX(-50%); z-index: 60; display: flex; align-items: center; gap: 12px; max-width: calc(100% - 32px);
  background: var(--fg); color: var(--bg); border-radius: 999px; padding: 8px 10px 8px 18px; font-size: 13.5px; font-weight: 600; box-shadow: var(--shadow); }
.plan-banner[hidden] { display: none; }
.plan-banner a { color: var(--bg); text-decoration: underline; white-space: nowrap; }
.plan-banner button { background: none; border: 0; color: inherit; font-size: 18px; line-height: 1; cursor: pointer; padding: 0 6px; opacity: 0.7; }
.bill-head { display: flex; justify-content: space-between; align-items: start; gap: 16px; flex-wrap: wrap; }
.bill-head h2 { margin: 4px 0 6px; }
.meters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 760px) { .meters { grid-template-columns: minmax(0, 1fr); } }
.meter { display: grid; gap: 6px; font-size: 13.5px; }
.meter-top { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); }
.meter-top b { color: var(--fg); font-family: var(--bx-font-tech); font-variant-numeric: tabular-nums; font-size: 13px; }
.meter-track { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.meter-track span { display: block; height: 100%; background: var(--s1); border-radius: 999px; }
.meter.warn .meter-track span { background: var(--warn); }
.meter.full .meter-track span { background: var(--danger); }
.meter-note { font-size: 12px; font-weight: 700; color: var(--muted); }
.meter.warn .meter-note::before, .meter.full .meter-note::before { content: "⚠ "; }
.bill-cur { width: auto; }
.plans { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 1100px) { .plans { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .plans { grid-template-columns: minmax(0, 1fr); } }
.plan { position: relative; border: 1px solid var(--line); border-radius: var(--bx-r-lg); padding: 18px; display: grid; gap: 12px; grid-template-rows: auto auto 1fr auto; background: var(--surface); }
.plan ul { align-self: start; }
.plan.featured { border-color: var(--fg); }
.plan.current { background: var(--surface-2); }
.plan h4 { margin: 0; font-size: 16px; }
.plan-tag { position: absolute; top: -10px; right: 14px; background: var(--bx-red-ink); color: #fff; font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 999px; }
.plan-price b { font-family: var(--bx-font-tech); font-size: 26px; }
.plan-price span { color: var(--muted); font-size: 13px; }
.plan ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; font-size: 13.5px; }
.plan li::before { content: "✓"; color: var(--ok); font-weight: 700; margin-right: 8px; }
.plan .bx-btn { margin-top: 4px; }
.plan-banner { width: max-content; }
@media (max-width: 760px) { .plan-banner { left: 16px; right: 16px; width: auto; max-width: none; transform: none; border-radius: 14px; align-items: flex-start; } .plan-banner span { flex: 1; } }

/* ---------- Push notifications (M14) ---------- */
.push-state { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.push-state.on { color: var(--ok); }
.push-prefs { display: grid; gap: 8px; }
body.is-offline .app::before { content: "Offline"; position: fixed; top: 8px; right: 12px; z-index: 70; background: var(--warn); color: #111113; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; }

/* ---------- Security (M20) ---------- */
.code-input { font-family: var(--bx-font-tech); letter-spacing: 3px; font-size: 18px; max-width: 220px; }
.tfa-setup { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 640px) { .tfa-setup { grid-template-columns: minmax(0, 1fr); } }
.tfa-qr { background: #fff; border-radius: 12px; padding: 10px; border: 1px solid var(--line); width: 200px; box-sizing: border-box; }
.tfa-qr svg { display: block; width: 100%; height: auto; }
.tfa-steps { margin: 0; padding-left: 20px; display: grid; gap: 6px; color: var(--muted); }
.tfa-steps code { color: var(--fg); font-family: var(--bx-font-tech); letter-spacing: 1px; word-break: break-all; }
.tfa-codes { display: grid; gap: 10px; }
.tfa-codes pre { columns: 2; font-family: var(--bx-font-tech); letter-spacing: 1px; }
.sess-list li { gap: 12px; }
.audit-filter { width: auto; }
.audit-tbl td { vertical-align: top; font-size: 13px; }
.audit-tbl .nowrap { white-space: nowrap; }
.warn-text { color: var(--danger); font-weight: 600; }
.need2faNote, .need2fa-note { border-color: var(--warn); }
body.needs-2fa .rail-btn[data-view]:not([data-view="settings"]) { display: none; }
body.needs-2fa .set-tabs .tab:not([data-set="security"]) { display: none; }

/* ---------- Agency (M21) ---------- */
.acting-bar { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 65; display: flex; align-items: center; gap: 12px; max-width: calc(100% - 32px);
  background: var(--glow); color: #111113; border-radius: 999px; padding: 8px 8px 8px 18px; font-size: 13.5px; font-weight: 600; box-shadow: var(--shadow); }
.acting-bar[hidden] { display: none; }
.acting-bar .bx-btn { background: #111113; color: #fff; border-color: #111113; }
@media (max-width: 760px) { .acting-bar { bottom: calc(72px + env(safe-area-inset-bottom, 0px)); left: 16px; right: 16px; transform: none; border-radius: 14px; width: auto; } .acting-bar span { flex: 1; } }
.client-form { align-items: end; }
.client-form .grow { flex: 1; min-width: 200px; }
.client-tbl td { vertical-align: middle; }
.client-tbl .row-actions { text-align: right; white-space: nowrap; }
.client-tbl .row-actions > div { display: inline-flex; gap: 6px; }
body.white-label .auth-points { display: none; }
.price-in { width: 120px; }
.rail-mark img { width: 30px; height: 30px; border-radius: 8px; object-fit: cover; display: block; }
.rail-mark img[src^="/brand/"] { border-radius: 0; object-fit: contain; }

/* ---------- Calls & co-browsing (M22) ---------- */
.call-btns { display: inline-flex; gap: 2px; }
.call-btns[hidden] { display: none; }
.icon-btn { width: 34px; padding: 0; display: inline-grid; place-items: center; }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn:disabled { opacity: 0.35; }
.attach-btn.rec { color: var(--danger); }
.call-panel { position: fixed; right: 20px; bottom: 20px; z-index: 70; width: 360px; max-width: calc(100% - 32px); background: #111113; color: #fff; border-radius: 18px; overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.call-panel[hidden] { display: none; }
.cp-stage { position: relative; height: 240px; background: #000; display: grid; place-items: center; }
.cp-stage #cpRemote { width: 100%; height: 100%; object-fit: contain; }
.cp-stage #cpLocal { position: absolute; right: 10px; bottom: 10px; width: 92px; height: 70px; object-fit: cover; border-radius: 10px; border: 2px solid rgba(255,255,255,.6); background: #222; }
.cp-who { display: grid; justify-items: center; gap: 8px; font-weight: 700; }
.cp-av { width: 72px; height: 72px; border-radius: 50%; background: var(--bx-red); display: grid; place-items: center; font-size: 26px; }
.cp-bar { padding: 10px 12px; display: grid; gap: 8px; }
#cpStatus { font-size: 13px; opacity: .85; }
.cp-ctl { display: flex; gap: 6px; flex-wrap: wrap; }
.cp-ctl button { flex: 1; min-width: 70px; height: 36px; border: 0; border-radius: 10px; background: #2a2a2f; color: #fff; font: 600 13px var(--bx-font-body); cursor: pointer; }
.cp-ctl button.on { background: #fff; color: #111113; }
.cp-ctl button.end { background: #e5484d; }
.cp-ctl button[hidden] { display: none; }
.cob-view { position: fixed; inset: 24px; z-index: 75; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; overflow: hidden; }
.cob-view[hidden] { display: none; }
.cob-view header { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.cob-stage { position: relative; flex: 1; overflow: hidden; background: var(--surface-2); }
.cob-stage .replayer-wrapper { position: absolute; top: 0; }
.cob-stage iframe { border: 0; background: #fff; }
@media (max-width: 760px) { .cob-view { inset: 0; border-radius: 0; } .call-panel { right: 16px; bottom: calc(76px + env(safe-area-inset-bottom, 0px)); } }

/* Phone: the chat's controls stay on one row that scrolls sideways instead of piling up */
@media (max-width: 760px) {
  .chat-head { gap: 8px; padding: 10px 12px; }
  .chat-head .chat-who { flex: 1; min-width: 0; }
  .chat-head .chat-who strong, .chat-head .chat-who .bx-muted { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .chat-actions { flex-wrap: nowrap; overflow-x: auto; width: 100%; padding-bottom: 2px; scrollbar-width: none; }
  .chat-actions::-webkit-scrollbar { display: none; }
  .chat-actions > * { flex: none; }
}
.tbl .access-row td { background: var(--surface-2); text-align: left; font-family: var(--bx-font-body); font-variant-numeric: normal; }
.access-box { display: grid; gap: 10px; padding: 6px 2px; justify-items: start; }
.access-box p { margin: 0; }
.access-list { display: flex; flex-wrap: wrap; gap: 8px 18px; }

/* single sign-on */
.sso-btn { justify-content: center; padding: 12px; font-size: 15px; width: 100%; margin-top: 8px; }
.sso-step p { margin: 4px 0 6px; }
.copy-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.copy-row code, .dns-rec code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; background: var(--surface-2, rgba(127,127,127,.12)); padding: 4px 8px; border-radius: 6px; word-break: break-all; }
.sso-domains { gap: 10px; }
.sso-domain { display: grid; gap: 8px; padding: 10px 0; }
.sso-domain .row-gap { flex-wrap: wrap; align-items: center; }
.dns-rec { display: grid; gap: 4px; }
.plan-note { margin: 0; font-weight: 600; }
.bx-btn-danger-ghost { color: var(--danger); }
.simple-list .sso-domain { display: grid; grid-template-columns: minmax(0, 1fr); justify-content: stretch; }
#ssoDomainForm { display: flex; gap: 8px; flex-wrap: wrap; }
#ssoDomainForm .bx-input { flex: 1 1 220px; min-width: 0; }

/* CRM */
.crm-links { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0 4px; }
.region-note { margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--surface-2, rgba(127,127,127,.1)); font-weight: 600; }
.sp-row { display: grid; gap: 4px; }
.sp-row > span { font-size: 13px; font-weight: 600; }
.mono-input { width: 100%; font: 12.5px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: 0; }

/* password reset & email confirmation */
.link-btn { background: none; border: 0; padding: 0; color: var(--fg); text-decoration: underline; cursor: pointer; font: inherit; font-size: 13.5px; }
.forgot-link { justify-self: end; margin-top: -6px; }
.verify-banner button { font-size: 13.5px; font-weight: 700; text-decoration: underline; opacity: 1; white-space: nowrap; }
.plan-banner.verify-banner { top: auto; bottom: 16px; }
@media (max-width: 760px) { .plan-banner.verify-banner { bottom: 84px; } }

/* WhatsApp broadcasts */
.bc-audience { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px 4px; margin: 0; }
.bc-audience legend { font-weight: 700; padding: 0 6px; }
.bc-count { margin: 0 0 8px; font-weight: 600; }
.bc-test { padding-top: 8px; border-top: 1px dashed var(--line); }
.bc-test .bx-input { flex: 1 1 220px; min-width: 0; }
.bc-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.bc-stat { background: var(--surface-2, rgba(127,127,127,.08)); border-radius: 12px; padding: 12px; display: grid; gap: 2px; }
.bc-stat b { font-size: 22px; font-family: var(--bx-font-display, inherit); }
.bc-stat span { font-size: 12.5px; color: var(--muted); }
#view-broadcasts > * { flex-shrink: 0; } /* the page scrolls; sections keep their height */

/* WhatsApp message templates */
.bc-tabs { align-self: flex-start; width: auto; }
.tpl-bar { display: flex; justify-content: space-between; align-items: end; gap: 12px; flex-wrap: wrap; }
.tpl-bar .bx-field { min-width: 220px; }
.tpl-waba .grow { flex: 1 1 280px; }
.tpl-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.tpl-item { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: grid; gap: 6px; }
.tpl-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tpl-head code { font: 600 13px ui-monospace, SFMono-Regular, Menlo, monospace; }
.tpl-head .bx-btn { margin-left: auto; }
.tpl-body { margin: 0; white-space: pre-wrap; line-height: 1.45; }
.tpl-status { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; text-transform: capitalize; }
.tpl-status.ok { background: color-mix(in srgb, var(--ok, #1a9e5c) 16%, transparent); color: var(--ok, #1a9e5c); }
.tpl-status.wait { background: color-mix(in srgb, #F79F1A 20%, transparent); color: #b56d00; }
.tpl-status.bad { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.tpl-form { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; align-items: start; }
@media (max-width: 860px) { .tpl-form { grid-template-columns: minmax(0, 1fr); } }
.wa-preview { background: #e7ddd3; border-radius: 14px; padding: 18px 14px; position: sticky; top: 12px; display: grid; gap: 6px; }
:root[data-theme="dark"] .wa-preview { background: #1d2a2f; }
.wa-bubble { background: #fff; color: #111113; border-radius: 10px 10px 10px 2px; padding: 8px 10px; display: grid; gap: 4px; box-shadow: 0 1px 1px rgba(0,0,0,.12); }
.wa-bubble p { margin: 0; white-space: pre-wrap; font-size: 14px; line-height: 1.4; }
.wa-bubble small { color: #6b6b73; }
.wa-buttons { display: grid; gap: 4px; }
.wa-buttons span { background: #fff; color: #0b84c6; text-align: center; border-radius: 10px; padding: 7px; font-weight: 600; font-size: 14px; }
.bc-tpl-preview { background: var(--surface-2, rgba(127,127,127,.08)); border-radius: 12px; padding: 10px 12px; display: grid; gap: 4px; }
.bc-tpl-preview p { margin: 0; white-space: pre-wrap; }

/* WhatsApp product catalogue */
.wa-prod { cursor: pointer; }
.wa-prod input { flex: none; width: 16px; height: 16px; accent-color: var(--red, #FF0103); }
.wa-send-bar { display: flex; gap: 8px; padding-top: 8px; border-top: 1px solid var(--line); margin-top: 6px; }
.wa-send-bar[hidden] { display: none; }
.wa-send-bar .bx-input { flex: 1; min-width: 0; }
.wa-prod-cards { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; margin-top: 4px; max-width: 100%; }
.wa-prod-card { display: grid; gap: 2px; width: 120px; padding: 6px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font-size: 12px; }
.wa-prod-card img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px; background: var(--surface-2); }
.wa-prod-card b { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ref-prod { font-size: 12px; color: var(--muted); margin-top: 4px; }
.m .b.has-order { padding: 0; background: none; border: 0; }
.order-card { min-width: 220px; max-width: 320px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); overflow: hidden; text-align: left; color: var(--fg); }
.order-card .oc-head { font-weight: 700; padding: 8px 12px; background: color-mix(in srgb, #F79F1A 14%, var(--surface)); }
.order-card ul { list-style: none; margin: 0; padding: 6px 12px; display: grid; gap: 4px; }
.order-card li, .order-card .oc-total { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.order-card .oc-price { color: var(--muted); white-space: nowrap; }
.order-card .oc-total { padding: 8px 12px; border-top: 1px solid var(--line); }
.order-card .oc-note { padding: 0 12px 8px; font-size: 12px; color: var(--muted); }
.cat-info { margin: 0; font-size: 13px; }
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.cat-card { display: grid; gap: 3px; align-content: start; padding: 8px; border: 1px solid var(--line); border-radius: 12px; min-width: 0; }
.cat-card img, .cat-card .img-ph { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; background: var(--surface-2); display: block; }
.cat-card b { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-card .mono { font-family: ui-monospace, monospace; font-size: 11px; overflow: hidden; text-overflow: ellipsis; }
.cat-card .tpl-status { justify-self: start; }
.cat-card .tpl-status { text-transform: none; }

/* Instagram stories, shares, reactions, unsent */
.m .story-tag, .m .shared-tag { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.m .shared-tag { margin: 4px 0 0; }
.m .b.has-story { display: grid; gap: 6px; }
.m .story-media img, .m .story-media video { display: block; width: 140px; aspect-ratio: 9 / 16; object-fit: cover; border-radius: 10px; background: var(--surface-2); }
.m .story-gone { width: 140px; aspect-ratio: 9 / 16; border-radius: 10px; border: 1px dashed var(--line); display: grid; place-items: center; text-align: center; padding: 10px; font-size: 12px; color: var(--muted); }
.m .b.unsent { font-style: italic; color: var(--muted); background: transparent; border: 1px dashed var(--line); }
.m .react { display: inline-block; margin-top: -6px; font-size: 14px; line-height: 1; padding: 3px 6px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); position: relative; z-index: 1; }
.m.agent .react, .m.bot .react { align-self: flex-end; }
.m .react { width: max-content; align-self: flex-start; justify-self: start; }
.m.agent .react, .m.bot .react { align-self: flex-end; justify-self: end; }

/* Flow block analytics */
.fe-stats-on { white-space: nowrap; }
.fe-statsbar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; padding: 8px 14px; border-bottom: 1px solid var(--line); background: var(--surface); font-size: 13px; }
.fe-statsbar[hidden] { display: none; }
.fe-statsbar .fs-item b { font-size: 15px; }
.fe-statsbar .fs-item.bad b { color: var(--danger); }
.fe-statsbar .fs-worst { border: 1px solid color-mix(in srgb, var(--danger) 40%, var(--line)); background: color-mix(in srgb, var(--danger) 8%, transparent); color: var(--fg); border-radius: 999px; padding: 3px 10px; font: inherit; font-size: 12px; cursor: pointer; }
.fe-statsbar .fs-since { margin-left: auto; }
.fn .fn-stat { display: flex; flex-wrap: wrap; gap: 2px 8px; padding: 4px 10px 6px; font-size: 11px; color: var(--muted); border-top: 1px dashed var(--line); }
.fn .fn-stat span:first-child { color: var(--fg); font-weight: 700; }
.fn .fn-stat .fs-bad { color: var(--danger); font-weight: 600; }
.fn.fn-drop { box-shadow: 0 0 0 2px color-mix(in srgb, var(--danger) 55%, transparent), var(--shadow); }
.fn .fn-pc { font-size: 10px; font-weight: 700; color: var(--muted); margin-left: auto; padding-right: 4px; white-space: nowrap; }
.edge-unused { stroke-dasharray: 4 4; opacity: .55; }
#feStatsDays { width: auto; flex: none; min-width: 0; }

/* Contact segments */
.seg-select { max-width: 260px; }
.seg-actions { align-items: center; flex-wrap: wrap; }
.seg-actions[hidden], .seg-builder[hidden] { display: none; }
.seg-builder { margin-bottom: 12px; flex-shrink: 0; }
.seg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px 14px; }
.seg-has { display: flex; flex-wrap: wrap; gap: 4px 14px; padding-top: 6px; }
.seg-field { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.seg-field .bx-select { width: auto; }
.seg-field .bx-input { flex: 1; min-width: 140px; }
.seg-field [hidden] { display: none; }
.seg-foot { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 12px; }
.seg-foot .bx-input { flex: 1; min-width: 220px; }
.seg-foot b { min-width: 150px; }
.danger-text { color: var(--danger); }

/* Call recording */
.cp-rec { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: #fff; background: rgba(255, 1, 3, .85); border-radius: 999px; padding: 2px 9px; margin-left: 8px; }
.cp-rec[hidden] { display: none; }
.cp-rec i { width: 7px; height: 7px; border-radius: 50%; background: #fff; animation: bxrec 1.2s infinite; }
.cp-rec.off { background: rgba(120, 120, 120, .8); }
.cp-rec.off i { animation: none; }
@keyframes bxrec { 50% { opacity: .25; } }
.cp-rec { align-self: flex-start; width: max-content; }
.m .rec-label { font-size: 12px; font-weight: 600; margin-bottom: 6px; }

/* Legal links, workspace deletion */
.legal-links { color: var(--muted); }
.legal-links a, .auth-legal a, .auth-foot a { color: inherit; }
.auth-legal { font-size: 13px; text-align: center; margin: 4px 0 0; }
.auth-foot { font-size: 12.5px; text-align: center; color: var(--muted); margin: 8px 0 0; }
.danger-card { border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); }
.danger-card h3 { color: var(--danger); }
.danger-card .bx-btn-danger { background: #C20003; color: #fff; border-color: #C20003; }
.danger-card .bx-btn-danger:disabled { opacity: .45; }
.hm-grid > .hm-row { display: contents; }

/* Accessibility */
.skip-link { position: fixed; top: 8px; left: 8px; z-index: 1000; background: var(--fg); color: var(--bg); padding: 10px 14px; border-radius: 10px; font-weight: 700; text-decoration: none; transform: translateY(-200%); }
.skip-link:focus { transform: none; }
/* Reflow at 320 px (WCAG 1.4.10): the bottom bar scrolls sideways instead of pushing the page wider; banners wrap */
@media (max-width: 420px) {
  .rail { justify-content: flex-start; overflow-x: auto; gap: 0; scrollbar-width: none; }
  .rail > * { flex: 0 0 auto; }
  .plan-banner { flex-wrap: wrap; }
  .plan-banner button, .plan-banner a { margin-left: auto; }
}

/* Email sender checks */
.m .auth-line { font-size: 12px; color: var(--muted); margin-top: 4px; max-width: 520px; }
.m .auth-line.ok { color: var(--ok-ink); }
.m .auth-line.bad { color: var(--red-text); font-weight: 600; background: color-mix(in srgb, var(--danger) 8%, transparent); border-radius: 8px; padding: 6px 9px; }

/* Confirm it's you */
.reauth-dlg { border: 1px solid var(--line); border-radius: 16px; padding: 22px; width: min(420px, calc(100vw - 32px)); background: var(--surface); color: var(--fg); box-shadow: var(--shadow); }
.reauth-dlg::backdrop { background: rgba(17, 17, 19, .45); }
.reauth-dlg h2 { margin: 0; font-size: 20px; }

/* ---------- Help center (M24) ---------- */
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.help-off { display: flex; gap: 12px 20px; align-items: center; justify-content: space-between; flex-wrap: wrap; border-color: color-mix(in srgb, var(--bx-orange) 45%, var(--line)); background: color-mix(in srgb, var(--bx-orange) 8%, var(--surface)); }
.help-off > div { max-width: 70ch; }
.help-tools { display: flex; gap: 8px; flex-wrap: wrap; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.help-tools .bx-input { flex: 1 1 220px; min-width: 0; }
.help-tools .bx-select { flex: 0 1 180px; }
.help-tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.help-row { cursor: pointer; }
.help-row:hover td, .help-row:focus-visible td { background: var(--surface-2); }
.help-row:focus-visible { outline: 2px solid var(--bx-red-ink); outline-offset: -2px; }
.help-t { font-weight: 700; }
.help-x { color: var(--muted); font-size: 13px; max-width: 56ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.help-cat-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.help-cat { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) auto auto auto auto; gap: 8px; align-items: center; }
.help-cat-add { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) auto; gap: 8px; }
@media (max-width: 760px) { .help-cat, .help-cat-add { grid-template-columns: 1fr 1fr; } .help-cat .bx-input, .help-cat-add .bx-input { grid-column: 1 / -1; } }
.help-editor { display: flex; flex-direction: column; gap: 12px; min-height: calc(100vh - 60px); }
.he-title { flex: 1 1 320px; min-width: 0; font-weight: 700; font-size: 16px; }
.he-url { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 14px; }
.he-url a { color: var(--red-text); word-break: break-all; }
.he-panes { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; flex: 1; min-height: 0; }
.he-write { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.he-tools { display: flex; gap: 4px; flex-wrap: wrap; }
.he-tools button { border: 1px solid var(--line); background: var(--surface); color: var(--fg); font: inherit; font-size: 13px; padding: 5px 10px; border-radius: 8px; cursor: pointer; }
.he-tools button:hover { border-color: var(--fg); }
.he-tools button:focus-visible { outline: 2px solid var(--bx-red-ink); outline-offset: 1px; }
.he-body { flex: 1; min-height: 420px; resize: vertical; font: 15px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; padding: 14px; }
.he-count { text-align: right; }
.he-preview { background: var(--surface); border: 1px solid var(--line); border-radius: var(--bx-r-lg); padding: 18px 22px; overflow: auto; max-height: calc(100vh - 170px); min-width: 0; }
.he-preview h1 { font-size: 26px; line-height: 1.2; margin: 6px 0 14px; }
.he-content { font-size: 15.5px; line-height: 1.65; }
.he-content h2 { font-size: 20px; margin: 24px 0 6px; } .he-content h3 { font-size: 17px; margin: 18px 0 4px; } .he-content h4 { font-size: 15px; margin: 14px 0 4px; }
.he-content img { max-width: 100%; border-radius: 10px; border: 1px solid var(--line); }
.he-content pre { background: var(--surface-2); padding: 10px 12px; border-radius: 8px; overflow-x: auto; }
.he-content code { background: var(--surface-2); padding: 1px 5px; border-radius: 5px; font-size: .92em; } .he-content pre code { background: none; padding: 0; }
.he-content blockquote { margin: 12px 0; padding: 8px 14px; border-left: 4px solid var(--line); background: var(--surface-2); border-radius: 0 8px 8px 0; }
.he-content blockquote.tip, .he-content blockquote.note { border-left-color: var(--ok); } .he-content blockquote.warning, .he-content blockquote.important { border-left-color: var(--bx-orange); }
.he-content a { color: var(--red-text); }
@media (max-width: 900px) { .he-panes { grid-template-columns: 1fr; } .he-preview { max-height: none; } }
.gap-btns { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.help-editor .fe-bar .bx-select { width: auto; flex: 0 0 auto; }
.help-editor .fe-bar .he-title { width: auto; }
/* teammate on the same chat */
.collision { margin: 0 16px 6px; padding: 7px 12px; border-radius: 10px; font-size: 13px; font-weight: 600; background: var(--surface-2); color: var(--muted); display: flex; gap: 8px; align-items: center; }
.collision::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none; }
.collision.writing { background: var(--glow-soft); color: var(--warn-ink); }
.collision.writing::before { background: var(--bx-orange); animation: bxpulse 1.2s ease-in-out infinite; }
@keyframes bxpulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .collision.writing::before { animation: none; } }
/* snooze */
.snooze-pop { position: absolute; z-index: 30; top: 52px; right: 16px; width: 290px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--bx-r-lg); box-shadow: var(--shadow); padding: 12px; display: grid; gap: 8px; }
.snooze-pop[hidden] { display: none; }
.sp-title { font-weight: 700; font-size: 14px; }
.sp-opts { display: grid; gap: 4px; }
.sp-opt { display: flex; justify-content: space-between; gap: 8px; width: 100%; border: 1px solid var(--line); background: var(--surface); color: var(--fg); border-radius: 10px; padding: 8px 10px; font: inherit; font-size: 14px; cursor: pointer; text-align: left; }
.sp-opt:hover, .sp-opt:focus-visible { border-color: var(--fg); outline: none; }
.sp-custom { display: grid; gap: 4px; font-size: 13px; font-weight: 600; }
.sp-actions { display: flex; justify-content: flex-end; gap: 6px; }
.snooze-pop p { margin: 0; }
.chat-head { position: relative; }
/* duplicate contacts */
.dup-banner { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 10px 14px; border-radius: var(--bx-r); background: var(--glow-soft); color: var(--warn-ink); font-weight: 600; font-size: 14px; }
.dup-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.dup-pair { border: 1px solid var(--line); border-radius: var(--bx-r-lg); padding: 12px; display: grid; gap: 10px; }
.dup-why { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.dup-sides { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 700px) { .dup-sides { grid-template-columns: 1fr; } }
.dup-side { display: flex; gap: 10px; align-items: flex-start; border: 1.5px solid var(--line); border-radius: var(--bx-r); padding: 10px 12px; cursor: pointer; min-width: 0; }
.dup-side > div { min-width: 0; } .dup-side .sub { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.dup-side input { margin-top: 3px; accent-color: var(--bx-red-ink); }
.dup-side .keep-tag { display: none; margin-top: 4px; font-size: 11px; font-weight: 700; color: var(--ok-ink); }
.dup-side:has(input:checked) { border-color: var(--fg); } .dup-side:has(input:checked) .keep-tag { display: inline-block; }
.dup-acts { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.merge-results li { gap: 8px; }
.bx-toast-link { display: flex; gap: 12px; align-items: center; }
.bx-toast-link button { border: 0; background: #fff; color: #111113; font: inherit; font-weight: 700; padding: 4px 12px; border-radius: 8px; cursor: pointer; }
.bx-toast-link button:focus-visible { outline: 2px solid var(--bx-orange); outline-offset: 2px; }
.sv-ch { border: 0; padding: 0; margin: 0; display: grid; gap: 6px; } .sv-ch legend { font-weight: 600; font-size: 13px; margin-bottom: 4px; padding: 0; }
.sla-warn { max-width: 420px; }
/* customer feedback in analytics */
.fb-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.fb-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 10px 0; border-top: 1px solid var(--line); }
.fb-item:first-child { border-top: 0; }
.fb-score { font-family: var(--bx-font-tech); font-weight: 700; font-size: 15px; min-width: 42px; text-align: center; padding: 6px 0; border-radius: 8px; background: var(--surface-2); }
.fb-score.low { background: color-mix(in srgb, var(--danger) 14%, transparent); color: color-mix(in srgb, var(--danger) 72%, var(--fg)); }
.fb-score.high { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok-ink); }
.fb-text { overflow-wrap: anywhere; } .fb-meta { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
/* macros and conversation fields */
.macro-pop { position: absolute; bottom: calc(100% + 6px); left: 12px; z-index: 25; width: min(360px, calc(100% - 24px)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--bx-r-lg); box-shadow: var(--shadow); padding: 10px; display: grid; gap: 8px; max-height: 360px; }
.macro-pop[hidden] { display: none; }
.macro-list { list-style: none; margin: 0; padding: 0; overflow: auto; display: grid; gap: 4px; }
.macro-item { display: grid; gap: 2px; width: 100%; text-align: left; border: 1px solid transparent; background: none; color: var(--fg); border-radius: 10px; padding: 8px 10px; font: inherit; cursor: pointer; }
.macro-item:hover, .macro-item:focus-visible { background: var(--surface-2); border-color: var(--line); outline: none; }
.macro-item span { font-size: 12.5px; color: var(--muted); }
.composer { position: relative; }
.conv-fields { gap: 10px; margin-bottom: 8px; }
.conv-fields [aria-invalid="true"] { border-color: var(--bx-orange); }
.cf-row { display: grid; grid-template-columns: minmax(0, 1.4fr) 140px minmax(0, 1.2fr) auto auto; gap: 8px; align-items: center; }
.cf-row .bx-input[hidden] { display: block; visibility: hidden; }
@media (max-width: 760px) { .cf-row { grid-template-columns: 1fr 1fr; } .cf-row > :first-child { grid-column: 1 / -1; } }
.mc-editor { border-top: 1px solid var(--line); padding-top: 14px; }
.mc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr)); gap: 10px; }
.sub-h { font-weight: 700; font-size: 13px; }
.fm-item a { color: var(--red-text); font-size: 13px; word-break: break-all; }
.fm-item { align-items: flex-start; flex-wrap: wrap; }
/* automation rules */
.au-cond { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.3fr) auto; gap: 8px; align-items: center; }
.au-val > * { width: 100%; }
@media (max-width: 760px) { .au-cond { grid-template-columns: 1fr 1fr; } }
.au-tpls { display: flex; flex-wrap: wrap; gap: 8px; }
#fieldFilter, #fieldValue, #fieldValueSel { min-width: 0; }
.field-filter-row.one { grid-template-columns: 1fr; }
.filter-row .bx-input { padding: 8px; font-size: 13px; }
.au-preview { background: var(--surface-2); border-radius: var(--bx-r); padding: 12px 14px; display: grid; gap: 6px; font-size: 14px; }
.au-samples { margin: 0; padding-left: 18px; display: grid; gap: 3px; } .au-samples a { color: var(--red-text); }
.au-log { list-style: none; margin: 0; padding: 0; display: grid; }
.au-log-item { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.au-log-item:first-child { border-top: 0; } .au-log-item .sub { color: var(--muted); font-size: 12.5px; overflow-wrap: anywhere; }
/* Import from another tool */
.imp-dlg { border: 1px solid var(--line); border-radius: 16px; padding: 0; width: min(760px, calc(100vw - 24px)); max-height: calc(100vh - 32px); background: var(--surface); color: var(--fg); box-shadow: var(--shadow); }
.imp-dlg[open] { display: flex; flex-direction: column; }
.imp-dlg::backdrop { background: rgba(17, 17, 19, .45); }
.imp-head { display: flex; justify-content: space-between; gap: 12px; padding: 18px 20px 12px; border-bottom: 1px solid var(--line); }
.imp-head h2 { font-size: 20px; margin: 0; }
.imp-body { padding: 14px 20px; overflow: auto; display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.imp-body > * { min-width: 0; }
.imp-head > .bx-btn { align-self: flex-start; }
.imp-body h3 { font-size: 15px; margin: 4px 0 0; }
.imp-summary { margin: 0; font-weight: 600; }
.imp-cols-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--bx-r); }
.imp-cols { width: 100%; border-collapse: collapse; font-size: 14px; }
.imp-cols th, .imp-cols td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.imp-cols thead th { font-size: 12px; color: var(--muted); font-weight: 600; background: var(--surface-2); }
.imp-cols tbody th { font-weight: 600; white-space: nowrap; }
.imp-cols td:nth-child(2) { color: var(--muted); max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.imp-cols tr:last-child > * { border-bottom: 0; }
.imp-cols .bx-select { min-width: 170px; padding: 6px 8px; }
.imp-consent { align-items: flex-start; }
.imp-consent input { margin-top: 0; flex: none; width: 24px; height: 24px; }
.imp-arts, .imp-history { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.imp-arts li { display: grid; gap: 2px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--bx-r); }
.imp-history li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.imp-history li > div { display: grid; gap: 2px; min-width: 0; }
.imp-status { border: 0; padding: 0; margin: 0; display: grid; gap: 6px; }
.imp-status legend { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.imp-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--line); }
@media (max-width: 560px) {
  .imp-cols th:nth-child(2), .imp-cols td:nth-child(2) { display: none; }
  .imp-cols .bx-select { min-width: 0; width: 100%; }
  .imp-head, .imp-body, .imp-foot { padding-left: 16px; padding-right: 16px; }
}
.imported-note { margin: 0 16px 8px; padding: 8px 12px; border-radius: var(--bx-r); background: var(--surface-2); color: var(--muted); font-size: 13px; }
.imp-chats { display: grid; gap: 10px; }
.imp-chat { border: 1px solid var(--line); border-radius: var(--bx-r); padding: 10px 12px; display: grid; gap: 6px; }
.imp-chat-head { font-weight: 700; font-size: 14px; }
.imp-msg { display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 8px; font-size: 14px; }
.imp-msg b { font-weight: 600; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.imp-msg span { white-space: pre-wrap; overflow-wrap: anywhere; }
.imp-msg.note span { color: var(--warn-ink); }
/* Right-to-left dashboard (Arabic): what customers and teammates wrote keeps its own direction, so English
   messages, order numbers, #tags and times read correctly, and Arabic messages read right to left */
[dir="rtl"] :is(#msgs, #convList, #chatName, #chatSub, #chatSubject, #infoList, #tagBox, #ordersOut, #summaryOut) :is(div, span, p, li, a, strong, b, em, small, td, th, time),
[dir="rtl"] :is(#chatName, #chatSub, #chatSubject) { unicode-bidi: plaintext; }
[dir="rtl"] #reply, [dir="rtl"] #search { unicode-bidi: plaintext; }
[dir="rtl"] .bx-wordmark, [dir="rtl"] .rail-mark { direction: ltr; unicode-bidi: isolate; } /* the brand name always reads "Bynix Chat" */
/* on the selected conversation's darker row, red tags sit on the card colour so they keep 4.5:1 contrast */
.conv.on .bx-pill-red { background: var(--surface); }
/* Devanagari and Arabic letters join: no letter-spacing or Latin-only display face on small labels */
:root:is([lang="hi"], [lang="ar"]) :is(.bx-eyebrow, .eyebrow, th, .tbl th) { letter-spacing: 0; font-family: var(--bx-font-body); text-transform: none; }
[dir="rtl"] :is(#channelList, #teamList, #deptList, #sessList, #auditTbl, #ssoDomains, #contactRows, #visitorRows, #helpRows, #clientTbl) :is(div, span, strong, b, td, li, code, label) { unicode-bidi: plaintext; }
/* flow builder and broadcasts: bot messages, button names, template texts and products keep their own direction */
[dir="rtl"] :is(.fn-b, .fn-port span, .fs-worst, #feInspector input, #feInspector textarea, #feInspector option, #bcTplPreview *, .wa-bubble *, .wa-buttons span, .tpl-body, .tpl-item b, .tpl-item small, .cat-card b, #bcRows strong, #bcDetail h3, #bcCount span, #bcVars input, #bcForm input, #bcForm textarea, #tplForm input, #tplForm textarea) { unicode-bidi: plaintext; }
/* help article editor: earlier versions */
.he-vlist { max-height: 260px; overflow: auto; }
.he-v { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.he-v > div { min-width: 0; }
.he-v-t { font-weight: 700; overflow-wrap: anywhere; }
.he-vview { border-top: 1px solid var(--line); padding-top: 14px; display: grid; gap: 10px; }
.he-vview .he-content { max-height: 360px; overflow: auto; border: 1px solid var(--line); border-radius: var(--bx-r); padding: 12px 16px; }
.he-vview .he-content:focus-visible { outline: 2px solid var(--bx-red-ink); outline-offset: 1px; }
