/* =========================================================
   Wasilbox app — tokens
   ========================================================= */
:root {
  --ink: #1b1b1f;
  --ink-2: #4a4a50;
  --muted: #6e6e74;   /* v37 (QA WB5-18): 4.63:1 on the page, 5.07:1 on white (#74747a was 4.24:1 — under AA's 4.5:1) */
  --line: #e3e3de;
  --canvas: #f5f5f1;
  --surface: #ffffff;
  --dark: #1e1c19;
  --dark-2: #2a2723;
  --dark-line: #3a3630;
  --lime: #d4ec5a;
  --lime-ink: #22300a;
  --lime-soft: #f2f9cf;
  --red: #b03026;   /* v39 (QA WB6-26): 5.4:1 on --red-soft (was #c8372d, 4.43:1) */
  --red-soft: #fbe9e7;
    --r-sm: 8px; --r: 12px; --r-lg: 18px;
  --shadow: 0 1px 2px rgba(27,27,31,.06), 0 8px 24px -12px rgba(27,27,31,.18);
  --font: 'IBM Plex Sans Arabic', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font); color: var(--ink); background: var(--canvas);
  font-size: 15px; line-height: 1.55; -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; line-height: 1.25; letter-spacing: -0.01em; }
h1 { font-size: 26px; font-weight: 600; }
h2 { font-size: 17px; font-weight: 600; margin-bottom: 12px; }
p { margin: 0; }
a { color: inherit; }
code { font-family: ui-monospace, Menlo, monospace; font-size: 13px; background: var(--canvas); padding: 2px 6px; border-radius: 6px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.lead { color: var(--ink-2); margin: 6px 0 22px; max-width: 60ch; }
.center { text-align: center; }
.link { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--lime); text-decoration-thickness: 2px; }
.link:hover { text-decoration-color: var(--ink); }
.row { display: flex; align-items: center; }
.row.gap { gap: 8px; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.grid-2 > * { min-width: 0; }   /* v33 (QA WB3-06): a long word or name never widens the page (computers too) */
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }

/* boot */
.boot { min-height: 100vh; display: grid; place-items: center; }
.boot-mark { width: 28px; height: 28px; border-radius: 8px; background: var(--lime); animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(.8); opacity: .6; } }

/* =========================================================
   Controls
   ========================================================= */
.btn {
  appearance: none; border: 1px solid transparent; border-radius: var(--r-sm); padding: 10px 16px;
  font: inherit; font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  text-decoration: none; transition: background .15s, border-color .15s, transform .05s; white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--lime); color: var(--lime-ink); }
.btn-primary:hover:not(:disabled) { background: #c9e347; }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover:not(:disabled) { background: var(--surface); border-color: #cfcfc9; }
.btn-ghost.danger { color: var(--red); }
.btn-danger { background: var(--red); color: #fff; }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 10px; font-size: 13px; }
.is-busy { position: relative; color: transparent !important; }
.is-busy::after { content: ''; position: absolute; width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-color: var(--lime-ink) transparent var(--lime-ink) var(--lime-ink); animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.icon-btn { background: none; border: 0; font: inherit; font-size: 16px; cursor: pointer; color: var(--muted); padding: 6px; border-radius: 6px; }
.icon-btn:hover { background: var(--canvas); color: var(--ink); }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field-label { font-size: 13px; font-weight: 500; color: var(--ink-2); }
.field-hint { font-size: 12.5px; color: var(--muted); }
.input {
  font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); color: var(--ink);
  width: 100%; transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--ink); box-shadow: 0 0 0 3px var(--lime-soft); outline: none; }
.input:disabled { background: var(--canvas); color: var(--ink-2); }
.input-sm { padding: 6px 8px; font-size: 13px; width: auto; }
select.input { padding-inline-end: 28px; }
.form-row-end { display: flex; justify-content: flex-end; margin: -6px 0 14px; }
.form-error { background: var(--red-soft); color: var(--red); padding: 10px 12px; border-radius: var(--r-sm); font-size: 14px; margin-bottom: 14px; }
.form-notice { background: var(--lime-soft); color: var(--lime-ink); padding: 10px 12px; border-radius: var(--r-sm); font-size: 14px; margin-bottom: 14px; }

/* =========================================================
   Auth — light, centered
   ========================================================= */
.auth {
  min-height: 100vh; display: flex; flex-direction: column;
  background:
    radial-gradient(60% 40% at 50% -5%, rgba(212,236,90,.45), transparent 70%),
    var(--canvas);
}
.auth-top { display: flex; justify-content: space-between; align-items: center; padding: 22px 28px; }
.wordmark { font-weight: 700; font-size: 22px; letter-spacing: -0.02em; color: var(--ink); text-decoration: none; display: inline-flex; align-items: center; gap: 8px; }
.wordmark.small { font-size: 18px; }
.mark { width: 22px; height: 22px; border-radius: 6px; background: var(--lime); position: relative; }
.mark::before { content: ''; position: absolute; inset: 6px; border-radius: 3px; border: 2px solid var(--lime-ink); opacity: .7; }
.auth-main { flex: 1; display: grid; place-items: start center; padding: 24px 16px 48px; }
.auth-card { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 32px; box-shadow: var(--shadow); }
.auth-card h1 { margin-bottom: 6px; }
.auth-sub { color: var(--muted); margin-bottom: 22px; font-size: 14px; }
.auth-foot { margin-top: 18px; text-align: center; color: var(--ink-2); font-size: 14px; }
.lang-btn { background: none; border: 1px solid var(--dark-line); color: #d9d6cf; border-radius: 999px; padding: 4px 12px; font: inherit; font-size: 13px; cursor: pointer; }
.lang-btn.subtle { align-self: flex-start; }

/* centered pages (onboarding / invite) */
.center-page { min-height: 100vh; display: grid; place-items: center; padding: 32px 16px; }
.onb-card { width: 100%; max-width: 520px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 32px; box-shadow: var(--shadow); }
.onb-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 28px; }

/* =========================================================
   Shell
   ========================================================= */
.shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.sidebar { background: var(--dark); color: #d9d6cf; display: flex; flex-direction: column; padding: 14px; position: sticky; top: 0; height: 100vh; }
.org-switch { position: relative; margin-bottom: 18px; }
.org-btn {
  width: 100%; display: flex; align-items: center; gap: 10px; background: var(--dark-2); border: 1px solid var(--dark-line); color: #f4f2ec;
  padding: 8px 10px; border-radius: var(--r-sm); font: inherit; cursor: pointer; text-align: start;
}
.org-mark { width: 30px; height: 30px; border-radius: 8px; background: var(--lime); color: var(--lime-ink); font-weight: 700; font-size: 12px; display: grid; place-items: center; flex: none; }
.org-name { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.org-caret { color: #9a968e; }
.menu { position: absolute; top: calc(100% + 6px); inset-inline: 0; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--r-sm); box-shadow: var(--shadow); padding: 6px; z-index: 20; display: flex; flex-direction: column; }
.menu-item { display: flex; justify-content: space-between; align-items: center; gap: 8px; width: 100%; text-align: start; background: none; border: 0; font: inherit; padding: 8px 10px; border-radius: 6px; cursor: pointer; text-decoration: none; color: inherit; }
.menu-item:hover { background: var(--canvas); }
.menu-item.active { background: var(--lime-soft); }
.menu-item small { color: var(--muted); }

.nav { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.nav-link { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--r-sm); color: #cfcbc2; text-decoration: none; position: relative; }
.nav-link:hover { background: var(--dark-2); color: #fff; }
.nav-link.active { background: var(--dark-2); color: #fff; }
.nav-link.active::before { content: ''; position: absolute; inset-inline-start: -14px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--lime); }
[dir='rtl'] .nav-link.active::before { border-radius: 3px 0 0 3px; }
.nav-icon { width: 20px; text-align: center; opacity: .8; }
.nav-link.is-soon { color: #7d7970; cursor: default; }
.soon { margin-inline-start: auto; font-size: 11px; background: var(--dark-2); color: #9a968e; padding: 1px 7px; border-radius: 999px; }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 12px; padding-top: 12px; border-top: 1px solid var(--dark-line); }
.user { display: flex; align-items: center; gap: 10px; }
.user-meta { flex: 1; display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.user-meta b { font-weight: 600; color: #f4f2ec; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.user-meta small { color: #9a968e; font-size: 12px; }
.sidebar .icon-btn { color: #9a968e; }
.sidebar .icon-btn:hover { background: var(--dark-2); color: #fff; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--lime-soft); color: var(--lime-ink); display: grid; place-items: center; font-weight: 600; font-size: 12px; flex: none; }
.sidebar .avatar { background: var(--dark-2); color: #f4f2ec; }

.content { padding: 36px 40px; }
.page { max-width: 880px; }
.page-head { margin-bottom: 26px; }
.page-head .muted { margin-top: 4px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 22px 24px; margin-bottom: 18px; }
.panel h2 + .panel h2 { margin-top: 20px; }
.kv { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.kv:last-child { border-bottom: 0; }
.pill { font-size: 12.5px; padding: 3px 10px; border-radius: 999px; background: var(--canvas); color: var(--ink-2); white-space: nowrap; }
.pill-owner { background: var(--lime); color: var(--lime-ink); }
.tag { font-size: 11px; margin-inline-start: 8px; padding: 1px 7px; border-radius: 999px; background: var(--lime-soft); color: var(--lime-ink); font-weight: 500; vertical-align: middle; }
.tag-off { background: var(--canvas); color: var(--muted); }

/* stats */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 18px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px 20px; display: flex; flex-direction: column; gap: 4px; }
.stat-num { font-size: 30px; font-weight: 600; letter-spacing: -0.02em; line-height: 1; }
.stat span { color: var(--muted); font-size: 13.5px; }

/* steps */
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.step { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.step:last-child { border-bottom: 0; }
.step-check { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line); flex: none; position: relative; }
.step.done .step-check { background: var(--lime); border-color: var(--lime); }
.step.done .step-check::after { content: ''; position: absolute; left: 6px; top: 2px; width: 5px; height: 10px; border: solid var(--lime-ink); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.step.is-soon { color: var(--muted); }
.step .soon { background: var(--canvas); color: var(--muted); }

/* lists */
.list { display: flex; flex-direction: column; }
.list-row { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: 0; }
.list-row.is-off > .avatar { opacity: .5; }   /* v39 (§9.4, axe): only the picture fades — a faded row's texts and buttons were 2.2–3.8:1; the "Disabled" tag says it */
.list-row b { display: block; font-weight: 600; }
.list-row small { display: block; }
.copy-box { display: flex; gap: 8px; align-items: center; background: var(--canvas); padding: 10px; border-radius: var(--r-sm); margin-bottom: 12px; }
.copy-box code { flex: 1; background: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* dialogs & toasts */
.overlay { position: fixed; inset: 0; background: rgba(27,27,31,.45); display: grid; place-items: center; padding: 16px; z-index: 50; }
.dialog { background: var(--surface); border-radius: var(--r-lg); padding: 24px; width: 100%; max-width: 380px; box-shadow: var(--shadow); max-height: 88vh; overflow-y: auto; }
.dialog-wide { max-width: 460px; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.dialog-head h2 { margin: 0; }
.dialog-msg { margin-bottom: 18px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.toasts { position: fixed; bottom: 20px; inset-inline-start: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 60; pointer-events: none;
  width: max-content; max-width: min(560px, calc(100vw - 32px)); align-items: center; }   /* v28.1 → v29: long messages get a readable box */
[dir='rtl'] .toasts { transform: translateX(50%); }
.toast { background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 20px; font-size: 14px; opacity: 0; transform: translateY(8px); transition: .2s; box-shadow: var(--shadow);
  max-width: 100%; overflow-wrap: anywhere; white-space: pre-line; }
/* v29 (QA #2): on phones the messages appear at the top, so a red error never covers the reply box */
@media (max-width: 640px) { .toasts { bottom: auto; top: calc(10px + env(safe-area-inset-top, 0px)); } .toast { transform: translateY(-8px); } }
.toast.in { opacity: 1; transform: none; }
.toast-err { background: var(--red); }

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 860px) {
  .auth-card { padding: 24px; }
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .sidebar-foot { margin-top: 12px; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .nav-link.active::before { display: none; }
  .content { padding: 20px 16px; }
  .stats { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }   /* v33 (QA WB3-06): a long line never widens the page */
  .list-row { flex-wrap: wrap; }
}

/* =========================================================
   Channels
   ========================================================= */
.connect-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 8px; }
.connect-card { display: flex; align-items: center; gap: 14px; border: 1px solid var(--line); border-radius: var(--r); padding: 16px; }
.connect-card.is-soon { opacity: .6; }
.btn-col { display: flex; flex-direction: column; gap: 8px; align-items: stretch; }
.connect-card small { display: block; }
.connect-card b { display: block; }
.plat { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-weight: 700; font-size: 11px; color: #fff; flex: none; }
.plat.lg { width: 44px; height: 44px; font-size: 13px; }
.plat-whatsapp { background: #25d366; } .plat-messenger { background: #1877f2; } .plat-instagram { background: #e1306c; }
.plat-facebook_comments { background: #1877f2; } .plat-instagram_comments { background: #e1306c; }
.pill-ok { background: var(--lime-soft); color: var(--lime-ink); }

/* =========================================================
   Inbox
   ========================================================= */
.content:has(.inbox) { padding: 0; }
.inbox { display: grid; grid-template-columns: 340px 1fr; height: 100vh; }
.inbox-side { border-inline-end: 1px solid var(--line); background: var(--surface); display: flex; flex-direction: column; min-height: 0; }
.inbox-top { padding: 20px 18px 10px; display: flex; flex-direction: column; gap: 10px; }
.inbox-top h1 { font-size: 20px; }

.tab { background: none; border: 0; font: inherit; font-size: 13.5px; padding: 6px 10px; border-radius: 999px; cursor: pointer; color: var(--muted); }
.tab.active { background: var(--ink); color: #fff; }
.conv-list { overflow-y: auto; flex: 1; }
.conv { display: flex; gap: 12px; align-items: center; padding: 12px 18px; text-decoration: none; color: inherit; border-bottom: 1px solid var(--line); }
.conv:hover { background: var(--canvas); }
.conv.active { background: var(--lime-soft); }
.conv.unread b { font-weight: 700; }
.conv .row { gap: 8px; }
.conv small { display: flex; align-items: center; gap: 6px; font-size: 12.5px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--muted); }
.dot-whatsapp { background: #25d366; } .dot-messenger, .dot-facebook_comments { background: #1877f2; } .dot-instagram, .dot-instagram_comments { background: #e1306c; }
.link.small { font-size: 12.5px; display: inline-block; margin-top: 4px; }
.badge { background: var(--lime); color: var(--lime-ink); font-size: 11px; font-weight: 700; min-width: 20px; height: 20px; border-radius: 999px; display: grid; place-items: center; padding: 0 6px; }
.pad { padding: 30px 18px; }
.inbox-main { display: flex; flex-direction: column; min-height: 0; background: var(--canvas); }
.inbox-main.empty { display: grid; place-items: center; }
.inbox-main[hidden] { display: none !important; }
.back { display: none; padding: 10px 16px; text-decoration: none; color: var(--ink-2); }
.thread { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.thread-head { display: flex; align-items: center; gap: 12px; padding: 14px 20px; background: var(--surface); border-bottom: 1px solid var(--line); }
.thread-head b { display: block; }
.msgs { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 8px; }
.msg { max-width: 70%; display: flex; flex-direction: column; gap: 3px; }
.msg-inbound { align-self: flex-start; }
.msg-outbound { align-self: flex-end; }
.msg-body { padding: 9px 13px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); word-break: break-word; white-space: pre-wrap; }
.msg-outbound .msg-body { background: var(--lime-soft); border-color: transparent; }
.msg-failed .msg-body { background: var(--red-soft); }
.msg-queued { opacity: .6; }
.msg-body p { margin: 0; }
.msg-meta { font-size: 11.5px; color: var(--muted); padding: 0 6px; }
.msg-outbound .msg-meta { text-align: end; }
.msg-err { color: var(--red); }
.media img, .media video { max-width: 100%; border-radius: 10px; display: block; margin-bottom: 4px; }
.composer { display: flex; gap: 8px; align-items: flex-end; padding: 12px 16px; background: var(--surface); border-top: 1px solid var(--line); }
.composer textarea { resize: none; }
.composer .form-notice, .composer > p { flex: 1; margin: 0; }

@media (max-width: 860px) {
  .connect-grid { grid-template-columns: 1fr; }
  .inbox { grid-template-columns: 1fr; height: auto; }
  .inbox.has-active .inbox-side { display: none; }
  .inbox-main { min-height: 70vh; }
  .back { display: block; }
  .msg { max-width: 88%; }
}

/* =========================================================
   Inbox v7 — filters, contact panel, chips, contacts table
   ========================================================= */
.filters { display: flex; flex-direction: column; gap: 8px; position: relative; }
.plat-row { display: flex; gap: 6px; flex-wrap: wrap; }
.plat-btn { display: inline-flex; align-items: center; gap: 5px; font: inherit; font-size: 12px; font-weight: 600; padding: 4px 9px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); cursor: pointer; }
.plat-btn small { font-size: 10px; }
.plat-btn.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.plat-btn.active .dot { outline: 2px solid #fff; }
.segmented { display: flex; background: var(--canvas); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.seg { flex: 1; background: none; border: 0; font: inherit; font-size: 13px; padding: 5px 8px; border-radius: 999px; cursor: pointer; color: var(--muted); }
.seg.active { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.active-filters { min-height: 22px; margin: 0; }
.chip-on { background: var(--lime-soft); border-color: transparent; color: var(--lime-ink); }
.filter-pop { position: absolute; top: 100%; inset-inline: 0; z-index: 25; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 14px; margin-top: 6px; }
.filter-pop .field { margin-bottom: 10px; }
.inbox-top { border-bottom: 1px solid var(--line); padding-bottom: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; padding: 1px 8px; border-radius: 999px; background: var(--canvas); color: var(--ink-2); border: 1px solid var(--line); }
.chip-x { background: none; border: 0; cursor: pointer; color: var(--muted); font-size: 13px; padding: 0 2px; line-height: 1; }
.chip-x:hover { color: var(--red); }
.inbox { grid-template-columns: 360px 1fr auto; }
.inbox-side { min-width: 0; }
.contact-panel { width: 320px; border-inline-start: 1px solid var(--line); background: var(--surface); padding: 18px; overflow-y: auto; height: 100vh; }
.contact-panel h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 18px 0 8px; }
.contact-panel .field { margin-bottom: 10px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.notes { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.note { background: var(--lime-soft); border-radius: var(--r-sm); padding: 8px 10px; }
.note p { white-space: pre-wrap; margin-bottom: 2px; }
.note-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; }   /* v35: + delete */
.note-del { width: 28px; height: 28px; font-size: 12px; flex: none; }
.media-load { white-space: normal; overflow-wrap: anywhere; text-align: start; max-width: 100%; }   /* v35: a long file name wraps */
.media .m-wait-box { width: 240px; max-width: 100%; aspect-ratio: 4 / 3; background: var(--canvas); border-radius: 8px; }   /* v35: a WhatsApp picture's box before it is fetched */
/* v35 (QA WB5-17): the inbox's heading for screen readers while a conversation is open on a phone (the list is hidden then) */
.thread-h1 { display: none; }
@media (max-width: 860px) { .inbox.has-active .thread-h1 { display: block; } }
.mini-conv { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; }
.mini-conv:last-child { border-bottom: 0; }
.thread-head .input-sm { width: auto; }
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; }
.toolbar .input { max-width: 320px; }
.table { display: flex; flex-direction: column; }
.trow { display: grid; grid-template-columns: 2fr 1.4fr 1.4fr .8fr 1fr; gap: 12px; align-items: center; padding: 10px 6px; border-bottom: 1px solid var(--line); cursor: pointer; }
.trow:hover { background: var(--canvas); }
.trow > * { min-width: 0; overflow-wrap: anywhere; }   /* v33: a very long name / address never widens the table */
.trow.thead { cursor: default; font-size: 12.5px; color: var(--muted); font-weight: 500; }
.trow.thead:hover { background: none; }
.trow b { font-weight: 600; }
.check { display: flex; align-items: center; gap: 8px; margin: 4px 0 14px; font-size: 14px; }
@media (max-width: 1100px) { .inbox { grid-template-columns: 320px 1fr; } .contact-panel { position: fixed; inset-inline-end: 0; top: 0; z-index: 30; box-shadow: var(--shadow); } }
@media (max-width: 860px) { .inbox { grid-template-columns: 1fr; } .contact-panel { width: 100%; } .trow { grid-template-columns: 1fr 1fr; } .trow.thead { display: none; } .trow span:nth-child(n+3) { display: none; } }

/* =========================================================
   v8 — dashboard, templates, broadcasts
   ========================================================= */
.page.wide { max-width: 1100px; }
.stats-6 { grid-template-columns: repeat(6, 1fr); }
.stats-5 { grid-template-columns: repeat(5, 1fr); }
.stat small { font-size: 12px; }
.chart { width: 100%; height: auto; display: block; margin-top: 8px; }
.legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-inline-end: 5px; vertical-align: middle; }
.hbars { display: flex; flex-direction: column; gap: 8px; }
.hbar { display: grid; grid-template-columns: 140px 1fr 40px; align-items: center; gap: 10px; font-size: 13.5px; }
.hbar-label { display: flex; align-items: center; gap: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-track { height: 8px; background: var(--canvas); border-radius: 999px; overflow: hidden; }
.hbar-fill { display: block; height: 100%; border-radius: 999px; }
.trow.t4 { grid-template-columns: 2fr 1fr 1fr 1fr 1fr; }
.trow.t3 { grid-template-columns: 1.5fr 1.2fr 1.5fr; }
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.tpl-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.wa-preview { background: #e7f5e2; border-radius: 12px; padding: 10px 12px; font-size: 14px; max-width: 320px; display: flex; flex-direction: column; gap: 6px; direction: rtl; }
[dir='ltr'] .wa-preview { direction: ltr; }
.wa-preview p { white-space: pre-wrap; }
.wa-preview .var { color: #0a7d5a; font-style: normal; background: #cfeee0; border-radius: 4px; padding: 0 3px; }
.wa-btns { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }
.wa-btn { text-align: center; background: #fff; color: #0a7dd8; border-radius: 8px; padding: 6px; font-weight: 500; }
.tpl-form .grid-2 { align-items: start; }
.pill-approved, .pill-completed, .pill-read, .pill-delivered { background: var(--lime-soft); color: var(--lime-ink); }
.pill-pending, .pill-scheduled, .pill-sending, .pill-queued { background: #fff4d6; color: #7a5200; }
.pill-rejected, .pill-failed, .pill-cancelled { background: var(--red-soft); color: var(--red); }
.link-row { text-decoration: none; color: inherit; }
.bc-mini { text-align: end; } .bc-mini b { font-size: 18px; }
.dialog-wide { max-width: 760px; }
h3 { font-size: 14px; margin: 14px 0 8px; }
@media (max-width: 860px) { .stats-6, .stats-5 { grid-template-columns: 1fr 1fr; } .hbar { grid-template-columns: 100px 1fr 36px; } .trow.t4, .trow.t3 { grid-template-columns: 1fr 1fr; } }

/* composer v8.2 */
.composer { flex-direction: column; align-items: stretch; gap: 6px; }
.composer-row { display: flex; gap: 8px; align-items: flex-end; }
.composer-tools { position: relative; display: flex; gap: 2px; align-self: center; }
.emoji-pop { position: absolute; bottom: 44px; inset-inline-start: 0; z-index: 30; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 8px; display: grid; grid-template-columns: repeat(8, 32px); gap: 2px; }
.emoji { background: none; border: 0; font-size: 20px; cursor: pointer; border-radius: 6px; padding: 2px; }
.emoji:hover { background: var(--canvas); }
.att-chip { display: inline-flex; align-items: center; gap: 8px; background: var(--lime-soft); color: var(--lime-ink); border-radius: 999px; padding: 4px 12px; font-size: 13px; align-self: flex-start; }
.form-error.small { padding: 6px 10px; font-size: 13px; margin: 0; }

/* inbox v9 — clearer states */
.quick-row { display: flex; gap: 6px; }
.quick { font: inherit; font-size: 12.5px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); cursor: pointer; }
.quick.active { background: var(--lime); border-color: var(--lime); color: var(--lime-ink); font-weight: 600; }
.conv { position: relative; border-inline-start: 3px solid transparent; }
.conv.unread { border-inline-start-color: var(--lime); background: #fbfdf2; }
.conv.unread b, .conv.unread .preview-text { font-weight: 700; color: var(--ink); }
.conv.awaiting { border-inline-start-color: #f3c24d; }
.conv.replied { opacity: .82; }
.conv.active { background: var(--lime-soft); opacity: 1; }
.preview { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); overflow: hidden; }
.preview-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preview .you { color: var(--muted); }
.conv .meta { margin-top: 3px; flex-wrap: wrap; }
.tag-await { background: #fff4d6; color: #7a5200; }
.load-more { margin: 10px auto; display: block; }
.conv-list .badge { align-self: center; }

.partner-waba { border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; margin-bottom: 10px; }
.partner-waba > b { display: block; margin-bottom: 2px; }

/* v10 — home, channels, team */
.stats-4 { grid-template-columns: repeat(4, 1fr); }
.stat-link { text-decoration: none; color: inherit; transition: border-color .15s; }
.stat-link:hover { border-color: var(--ink); }
.trial { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 14px; font-weight: 600; display: flex; flex-direction: column; gap: 2px; }
.trial small { font-weight: 400; color: var(--muted); }
.trial-warn { border-color: #f3c24d; background: #fff9e6; }
.setup { list-style: none; margin: 0; padding: 0; }
.setup-step { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.setup-step:last-child { border-bottom: 0; }
.setup-step .step-check { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); flex: none; position: relative; }
.setup-step.done .step-check { background: var(--lime); border-color: var(--lime); }
.setup-step.done .step-check::after { content: ''; position: absolute; left: 7px; top: 3px; width: 5px; height: 10px; border: solid var(--lime-ink); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.setup-link { color: var(--ink); text-decoration: none; font-weight: 600; display: block; }
.setup-link:hover { text-decoration: underline; }
.setup-step small { display: block; }
.mini-conv .avatar { width: 28px; height: 28px; font-size: 11px; }
.mini-conv b { display: block; font-size: 13.5px; }
.mini-conv .preview-text { display: block; max-width: min(260px, 100%); }
.mini-conv b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }   /* v33 (QA WB3-06): a long name stays inside its column */
.connect-card small { display: block; margin-top: 2px; font-size: 12.5px; }
.acct-card { border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; margin-bottom: 10px; }
.acct-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.acct-head b { display: block; }
.acct-pic { width: 44px; height: 44px; border-radius: 12px; object-fit: cover; }
.acct-channels { display: flex; flex-direction: column; }
.acct-ch { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; }
.acct-ch.is-off > .dot { opacity: .45; }   /* v39 (§9.4, axe): only the mark fades — the name and buttons stay ≥ 4.5:1; the pill / switch says it is off */
.icon-btn.danger:hover { color: var(--red); }
.perm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; margin-bottom: 8px; }
.perm-group { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 8px 10px; }
.perm-group b { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }
.perm-group .check { margin: 2px 0; font-size: 13.5px; }
@media (max-width: 860px) { .stats-4 { grid-template-columns: 1fr 1fr; } .perm-grid { grid-template-columns: 1fr; } }

.diag { background: var(--canvas); border-radius: var(--r-sm); padding: 10px; font-size: 12px; direction: ltr; text-align: left; white-space: pre-wrap; word-break: break-all; max-height: 50vh; overflow: auto; }

/* =========================================================
   v11 — avatars, channel badges, Meta-style unread, cards
   ========================================================= */
img.avatar { object-fit: cover; }
.avatar.lg { width: 64px; height: 64px; font-size: 20px; margin: 4px auto 12px; }
.chan-badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; padding: 2px 8px 2px 4px; border-radius: 999px; background: var(--canvas); color: var(--ink-2); margin: 3px 0; max-width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.chan-ico { width: 16px; height: 16px; border-radius: 5px; font-size: 8.5px; font-weight: 800; color: #fff; display: inline-grid; place-items: center; flex: none; }
.chan-whatsapp .chan-ico { background: #25d366; } .chan-messenger .chan-ico, .chan-facebook_comments .chan-ico { background: #1877f2; } .chan-instagram .chan-ico, .chan-instagram_comments .chan-ico { background: #e1306c; }
.conv.unread { background: #fff; border-inline-start-color: #e0245e; }
.conv.unread b { font-weight: 800; color: #000; }
.conv.unread .preview-text { font-weight: 700; color: #000; }
.conv.replied { opacity: 1; }
.conv.replied b, .conv.replied .preview-text { color: var(--ink-2); font-weight: 500; }
.badge-red { background: #e0245e; color: #fff; }
.ctx { font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }
.share-card { display: flex; gap: 10px; text-decoration: none; color: inherit; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 8px; margin-bottom: 6px; max-width: 320px; }
.share-card img { width: 64px; height: 64px; border-radius: 8px; object-fit: cover; flex: none; margin: 0; }
.share-card b { display: block; font-size: 13px; } .share-card span { display: block; font-size: 13px; } .share-card small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.media img.sticker { max-width: 140px; }
.connect-card.v { flex-direction: column; align-items: stretch; gap: 8px; }
.connect-card.v p { margin: 0; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.btn-row .btn { flex: 0 0 auto; }
@media (max-width: 860px) { .btn-row .btn { flex: 1 1 100%; } }

/* ===== v12 — template builder ===== */
.dialog-xl { max-width: 1100px !important; width: 96vw; }
.tpl-builder { display: grid; grid-template-columns: 1fr 340px; gap: 24px; }
.tpl-form h3 { margin: 18px 0 4px; font-size: 15px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.radios { display: flex; flex-wrap: wrap; gap: 14px; margin: 6px 0 10px; }
.ta-toolbar { display: flex; justify-content: space-between; align-items: center; border: 1px solid var(--line); border-bottom: 0; border-radius: var(--r-sm) var(--r-sm) 0 0; padding: 4px 8px; background: var(--canvas); }
.ta-toolbar .tb { font: inherit; background: none; border: 0; padding: 4px 8px; cursor: pointer; border-radius: 6px; }
.ta-toolbar .tb:hover { background: var(--surface); }
.ta-toolbar .rel { position: relative; }
.body-ta { border-radius: 0 0 var(--r-sm) var(--r-sm) !important; }
.counter { display: block; text-align: end; margin: 4px 0 6px; }
.vars-box { display: flex; flex-direction: column; gap: 6px; margin-bottom: 6px; }
.var-chip { background: var(--lime-soft); color: var(--lime-ink); padding: 4px 8px; border-radius: 6px; font-size: 12.5px; direction: ltr; white-space: nowrap; }
.btn-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.btn-row-item { display: grid; grid-template-columns: 150px 1fr 1fr auto; gap: 6px; align-items: center; }
.media-state { font-size: 13px; }
.tpl-preview { position: sticky; top: 0; align-self: start; }
.phone { background: #e5ddd5; border-radius: 22px; padding: 18px 12px; min-height: 260px; border: 6px solid #222; box-shadow: var(--shadow); }
.phone .wa-preview { margin: 0; }
.wa-media img, .wa-media video { width: 100%; border-radius: 8px; display: block; margin-bottom: 6px; }
.wa-media-ph { background: #f0f0f0; border-radius: 8px; padding: 30px 10px; text-align: center; color: #666; margin-bottom: 6px; }
.var-v { background: #fff3b0; padding: 0 3px; border-radius: 3px; }
.tpl-table td .form-error.small { display: block; margin-top: 2px; }
.nowrap { white-space: nowrap; }
.end { justify-content: flex-end; }
.pill-draft { background: #eee; color: #555; }
@media (max-width: 900px) { .tpl-builder { grid-template-columns: minmax(0, 1fr); } .grid-3 { grid-template-columns: 1fr; } .btn-row-item { grid-template-columns: repeat(2, minmax(0, 1fr)); } .btn-row-item > * { min-width: 0; } .tpl-preview { position: static; } }   /* v41: a button's inputs never widen the dialog past a phone's width */

/* ===== v13 — import wizard ===== */
.dropzone { border: 2px dashed var(--line); border-radius: var(--r); padding: 36px 16px; text-align: center; cursor: pointer; display: flex; flex-direction: column; gap: 6px; align-items: center; transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone.over { border-color: var(--lime); background: var(--lime-soft); }
.dz-ico { font-size: 34px; }
.tbl-wrap { overflow-x: auto; margin: 8px 0; }
.import-preview td, .import-preview th { white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.chip-on { background: var(--lime); color: var(--lime-ink); border-color: var(--lime); }
.chips button.chip { cursor: pointer; font: inherit; }
.stat.ok .stat-num { color: #1a7f37; } .stat.bad .stat-num { color: var(--red); }
.details summary { cursor: pointer; font-weight: 600; margin: 8px 0; }
.import-done { text-align: center; margin-bottom: 14px; }
.import-done h3 { margin: 6px 0 2px; }
.aud-area { margin: 8px 0; }
.manual-results { display: flex; flex-direction: column; gap: 4px; margin: 6px 0; }
.manual-item { text-align: start; font: inherit; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 8px 10px; cursor: pointer; }
.manual-item:hover { border-color: var(--lime); }
.phone.small { padding: 10px 8px; min-height: 0; border-width: 4px; }

/* ===== v14 — campaign wizard & results ===== */
.stats-6 { grid-template-columns: repeat(6, 1fr); } .stats-7 { grid-template-columns: repeat(7, 1fr); }
.bc-wizard { display: grid; grid-template-columns: 1fr 340px; gap: 24px; align-items: start; }
.bc-sections { display: flex; flex-direction: column; gap: 10px; }
.bc-preview { position: sticky; top: 12px; }
.sec { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.sec-head { width: 100%; display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: none; border: 0; font: inherit; cursor: pointer; text-align: start; }
.sec-check { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--line); display: inline-grid; place-items: center; font-size: 13px; font-weight: 800; flex: none; }
.sec.done .sec-check { background: var(--lime); border-color: var(--lime); color: var(--lime-ink); }
.sec-head b { flex: 1; font-size: 15px; }
.sec-chev { color: var(--muted); transition: transform .15s; }
.sec.open .sec-chev { transform: rotate(180deg); }
.sec-body { display: none; padding: 0 16px 16px; border-top: 1px solid var(--line); padding-top: 12px; }
.sec.open .sec-body { display: block; }
.aud-summary { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.form-notice.warn { background: #fff4d6; color: #7a5200; border-color: #f3c24d; }
.prog { height: 6px; background: var(--canvas); border-radius: 3px; overflow: hidden; width: 120px; }
.prog-bar { height: 100%; background: var(--lime); }
.tbl tr.link-row { cursor: pointer; } .tbl tr.link-row:hover td { background: var(--canvas); }
@media (max-width: 1000px) { .stats-6, .stats-7 { grid-template-columns: repeat(3, 1fr); } .bc-wizard { grid-template-columns: 1fr; } .bc-preview { position: static; } }

/* ===== v15 — simplified campaign ===== */
.title-input { max-width: 420px; font-size: 15px; margin-top: 6px; }
.bc-steps { display: flex; flex-direction: column; gap: 14px; }
.wstep { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; display: block; }
.step-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.step-head h2 { margin: 0; font-size: 16px; }
.wstep.done .sec-check { background: var(--lime); border-color: var(--lime); color: var(--lime-ink); }
.vars-inline { margin-top: 8px; }
.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 10px; }
.choice-card { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 18px 12px; border: 2px dashed var(--line); border-radius: var(--r); background: var(--canvas); font: inherit; cursor: pointer; text-align: center; }
.choice-card:hover { border-color: var(--lime); background: var(--lime-soft); }
.choice-card.static { cursor: default; border-style: solid; }
.choice-card.static select { width: 100%; }
.choice-ico { font-size: 26px; }
.other-box { margin-top: 6px; }
.btn-lg { padding: 12px 26px; font-size: 15px; }
.stats-5 { grid-template-columns: repeat(5, 1fr); }
@media (max-width: 860px) { .choice-grid { grid-template-columns: 1fr; } .stats-5 { grid-template-columns: repeat(2, 1fr); } }
/* v37 (QA WB6-04): five numbers on two columns — the fifth takes the whole row (it stood alone in half of the third) */
@media (max-width: 860px) { .stats-5 > :nth-child(5):last-child { grid-column: 1 / -1; } }

/* ===== v16 — lock screen, expiry banner, admin ===== */
.locked-page { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(180deg, var(--lime-soft), var(--canvas) 45%); padding: 24px; }
.locked-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 36px 32px; max-width: 520px; width: 100%; text-align: center; display: flex; flex-direction: column; gap: 12px; align-items: center; }
.locked-mark { font-size: 44px; }
.locked-card h1 { margin: 0; font-size: 24px; }
.locked-keep { background: var(--canvas); border-radius: var(--r); padding: 10px 14px; font-size: 13.5px; color: var(--ink-2); }
.locked-actions { display: flex; flex-direction: column; gap: 10px; width: 100%; margin-top: 6px; }
.locked-actions .btn { width: 100%; text-decoration: none; }
.locked-foot { display: flex; gap: 16px; margin-top: 8px; }
.expiry-banner { background: #fff4d6; color: #7a5200; border-bottom: 1px solid #f3c24d; padding: 10px 16px; font-size: 14px; text-align: center; }
.admin-link { margin: 0 12px 6px; }
.pill-trial { background: var(--lime-soft); color: var(--lime-ink); } .pill-trial_ended, .pill-expired { background: #fde8e8; color: var(--red); } .pill-suspended { background: #eee; color: #555; }

/* ===== v17 — auto-replies ===== */
.auto-list { display: flex; flex-direction: column; gap: 10px; }
.auto-card { display: flex; gap: 14px; align-items: flex-start; border: 1px solid var(--line); border-radius: var(--r); padding: 14px; }
.auto-card.is-off { border-style: dashed; }   /* v39 (§9.4, axe): an off reply / bot no longer fades its texts and buttons (2.2–3.8:1) — */
.auto-card.is-off > .auto-ico { opacity: .5; }   /* the dashed edge, the faded icon and its switch say it is off */
.auto-ico { font-size: 26px; width: 44px; height: 44px; display: grid; place-items: center; background: var(--canvas); border-radius: 12px; flex: none; }
.auto-text { margin: 4px 0; font-size: 13.5px; color: var(--ink-2); white-space: pre-wrap; }
.empty-state { text-align: center; padding: 30px 10px; }
.switch { position: relative; display: inline-block; width: 42px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; inset: 0; background: #ccc; border-radius: 24px; transition: .2s; cursor: pointer; }
.slider::before { content: ''; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + .slider { background: var(--lime); }
.switch input:checked + .slider::before { transform: translateX(18px); }
.hours-grid { display: flex; flex-direction: column; gap: 6px; margin: 6px 0 10px; }
.hours-row { display: grid; grid-template-columns: 120px 1fr auto 1fr; gap: 8px; align-items: center; }
.auto-badge { background: var(--lime-soft); color: var(--lime-ink); padding: 1px 6px; border-radius: 6px; font-size: 11px; }

/* ===== v18 — bot builder ===== */
.flow { display: flex; flex-direction: column; gap: 10px; position: relative; }
.flow-step { border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); position: relative; }
.flow-step + .flow-step::before { content: '↓'; position: absolute; top: -12px; inset-inline-start: 22px; color: var(--muted); font-size: 12px; background: var(--surface); padding: 0 4px; }
.flow-head { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--canvas); border-radius: var(--r) var(--r) 0 0; }
.flow-num { width: 22px; height: 22px; border-radius: 50%; background: var(--ink); color: #fff; font-size: 11px; display: grid; place-items: center; }
.flow-body { padding: 10px 12px; }
.type-question .flow-head { background: #eef4ff; } .type-collect .flow-head { background: #fff7e6; } .type-handoff .flow-head { background: #fdeef3; } .type-end .flow-head { background: #eee; }
.opts { display: flex; flex-direction: column; gap: 6px; margin: 6px 0; }
.opt-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 6px; align-items: center; }
.sim-phone { height: 420px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; padding: 12px 10px; }
.sim-msg { max-width: 88%; padding: 8px 10px; border-radius: 12px; font-size: 13.5px; line-height: 1.45; }
.sim-msg.bot { background: #fff; align-self: flex-start; border-bottom-left-radius: 4px; }
.sim-msg.user { background: #dcf8c6; align-self: flex-end; border-bottom-right-radius: 4px; }
.sim-msg.sys { background: transparent; color: var(--muted); font-size: 12px; align-self: center; }
.sim-opts { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.sim-opt { font: inherit; font-size: 13px; background: #fff; border: 1px solid #cfd8dc; color: #1a73e8; border-radius: 8px; padding: 6px; cursor: pointer; }
.sim-opt:hover { background: #f1f5ff; }

/* ===== v19 — help center ===== */
.help-cats { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.help-list { display: flex; flex-direction: column; gap: 8px; }
.help-art { border: 1px solid var(--line); border-radius: var(--r); padding: 0 14px; background: var(--surface); }
.help-art summary { list-style: none; cursor: pointer; padding: 12px 0; display: flex; align-items: center; gap: 10px; }
.help-art summary::-webkit-details-marker { display: none; }
.help-art[open] summary { border-bottom: 1px solid var(--line); }
.help-cat-ico { width: 28px; height: 28px; display: grid; place-items: center; background: var(--canvas); border-radius: 8px; flex: none; }
.help-body { padding: 10px 0 14px; display: flex; flex-direction: column; gap: 10px; }
.help-sec small { display: block; margin-bottom: 4px; text-transform: uppercase; letter-spacing: .04em; font-size: 11px; }
.help-sec ul, .help-sec ol { margin: 0; padding-inline-start: 22px; line-height: 1.7; }
.help-sec p { margin: 0; }
.diag-list { display: flex; flex-direction: column; gap: 8px; }
.diag-item { display: flex; gap: 10px; align-items: center; border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; }
.diag-dot { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 13px; color: #fff; flex: none; }
.diag-item.bad .diag-dot { background: var(--red); } .diag-item.warn .diag-dot { background: #e0a800; }
.diag-item b { display: block; } .diag-item small { display: block; }

/* ===== v20 — AI assistant ===== */
.mode-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 10px; }
.mode-card { font: inherit; text-align: start; display: flex; flex-direction: column; gap: 4px; padding: 12px; border: 2px solid var(--line); border-radius: var(--r); background: var(--surface); cursor: pointer; }
.mode-card.on { border-color: var(--lime); background: var(--lime-soft); }
.mode-ico { font-size: 22px; }
.kv-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 8px; }
.kv-item { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.kv-item .row.gap > .input, .kv-item .row.gap > textarea { flex: 1; }
.ai-sug { background: linear-gradient(135deg, #f6ffe6, #eef7ff); border: 1px solid #cfe3b0; border-radius: var(--r); padding: 10px 12px; margin-bottom: 6px; display: flex; flex-direction: column; gap: 6px; }
.ai-sug p { margin: 0; white-space: pre-wrap; font-size: 14px; }
.ai-sug-head { display: flex; align-items: center; gap: 4px; }
.auto-badge.ai { background: #eef7ff; color: #1a4b8f; }
small.block { display: block; margin-top: 4px; }
@media (max-width: 900px) { .mode-grid { grid-template-columns: 1fr 1fr; } }

.steps-list { padding-inline-start: 20px; line-height: 1.8; } .steps-list ul { padding-inline-start: 18px; } .steps-list code { background: var(--canvas); padding: 1px 6px; border-radius: 4px; font-size: 12.5px; }

/* ===== v22 — layout & polish ===== */
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: start; font-weight: 600; color: var(--muted); font-size: 12.5px; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl thead tr:last-child td { border-bottom: 1px solid var(--line); }   /* v35: a header row's plain cell (the buttons' column) keeps the line */
.nav-group { list-style: none; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: #8a867e; padding: 12px 12px 4px; }
.nav-group:first-child { padding-top: 0; }
.sidebar .nav-link { padding: 7px 12px; }
.sidebar { overflow-y: auto; }
.filter-row { display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; }
.filter-row .status-sel { width: auto; flex: none; padding-inline-end: 26px; }
.filter-row .plat-row { display: flex; gap: 4px; flex: 1; }
.filter-row .plat-btn { padding: 3px 5px; border-radius: 8px; border: 1px solid transparent; background: none; cursor: pointer; display: inline-flex; align-items: center; gap: 2px; font: inherit; font-size: 11px; }
.filter-row .plat-btn.active { border-color: var(--ink); background: var(--surface); }
.filter-row .quick { padding: 3px 8px; }
.filter-row .quick-row { display: flex; gap: 4px; }
.ci-whatsapp { background: #25d366; } .ci-messenger, .ci-facebook_comments { background: #1877f2; } .ci-instagram, .ci-instagram_comments { background: #e1306c; }
.active-filters:empty { display: none; }
.inbox-top { gap: 8px; }
.inbox-main { min-width: 0; }
.thread-head { min-width: 0; flex-wrap: wrap; }
.thread-head > .grow { min-width: 0; }
.thread-head .head-sub { min-width: 0; }
.thread-head .chan-badge { max-width: 240px; }
.thread-head .head-sub small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 180px; }
.conv .chan-badge { max-width: 100%; }
.msgs, .composer { min-width: 0; }
.composer-row textarea { min-width: 0; }

/* ===== v24 — bot builder: sections, drag & drop, map, import ===== */
.flow-sec { display: flex; align-items: center; gap: 8px; padding: 8px 10px; margin-top: 8px; border-radius: var(--r); background: var(--ink); color: #fff; }
.flow-sec .icon-btn { color: #cfcac0; } .flow-sec .icon-btn:hover { background: rgba(255,255,255,.12); color: #fff; }
.flow-sec .pill { background: rgba(255,255,255,.14); color: #fff; } .flow-sec .sec-name { font-size: 14px; } .flow-sec .input { max-width: 240px; }
.flow-sec.drop-after { outline: 2px dashed var(--lime); outline-offset: 2px; }
.flow-handle { cursor: grab; color: var(--muted); font-size: 16px; user-select: none; } .flow-step.dragging { opacity: .45; }
.flow-step.drop-before { box-shadow: 0 -3px 0 0 var(--lime); } .flow-step.drop-after { box-shadow: 0 3px 0 0 var(--lime); }
.flow-step.collapsed .flow-body { display: none; } .flow-step.collapsed .flow-head { border-bottom: 0; border-radius: var(--r); }
.flow-preview { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 46%; }
.flow-step.flash { animation: flow-flash 1.2s; } @keyframes flow-flash { 0%, 60% { box-shadow: 0 0 0 3px var(--lime); } 100% { box-shadow: none; } }
.type-switch .flow-head { background: #f3ecff; } .type-goto .flow-head { background: #ececec; } .type-delay .flow-head { background: #e8f6f6; }
.flow-add { display: flex; justify-content: flex-start; padding: 2px 0 6px; }
.addmenu { position: relative; } .addmenu summary { list-style: none; display: inline-flex; cursor: pointer; } .addmenu summary::-webkit-details-marker { display: none; }
.addmenu-list { position: absolute; z-index: 5; top: 100%; inset-inline-start: 0; margin-top: 4px; display: grid; grid-template-columns: 1fr 1fr; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 8px; box-shadow: var(--shadow); min-width: 300px; }
.addmenu-list .btn { justify-content: flex-start; }
.opt-row.with-desc { grid-template-columns: 1fr 1fr 1fr auto; } .flow .opt-row > * { min-width: 0; max-width: 100%; } .flow select.input { min-width: 0; max-width: 100%; text-overflow: ellipsis; } .step-head { flex-wrap: wrap; } .opt-row.dead .input:first-child { box-shadow: 0 0 0 2px var(--red); border-radius: 8px; }
.media-chip { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 13px; background: var(--canvas); border-radius: 999px; padding: 4px 10px; }
.sim-media img { max-width: 100%; border-radius: 8px; display: block; margin-bottom: 4px; }
.content { min-width: 0; } .bc-steps { min-width: 0; } .wstep { min-width: 0; }   /* let the map scroll instead of widening the page */
.botmap-wrap { margin: 6px 0 12px; } .botmap { overflow: auto; border: 1px solid var(--line); border-radius: var(--r); background: repeating-linear-gradient(0deg, transparent 0 23px, #f1f1ee 23px 24px), repeating-linear-gradient(90deg, transparent 0 23px, #f1f1ee 23px 24px), var(--surface); max-height: 360px; padding: 6px; }
/* v43 (review): the map's scrollbar keeps its place (its width never changes with it) · the observer's ruler (bots.js) */
.botmap { scrollbar-gutter: stable; } .botmap-ruler { height: 0; }
.botmap-svg { display: block; } .map-edge { fill: none; stroke: #b9b9b2; stroke-width: 1.6; } .map-edge.back { stroke-dasharray: 4 4; stroke: #c9c4b8; }
.map-node { cursor: pointer; } .map-node rect { stroke: rgba(0,0,0,.08); transition: stroke .15s; } .map-node:hover rect { stroke: var(--ink); } .map-node.hot rect { stroke: var(--lime); stroke-width: 3; filter: drop-shadow(0 0 6px var(--lime)); }
.map-node.dim { opacity: .25; } .map-label { font-size: 12px; fill: var(--ink); font-family: inherit; pointer-events: none; } .map-dead { font-size: 10px; font-weight: 700; fill: #fff; text-anchor: middle; pointer-events: none; }
.import-report { margin-top: 12px; border: 1px solid var(--line); border-radius: var(--r); padding: 12px; } .import-report .tbl td:first-child { color: var(--muted); width: 45%; }
.form-warn { background: #fff4d6; color: #7a5200; padding: 10px 12px; border-radius: var(--r-sm); font-size: 14px; margin-bottom: 14px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
@media (max-width: 900px) { .opt-row.with-desc { grid-template-columns: 1fr 1fr; } .flow-preview { display: none; } .addmenu-list { min-width: 240px; } }

/* ===== v25 — AI / action steps, per-step counters ===== */
.type-ai .flow-head { background: #eef8dc; } .type-action .flow-head { background: #fff0e2; }
.stat-pill { background: var(--lime-soft); color: var(--lime-ink); font-weight: 600; }
.map-hits { font-size: 9px; fill: #5a6b12; text-anchor: end; pointer-events: none; }

/* ===== v26 — web chat channel ===== */
.plat-webchat { background: #6c5ce7; } .dot-webchat { background: #6c5ce7; } .chan-webchat .chan-ico { background: #6c5ce7; }
.embed-code { white-space: pre-wrap; word-break: break-all; font-size: 12.5px; }
.input-color { width: 100%; height: 40px; padding: 4px; }

/* ===== v27 — in-app support chat opens from the sidebar (no floating bubble over the sidebar footer / reply box) ===== */
.wbc-root .wbc-launch { display: none !important; }
.wbc-root .wbc-panel { bottom: 0 !important; }
.support-chat-btn { width: 100%; background: none; border: 0; font: inherit; cursor: pointer; text-align: start; }
.support-chat-btn[hidden] { display: none; }
.sc-badge { margin-inline-start: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: #ff4d4d; color: #fff; font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; }
.sc-badge[hidden] { display: none; }
/* short laptop screens: the menu list scrolls so the sidebar footer (language, account, sign out) always stays on screen */
@media (min-width: 861px) {
  .sidebar .nav { flex: 0 1 auto; min-height: 0; overflow-y: auto; margin-inline: -14px; padding-inline: 14px; scrollbar-width: thin; scrollbar-color: #5d6568 transparent; }
  /* v35 (QA WB5-02): the list's edge fades while more pages are below / above (shell.js sets the classes) — at 1366×768
     Channels, Team and Settings were below the edge with nothing showing that the list scrolls */
  /* v43 (QA pass #7, UX7-10): a shorter, gentler fade — the last item under it stayed readable (it looked switched off) */
  .sidebar .nav.more-below { -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 24px), rgba(0, 0, 0, .45)); mask-image: linear-gradient(to bottom, #000 calc(100% - 24px), rgba(0, 0, 0, .45)); }
  .sidebar .nav.more-above { -webkit-mask-image: linear-gradient(to bottom, rgba(0, 0, 0, .45), #000 20px); mask-image: linear-gradient(to bottom, rgba(0, 0, 0, .45), #000 20px); }
  .sidebar .nav.more-above.more-below { -webkit-mask-image: linear-gradient(to bottom, rgba(0, 0, 0, .45), #000 20px, #000 calc(100% - 24px), rgba(0, 0, 0, .45)); mask-image: linear-gradient(to bottom, rgba(0, 0, 0, .45), #000 20px, #000 calc(100% - 24px), rgba(0, 0, 0, .45)); }
}
/* …and on short screens the menu is a little tighter, so more of it fits */
@media (min-width: 861px) and (max-height: 820px) {
  .org-switch { margin-bottom: 10px; }
  .sidebar .nav-link { padding-block: 4px; }   /* an owner's whole menu fits at 1366×768 (with 5px it was 2px short) */
  .nav-group { padding: 6px 12px 1px; }   /* v43 (UX7-10): with 📞 Smart calls in the menu (13 items) the last one went under the fade */
  [dir="rtl"] .sidebar .nav-link { padding-block: 3px; line-height: 1.45; }   /* v43 (UX7-10): the Arabic letters are taller — the whole menu fits too */
  .sidebar-foot { gap: 8px; padding-top: 8px; }
}

/* ===== v28 — phones & tablets: top bar + drawer menu (the content comes first; QA WB-09) ===== */
.topbar, .nav-backdrop { display: none; }
.skip-link { position: absolute; inset-inline-start: 12px; top: -60px; z-index: 100; background: var(--lime); color: var(--dark); padding: 8px 14px; border-radius: 999px; font-weight: 700; text-decoration: none; }
.skip-link:focus { top: 10px; }
.content:focus { outline: none; }
.sidebar :focus-visible { outline: 2px solid var(--lime); outline-offset: 2px; border-radius: 8px; }
.burger { width: 40px; height: 40px; border: 0; border-radius: 10px; background: var(--dark-2); display: inline-grid; place-content: center; gap: 4px; cursor: pointer; flex: none; }
.burger span { display: block; width: 18px; height: 2px; border-radius: 2px; background: #f4f2ec; }
.burger:focus-visible { outline: 2px solid var(--lime); outline-offset: 2px; }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .topbar { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 40; height: 56px; padding: 0 12px; background: var(--dark); color: #f4f2ec; }
  .topbar .org-mark { width: 30px; height: 30px; font-size: 11px; }
  .topbar-title { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
  .topbar-title b, .topbar-title small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .topbar-title small { color: #a8a49b; font-size: 11.5px; }
  .sidebar { position: fixed; top: 0; bottom: 0; inset-inline-start: 0; width: min(84vw, 300px); height: 100dvh; z-index: 60; transform: translateX(-105%); transition: transform .22s ease; overflow-y: auto; }
  [dir="rtl"] .sidebar { transform: translateX(105%); }
  .shell.nav-open .sidebar { transform: none; box-shadow: 0 0 40px rgba(0, 0, 0, .35); }
  .nav-backdrop { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(10, 17, 19, .45); opacity: 0; pointer-events: none; transition: opacity .2s; }
  .shell.nav-open .nav-backdrop { opacity: 1; pointer-events: auto; }
  .sidebar .nav { flex-direction: column; flex-wrap: nowrap; }
  .sidebar .nav-link.active::before { display: block; }
  .sidebar-foot { margin-top: auto; }
  html.nav-lock, html.nav-lock body { overflow: hidden; }
  .inbox { height: calc(100dvh - 56px); }
}
@media (prefers-reduced-motion: reduce) { .sidebar, .nav-backdrop { transition: none; } }

/* ===== v28 — the in-app support chat opens beside the sidebar, not over it (WB-52) ===== */
@media (min-width: 861px) { .wbc-root { --wbc-x: 266px; --wbc-y: 16px; } }

/* ===== v28 — inbox ===== */
.chan-ico { min-width: 16px; padding: 0 3px; width: auto; }
.ci-webchat { background: #6c5ce7; }   /* the website-chat filter button was white on transparent (WB-16) */
.chip-sys { background: #fff4e0; color: #7a4b00; }
.preview-text, .msg-body p { unicode-bidi: plaintext; }
.msg-body p a.link { word-break: break-all; }
@media (max-width: 1440px) { .contact-panel { position: fixed; inset-inline-end: 0; top: 0; height: 100vh; z-index: 30; box-shadow: var(--shadow); overflow-y: auto; } }

/* ===== v28 — contacts ===== */
.cf-list { display: flex; flex-direction: column; gap: 6px; }
.cf-row { display: grid; grid-template-columns: 1fr 1.4fr auto; gap: 6px; align-items: center; }
.cf-row .input { width: 100%; min-width: 0; }
.tag-dnc { background: var(--red-soft); color: var(--red); }
.tag-ok { background: var(--lime-soft); color: var(--lime-ink); }
.trow[role="button"]:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; }
.toolbar { flex-wrap: wrap; }

/* ===== v28 — chatbots ===== */
.bot-list .auto-card > .grow { min-width: 0; overflow-wrap: anywhere; }
.bot-ch { margin-top: 4px; font-size: 12.5px; }
.pill-on { background: var(--lime-soft); color: var(--lime-ink); }
.pill-off { background: #ececea; color: #5c5c62; }   /* v39 (WB6-26): 5.6:1 (was 4.28:1) */
.bot-active { align-items: center; margin: 2px 0 4px; }
.en-fields { margin-top: 10px; border: 1px dashed var(--line); border-radius: var(--r-sm); padding: 6px 10px; background: #fbfbf8; }
.en-fields > summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--ink-2); padding: 2px 0; }
.en-fields > summary .muted { font-weight: 400; }
.en-fields[open] > summary { margin-bottom: 8px; }
.en-body { display: flex; flex-direction: column; gap: 8px; }
.sim-lang { width: auto; max-width: 140px; }
.toast-warn { background: #7a5200; color: #fff; }
.bot-list .auto-card .grow > .row.gap { flex-wrap: wrap; row-gap: 6px; }
.flow-head, .flow-sec { flex-wrap: wrap; row-gap: 6px; }
.flow-head > b { min-width: 0; }
@media (max-width: 560px) { .addmenu-list { min-width: 0; width: calc(100vw - 56px); max-width: 360px; } }
@media (max-width: 860px) {
  .bot-list .auto-card { flex-wrap: wrap; }
  .bot-list .auto-card > .row.gap:last-child { width: 100%; justify-content: flex-end; }
}

/* ===== v28 — auto-replies: cards that fit a phone, English text, hints (QA WB-45 / WB-46 / WB-29 / WB-15) ===== */
.auto-rules .auto-card > .grow { overflow-wrap: anywhere; }
.auto-text-en { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.auto-en { display: inline-block; font-size: 10.5px; font-weight: 700; line-height: 1.7; padding: 0 6px; border-radius: 6px; background: var(--canvas); color: var(--ink-2); }
.auto-order { margin: 0 0 12px; }
.auto-note { margin: -6px 0 12px; }
.auto-form .field-hint code { font-size: 12px; padding: 1px 5px; }
.switch input:focus-visible + .slider { outline: 2px solid var(--ink); outline-offset: 2px; }
.switch input:disabled + .slider { opacity: .6; cursor: progress; }
@media (max-width: 600px) {
  .auto-page .page-head { flex-wrap: wrap; gap: 12px; }
  .auto-rules .auto-card { flex-wrap: wrap; gap: 10px 12px; padding: 12px; }
  .auto-rules .auto-card > .grow { flex: 1 1 calc(100% - 56px); }
  .auto-rules .auto-card > .auto-actions { margin-inline-start: 56px; }
  /* working hours: the day on its own line, the two times side by side under it (they were cut: "06:00 PM" → "06:00") */
  .auto-form .hours-row, .calls-hours .hours-row { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 2px 8px; }
  .auto-form .hours-row > .check, .calls-hours .hours-row > .check { grid-column: 1 / -1; margin: 6px 0 0; }
  .auto-form .hours-row .input-sm, .calls-hours .hours-row .input-sm { width: 100%; min-width: 0; }   /* v38: Smart calls' hours too */
}

/* ===== v28 — channels: no sideways scrolling on phones, website chat switch, full install code (QA WB-15 / WB-40) ===== */
.connect-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.connect-card { min-width: 0; }
.connect-card .btn { white-space: normal; text-align: center; overflow-wrap: anywhere; }
.acct-head .grow, .acct-ch .grow { min-width: 0; overflow-wrap: anywhere; }
.acct-ch { flex-wrap: wrap; row-gap: 6px; }
.acct-ch .pill { white-space: normal; }
.pill.q-green { background: var(--lime-soft); color: var(--lime-ink); } .pill.q-yellow { background: #fff4d6; color: #7a5200; } .pill.q-red { background: var(--red-soft); color: var(--red); }
.ch-switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; font-weight: 500; }
.ch-switch .switch { flex: none; }
.copy-box.wrap code { white-space: normal; overflow-wrap: anywhere; word-break: break-all; text-overflow: clip; }
.embed-pre { margin: 0 0 8px; padding: 12px; background: var(--canvas); border-radius: var(--r-sm); direction: ltr; text-align: left; white-space: pre-wrap; word-break: break-all; overflow-wrap: anywhere; font: 12.5px/1.6 ui-monospace, Menlo, monospace; max-height: 40vh; overflow: auto; user-select: all; }
.embed-pre:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.embed-box .form-row-end { margin: 0 0 14px; }
.steps-list code, .dialog .muted code { font-size: 12.5px; }
@media (max-width: 860px) {
  .connect-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 600px) {
  .acct-ch > .grow { flex-basis: calc(100% - 24px); }
}

/* ===== v28 — Wasil AI page (p10): notes, knowledge files, phones (no sideways scroll) ===== */
.ai-page .row.wrap { flex-wrap: wrap; gap: 8px 12px; }
.ai-page .page-head > div:first-child { flex: 1 1 280px; min-width: 0; }   /* the Save button stays beside the title on desktop */
.ai-page .how-answers { margin: 2px 0 10px; }
.ai-page .check { min-width: 0; overflow-wrap: anywhere; }
.ai-page .list-row .grow { flex: 1 1 170px; }   /* on phones the buttons wrap instead of squeezing the file name */
.ai-page .doc-title { overflow-wrap: anywhere; }
.ai-page .doc-actions { flex: none; }
.ai-page .doc-public { color: #7a5200; font-size: 12px; margin-top: 3px; }
.ai-page .form-notice .fname { display: inline-block; max-width: 100%; overflow-wrap: anywhere; }   /* «file name» stays in one piece */
.ai-page .url-row .input { flex: 1; min-width: 0; }
.ai-page .sim-msg { overflow-wrap: anywhere; }
.ai-page .bc-preview .input-sm { width: 100%; }
.ai-page .ai-conf { margin-top: 6px; }
.ai-status-note { background: var(--surface); border: 1px solid var(--line); color: var(--ink-2); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ai-status-note > span { flex: 1; min-width: 180px; }
.ai-off-note p { margin: 0; }
.ai-off-note p + p { margin-top: 6px; }
.ai-off-note a.link { font-weight: 600; }

/* ===== v28 — Team page + invitation page (p11): invitation e-mails, long addresses on phones ===== */
.team-page .list-row .grow { flex: 1 1 220px; }   /* on phones the buttons move to their own line instead of squeezing the text */
.team-page .list-row .grow b, .team-page .list-row .grow small { overflow-wrap: anywhere; }
.team-page .inv-actions { flex-wrap: wrap; }
.team-page .inv-mailed { margin-top: 4px; }
.perm-grid .check { min-width: 0; overflow-wrap: anywhere; }
.inv-body { margin-top: 14px; }
.inv-body > p.muted { margin: 0 0 14px; }
.inv-box { background: var(--canvas); border-radius: var(--r); padding: 14px 16px; margin: 0 0 18px; overflow-wrap: anywhere; }
.inv-box p { margin: 0 0 6px; }
.inv-box p:last-child { margin-bottom: 0; }
.onb-card .row.wrap { flex-wrap: wrap; }

/* ===== v28 — sign-up / log-in / verify / onboarding (WB-35, WB-37, WB-38) ===== */
.pw-wrap { position: relative; }
[dir="ltr"] .pw-wrap .input { padding-right: 44px; }
[dir="rtl"] .pw-wrap .input { padding-left: 44px; }
.pw-toggle { position: absolute; top: 50%; transform: translateY(-50%); inset-inline-end: 5px; width: 34px; height: 34px; border: 0; border-radius: 8px; background: none; cursor: pointer; font-size: 16px; line-height: 1; color: var(--muted); display: grid; place-items: center; }
.pw-toggle:hover { background: var(--canvas); }
.terms-check { align-items: flex-start; line-height: 1.55; }
.terms-check input { flex: none; width: 17px; height: 17px; margin: 2px 0 0; accent-color: var(--lime-ink); }
.auth-unconf p { margin: 0 0 10px; }
.auth-unconf .form-notice { margin-bottom: 8px; }
.verify .lead { margin-bottom: 10px; overflow-wrap: anywhere; }
.verify > .field-hint { display: block; margin-bottom: 16px; }
.verify .btn-block { margin-top: 2px; }
.verify-links { margin-top: 16px; font-size: 14px; color: var(--ink-2); }
.onb-head { flex-wrap: wrap; gap: 10px; }
.onb-actions { flex-wrap: wrap; justify-content: flex-end; }
.nf-code { font-size: 56px; font-weight: 800; line-height: 1; letter-spacing: -0.03em; margin-bottom: 10px; }
.onb-card.center h1 { margin-bottom: 6px; }
.onb-card.center p { margin-bottom: 20px; }

/* ===== v28 — platform admin, home, settings, analytics (WB-50, WB-33, WB-60, WB-49, WB-15) ===== */
.admin-head, .dash-head, .home-head { flex-wrap: wrap; gap: 12px; }
.admin-head > .row, .dash-head > .row { flex-wrap: wrap; min-width: 0; max-width: 100%; }
.admin-head .input, .dash-head .input { max-width: 100%; min-width: 0; }
.admin-tbl .tbl td { vertical-align: top; }
.admin-sub .row { flex-wrap: wrap; }
.admin-sub small.block { margin-top: 6px; }
.admin-acts { display: flex; flex-direction: column; align-items: stretch; gap: 6px; min-width: 128px; }
.admin-ev { display: block; margin-top: 6px; font-size: 12px; color: var(--muted); max-width: 200px; }
.admin-note { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-style: italic; }
.lock-banner { background: var(--red-soft); color: var(--red); border-bottom-color: #f1b8b2; }
.lock-banner .link { color: inherit; }
.upgrade-box { margin-top: 16px; }
.upgrade-box h3 { margin: 0 0 4px; font-size: 15px; }
.upgrade-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; margin-top: 10px; }
.upgrade-row .field { margin: 0; flex: 1 1 200px; min-width: 0; }
.dash-chart-head { flex-wrap: wrap; gap: 6px 14px; }
.dash-page .stat { min-width: 0; overflow-wrap: anywhere; }
.dash-page .stat small { line-height: 1.35; }
.hbar-label .dot { flex: none; }   /* a long channel name squeezed the colour dot away */
.hbar-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 560px) { .dash-page .stats-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* phones: the team table keeps all its columns (with headers) and scrolls inside its panel */
@media (max-width: 860px) {
  .dash-agents .table { overflow-x: auto; }
  .dash-agents .trow.t4 { grid-template-columns: 1.6fr repeat(4, 1fr); min-width: 520px; }
  .dash-agents .trow.thead { display: grid; }
  .dash-agents .trow span:nth-child(n+3) { display: block; }
  .hbar-label { min-width: 0; }
}

/* ===== v28 — help center on phones (WB-15) ===== */
.help-page .help-cats { display: flex; flex-wrap: wrap; gap: 6px; }
.help-page .help-art summary { overflow-wrap: anywhere; }
.help-page .help-body { overflow-wrap: anywhere; }
.diag-item .grow { min-width: 0; overflow-wrap: anywhere; }

/* ===== v28 — templates & campaigns ===== */
.need-wa { max-width: 640px; margin-inline: auto; }
.need-wa h2 { margin: 6px 0; }
.need-wa p { max-width: 520px; margin-inline: auto; }
.tpl-table td:first-child { overflow-wrap: anywhere; }
@media (max-width: 860px) {
  .page-head .row.gap.wrap .input-sm { max-width: 100%; }
}

/* ===== v28 — global ===== */
.row.wrap { flex-wrap: wrap; }   /* used on many pages but had no rule → rows ran off the screen on phones (WB-15) */
.btn { max-width: 100%; }
.btn > * { min-width: 0; }
@media (max-width: 860px) {   /* page titles and their buttons share the width on phones instead of pushing the page sideways */
  .page-head.row { flex-wrap: wrap; gap: 10px 12px; }
  .page-head > .row { flex-wrap: wrap; }
}

/* ===== v28 round 2 ===== */
/* N1 — phones/tablets: the list fills the screen until a conversation is opened (the placeholder squeezed it to 0 px) */
@media (max-width: 860px) {
  .inbox { grid-template-rows: minmax(0, 1fr); }
  .inbox:not(.has-active) .inbox-main.empty { display: none; }
  .inbox-main { min-height: 0; }
}
/* WB-16 — platform icons get their own row under status / quick filters */
.filter-row { flex-wrap: wrap; }
.filter-row .plat-row { order: 5; flex: 1 1 100%; flex-wrap: wrap; }
/* WB-15 — long step names in selects no longer widen the bot editor on phones */
.flow .field { min-width: 0; }
@media (max-width: 600px) { .flow .grid-2, .flow .grid-3 { grid-template-columns: minmax(0, 1fr); } }
/* N14 — the "+ Step" menu wraps its buttons instead of pushing the page sideways on small phones */
.addmenu-list .btn { white-space: normal; text-align: start; min-width: 0; }
@media (max-width: 420px) { .addmenu-list { grid-template-columns: minmax(0, 1fr); } }
/* WB-19 — snooze */
.snooze-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.snooze-note { color: #6b4fbb; display: block; margin-top: 2px; }
.chan-badge .chan-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ===== v29 — QA pass #2 ===== */
/* conversation list: the time never breaks into two lines, a long name is shortened instead (WB2-21 note) */
.conv .conv-time { white-space: nowrap; flex: none; }
.conv .row.between > b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* a day line between messages of different days (WB2-21) */
.day-sep { align-self: stretch; display: flex; align-items: center; gap: 10px; margin: 8px 0 2px; color: var(--muted); font-size: 12px; font-weight: 600; }
.day-sep::before, .day-sep::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.day-sep span { padding: 2px 10px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); white-space: nowrap; }
/* 🩺 channel check as ✓ / ✕ lines; the raw answer folded under "Technical details" (WB2-11) */
.diag-item.ok .diag-dot { background: #1f9d55; }
.diag-tech summary { cursor: pointer; font-size: 13px; color: var(--muted); padding: 4px 0; }
.diag-tech .diag { margin-top: 8px; }
/* analytics: channel type under the channel name; on phones every team member is a small card with named values (WB2-16) */
.hbar-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.hbar-sub { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 560px) {
  .dash-agents .table { overflow: visible; }
  .dash-agents .trow.thead { display: none; }
  .dash-agents .trow.t4 { grid-template-columns: 1fr 1fr; min-width: 0; gap: 6px 14px; padding: 12px 4px; }
  .dash-agents .trow.t4 > b { grid-column: 1 / -1; }
  .dash-agents .trow.t4 > span { display: block; font-weight: 600; }
  .dash-agents .trow.t4 > span::before { content: attr(data-label); display: block; font-size: 11.5px; font-weight: 400; color: var(--muted); }
}
/* inbox: a quick filter that is on also shows its name ("● Unread"), e.g. after opening the inbox from a Home card (WB2-09) */
.quick .quick-lbl { margin-inline-start: 5px; }
/* tables wider than the screen: a soft shadow on the side that still has columns (platform admin, campaigns … on phones) */
.panel .tbl-wrap, .tbl-wrap.admin-tbl {
  background:
    linear-gradient(to right, var(--surface) 30%, rgba(255, 255, 255, 0)) left center / 32px 100% no-repeat local,
    linear-gradient(to left, var(--surface) 30%, rgba(255, 255, 255, 0)) right center / 32px 100% no-repeat local,
    radial-gradient(farthest-side at 0 50%, rgba(27, 27, 31, .18), rgba(27, 27, 31, 0)) left center / 12px 100% no-repeat scroll,
    radial-gradient(farthest-side at 100% 50%, rgba(27, 27, 31, .18), rgba(27, 27, 31, 0)) right center / 12px 100% no-repeat scroll;
}
/* phone menu: only the list of pages scrolls — language, account and sign out stay at the bottom of the screen (QA §6) */
@media (max-width: 860px) {
  .sidebar { overflow: hidden; }
  .sidebar .nav { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; margin-inline: -14px; padding-inline: 14px; }
  .sidebar-foot { flex: none; margin-top: 12px; }
}

/* phones: the customer's name gets its own line in the conversation header (a long name was squeezed and cut by the selects) */
@media (max-width: 640px) {
  .thread-head { gap: 8px; padding: 10px 12px; }
  .thread-head > .grow { flex: 1 1 calc(100% - 56px); }
  .thread-head > .grow > b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

/* ===== v30 — WhatsApp template replies from the inbox ===== */
/* composer when the 24-hour window is closed, and the "time left" line in its last two hours */
.window-panel { display: flex; flex-direction: column; gap: 8px; }
.composer .window-panel .form-notice { margin: 0; }
.window-wait { margin: 0; font-size: 13px; color: var(--ink-2); }
.window-left { margin: 0; font-size: 12.5px; color: #7a5200; background: #fff4d6; border-radius: var(--r-sm); padding: 6px 10px; }
.window-left.closed { color: var(--red); background: var(--red-soft); }
/* a template in the conversation: header, text, footer and buttons like the customer got it */
.tpl-card { display: flex; flex-direction: column; gap: 6px; }
.tpl-tag { font-size: 11.5px; color: var(--muted); }
.tpl-h { font-size: 14px; }
.tpl-img { width: 100%; max-width: 280px; border-radius: 8px; display: block; }
.tpl-foot { font-size: 12px; }
.msg-outbound .tpl-card .wa-btn { background: rgba(255, 255, 255, .8); }
/* the dialog */
.dialog.dialog-tpl { max-width: 880px; }
.tplx-route { margin: -8px 0 12px; font-size: 13px; }
.tplx .tplx-blocked { margin: 0 0 10px; }
.tplx-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; max-height: 56vh; overflow-y: auto; }
.tplx-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; align-items: center; text-align: start; width: 100%; font: inherit; color: inherit; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; cursor: pointer; }
.tplx-item:hover:not(:disabled) { border-color: var(--ink); }
.tplx-item:disabled, .tplx-item.is-off { cursor: not-allowed; opacity: .6; }
.tplx-item.is-off:hover { border-color: var(--line); }
/* a URL button: the fixed start of the link, then the agent's part */
.tplx-url-row { display: flex; align-items: stretch; min-width: 0; }
.tplx-prefix { display: flex; align-items: center; padding: 0 10px; background: var(--canvas); border: 1px solid var(--line); border-inline-end: 0; border-radius: var(--r-sm) 0 0 var(--r-sm); font-size: 13px; color: var(--ink-2); max-width: 55%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tplx-url-row .input { border-radius: 0 var(--r-sm) var(--r-sm) 0; min-width: 0; }
.tplx-url { display: block; margin-top: 8px; font-size: 12px; color: var(--ink-2); overflow-wrap: anywhere; }
.tplx-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tplx-badges { display: flex; gap: 6px; }
.tplx-snippet { grid-column: 1 / -1; font-size: 13px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.tplx-unsup { grid-column: 1 / -1; color: var(--red); font-size: 12.5px; }
.pill.tplx-cat-marketing { background: #fff4d6; color: #7a5200; }
.pill.tplx-cat-utility { background: var(--lime-soft); color: var(--lime-ink); }
.tplx-empty { text-align: center; padding: 20px 10px; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.tplx-empty p { margin: 0; max-width: 46ch; }
.tplx-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; min-width: 0; }
.tplx-head b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tplx-compose { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.tplx-fields { display: flex; flex-direction: column; gap: 12px; }
.tplx-fields .field { margin: 0; }
.tplx-fields .field-hint { margin: 0; }
.field-err { color: var(--red); font-size: 12.5px; }
.input.input-err { border-color: var(--red); }
.tplx-chip { cursor: pointer; font: inherit; font-size: 12px; align-self: flex-start; margin-top: 2px; }
.tplx-media { align-items: center; }
.tplx-info { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.tplx-info p { margin: 0; }
.tplx-cost { font-size: 13px; color: var(--ink-2); }
.tplx-repeat { background: #fff4d6; color: #7a5200; border-radius: var(--r-sm); padding: 10px 12px; font-size: 13.5px; display: flex; flex-direction: column; gap: 8px; }
.tplx-repeat p { margin: 0; }
.tplx-repeat label { align-items: center; cursor: pointer; font-weight: 600; }
.tplx-side { position: sticky; top: 0; }
.tplx-phone .wa-preview { max-width: none; }
.tplx-actions { margin-top: 16px; }
@media (max-width: 760px) {
  .tplx-compose { grid-template-columns: minmax(0, 1fr); }
  .tplx-side { position: static; }
}
/* phones: the template dialog takes the whole screen; Back / Send stay at the bottom */
@media (max-width: 640px) {
  .overlay.overlay-tpl { padding: 0; place-items: stretch; }
  .dialog.dialog-tpl { max-width: none; border-radius: 0; max-height: none; height: 100dvh; padding: 16px; display: flex; flex-direction: column; }
  .dialog-tpl .tplx { flex: 1; display: flex; flex-direction: column; min-height: 0; }
  .dialog-tpl .tplx-list { max-height: none; flex: 1; }
  .dialog-tpl .tplx-actions { position: sticky; bottom: -16px; background: var(--surface); padding: 12px 0 calc(12px + env(safe-area-inset-bottom, 0px)); margin-top: auto; border-top: 1px solid var(--line); z-index: 1; }
}

/* ===== v30 — Meta's Human Agent (Messenger / Instagram replies up to 7 days) ===== */
.window-left.window-ha { color: #1d4f91; background: #e8f0fb; }
.auto-badge.ha { background: #e8f0fb; color: #1d4f91; }
.ha-panel { margin-bottom: 16px; }
.ha-panel h2 { font-size: 16px; margin: 0 0 4px; }
.ha-panel .ha-text { flex: 1 1 360px; min-width: 0; }
.ha-panel .ha-text p { margin: 0; max-width: 70ch; }
.ha-side { align-items: center; flex-wrap: wrap; }
.ha-pill { white-space: normal; }
.ha-opts, .ha-orgs { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.ha-opt, .ha-org { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.ha-opt input, .ha-org input { flex: none; }
.ha-orgs { max-height: 240px; overflow-y: auto; border-top: 1px solid var(--line); padding-top: 10px; }

/* ===== v31 — publishing & scheduling to Facebook / Instagram, and their numbers ===== */
.plat.xs { width: 16px; height: 16px; border-radius: 4px; font-size: 8.5px; letter-spacing: -0.02em; }
.plat.sm { width: 22px; height: 22px; border-radius: 6px; font-size: 9.5px; }
.plat.inline { display: inline-grid; vertical-align: -3px; margin-inline-end: 3px; }
.posts-head .posts-views { min-width: 220px; }
.posts-note { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; background: #fff4d6; color: #7a5200; border-radius: var(--r); padding: 10px 14px; margin-bottom: 14px; }
.posts-note p { margin: 0; flex: 1 1 280px; }
.cal-nav { margin-bottom: 10px; gap: 10px; flex-wrap: wrap; }
.cal-title { margin: 0; font-size: 18px; }
.cal-panel { padding: 12px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-head { font-size: 12px; font-weight: 600; color: var(--muted); text-align: center; padding: 4px 0 6px; }
.cal-day { min-height: 112px; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 5px; display: flex; flex-direction: column; gap: 3px; min-width: 0; background: var(--surface); }
.cal-day.other { background: var(--canvas); }
.cal-day.other .cal-num { color: #b5b5ae; }
.cal-day.past:not(.today) { background: #fbfbf8; }
.cal-day.today { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.cal-day-head { display: flex; align-items: center; justify-content: space-between; min-height: 22px; }
.cal-num { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.cal-day.today .cal-num { background: var(--lime); color: var(--lime-ink); border-radius: 999px; padding: 0 7px; }
.cal-add { width: 22px; height: 22px; border-radius: 6px; border: 1px dashed var(--line); background: none; color: var(--muted); cursor: pointer; font: inherit; line-height: 1; opacity: 0; }
.cal-day:hover .cal-add, .cal-add:focus-visible, .week-day .cal-add { opacity: 1; }
.cal-add:hover { border-color: var(--ink); color: var(--ink); }
@media (hover: none) { .cal-add { opacity: 1; } }
.cal-more { background: none; border: 0; font: inherit; font-size: 12px; color: var(--ink-2); text-decoration: underline; cursor: pointer; padding: 2px 4px; text-align: start; }
.post-chips { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.post-chip { display: flex; align-items: center; gap: 4px; width: 100%; min-width: 0; font: inherit; font-size: 12px; text-align: start; color: var(--ink); background: var(--canvas); border: 1px solid var(--line); border-inline-start: 3px solid #b5b5ae; border-radius: 6px; padding: 3px 5px; cursor: pointer; }
.post-chip:hover { border-color: var(--ink); }
.post-chip-time { flex: none; font-variant-numeric: tabular-nums; color: var(--ink-2); white-space: nowrap; }
.post-chip-nets { display: inline-flex; gap: 2px; flex: none; }
.post-chip-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.post-chip.st-scheduled { border-inline-start-color: #e0a800; }
.post-chip.st-publishing { border-inline-start-color: #1877f2; }
.post-chip.st-published { border-inline-start-color: #6aa01a; }
.post-chip.st-partial { border-inline-start-color: #e07b00; }
.post-chip.st-failed { border-inline-start-color: var(--red); background: var(--red-soft); }
.post-chip.st-draft { border-inline-start-style: dashed; }
.cal-agenda { display: none; }
.agenda-day { display: flex; flex-direction: column; gap: 6px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.agenda-day:last-child { border-bottom: 0; }
.posts-drafts h2 { font-size: 15px; margin: 0 0 10px; }
.posts-drafts .post-chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.week-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; padding: 12px; }
.week-day { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 8px; min-height: 180px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.week-day.today { border-color: var(--ink); }
.week-day-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.week-day-head b { font-size: 13px; }
.week-day-head .cal-add { margin-inline-start: auto; }
.week-empty { margin: 0; text-align: center; }
.week-day .post-chip { flex-wrap: wrap; row-gap: 2px; }
.week-day .post-chip-text { flex-basis: 100%; white-space: normal; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.posts-list-head { margin-bottom: 10px; }
.posts-filter { display: inline-flex; flex-wrap: wrap; }
.posts-filter .seg { flex: none; }
.posts-list { padding: 6px 12px; }
.post-row { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 12px; align-items: center; width: 100%; font: inherit; color: inherit; text-align: start; background: none; border: 0; border-bottom: 1px solid var(--line); padding: 10px 2px; cursor: pointer; }
.post-row:last-child { border-bottom: 0; }
.post-row:hover { background: var(--canvas); }
.post-row-thumb { width: 52px; height: 52px; border-radius: var(--r-sm); overflow: hidden; background: var(--canvas); display: grid; place-items: center; }
.post-row-thumb img { width: 100%; height: 100%; object-fit: cover; }
.post-row-noimg { color: var(--muted); }
.post-row-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.post-row-text { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.pv-video { background: #1b1b1f; color: #fff; display: grid; place-items: center; width: 100%; height: 100%; font-size: 26px; }
.pv-video.mini { width: 52px; height: 52px; border-radius: var(--r-sm); font-size: 18px; text-decoration: none; }
.post-pill { white-space: nowrap; }
.post-pill.st-draft, .post-pill.st-pending, .post-pill.st-deleted { background: #ececea; color: #55554f; }
.post-pill.st-scheduled { background: #fff4d6; color: #7a5200; }
.post-pill.st-publishing, .post-pill.st-processing { background: #e8f0fb; color: #1d4f91; }
.post-pill.st-published { background: var(--lime-soft); color: var(--lime-ink); }
.post-pill.st-partial { background: #ffe9d1; color: #8a4600; }
.post-pill.st-failed { background: var(--red-soft); color: var(--red); }
.post-details .pd-text { background: var(--canvas); border-radius: var(--r-sm); padding: 10px 12px; white-space: normal; overflow-wrap: anywhere; font-size: 14px; }
.pd-media { display: flex; flex-wrap: wrap; gap: 6px; }
.pd-media a { display: block; width: 72px; height: 72px; border-radius: var(--r-sm); overflow: hidden; background: var(--canvas); }
.pd-media img { width: 100%; height: 100%; object-fit: cover; }
.pd-media .pv-video.mini { width: 72px; height: 72px; }
.pd-targets { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.pd-target { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 8px 10px; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.pd-target.st-failed { border-color: #f1b7b1; }
.pd-target-head { width: 100%; flex-wrap: wrap; row-gap: 4px; }
.pd-target-head b { min-width: 0; overflow-wrap: anywhere; }
.pd-target-head .tag { margin: 0; }
.pd-reason { margin: 0; color: var(--red); }
.post-details .form-row-end { margin: 4px 0 0; }

/* the composer */
.overlay-post { align-items: start; overflow-y: auto; }
.dialog.dialog-post { max-width: 1120px !important; width: 96vw; max-height: none; overflow: visible; margin: 2vh 0; }   /* the overlay scrolls, so the buttons can stay on screen */
.pc { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 22px; align-items: start; }
.pc-form { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.pc-sec h3, .pc-side h3 { font-size: 14px; margin: 0 0 8px; }
.pc-sec .row h3 { margin: 0; }
.pc-accs { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.pc-acc-wrap { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.pc-acc { display: flex; align-items: center; gap: 8px; width: 100%; min-width: 0; font: inherit; text-align: start; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 8px 10px; cursor: pointer; }
.pc-acc:hover:not(:disabled) { border-color: #b9b9b3; }
.pc-acc.on { border-color: var(--ink); background: var(--lime-soft); box-shadow: inset 0 0 0 1px var(--ink); }
.pc-acc:disabled { opacity: .55; cursor: not-allowed; }
.pc-acc-pic { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; flex: none; }
.pc-acc-pic.ini { display: grid; place-items: center; background: var(--canvas); color: var(--ink-2); font-size: 12px; font-weight: 600; }
.pc-acc-name { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.pc-acc-name b, .pc-acc-name small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-acc-name small { color: var(--muted); font-size: 12px; }
.pc-fmts .seg { font-size: 12.5px; padding: 4px 6px; }
.pc-text { min-height: 130px; resize: vertical; }
.pc-count { display: block; margin-top: 4px; }
.pc-count.over { color: var(--red); font-weight: 600; }
.pc-ai { background: var(--canvas); border-radius: var(--r-sm); padding: 10px; margin-bottom: 8px; display: flex; flex-direction: column; gap: 8px; }
.pc-ai-row .input { flex: 1; min-width: 0; width: auto; }
.pc-thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.pc-thumbs:empty { display: none; }
.pc-thumb { position: relative; width: 88px; height: 88px; border-radius: var(--r-sm); overflow: hidden; background: var(--canvas); border: 1px solid var(--line); }
.pc-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pc-thumb-vid { width: 100%; height: 100%; background: #1b1b1f; color: #fff; display: grid; place-items: center; align-content: center; font-size: 22px; }
.pc-thumb-vid small { font-size: 11px; opacity: .8; }
.pc-thumb-tools { position: absolute; inset-inline: 0; bottom: 0; display: flex; justify-content: space-between; padding: 2px; background: linear-gradient(transparent, rgba(0,0,0,.45)); }
.pc-thumb-tools .icon-btn { background: rgba(255,255,255,.92); color: var(--ink); width: 26px; height: 26px; padding: 0; font-size: 14px; display: grid; place-items: center; }
.pc-thumb-tools .icon-btn:only-child { margin-inline-start: auto; }
.pc-media-note { color: #7a5200; margin: 6px 0 0; }
.pc-link { margin: 0; }
.pc-mode { max-width: 420px; margin-bottom: 10px; }
.pc-when-row { flex-wrap: wrap; align-items: flex-start; }
.pc-when-row .field { flex: 1 1 150px; margin: 0; min-width: 0; }
.pc-problems { list-style: none; margin: 0; padding: 10px 12px; background: var(--red-soft); color: var(--red); border-radius: var(--r-sm); font-size: 13.5px; display: flex; flex-direction: column; gap: 4px; }
.pc-problems li::before { content: '• '; }
.pc-actions { grid-column: 1 / -1; position: sticky; bottom: -16px; z-index: 2; background: var(--surface); border-top: 1px solid var(--line); padding: 12px 0; flex-wrap: wrap; row-gap: 8px; }   /* -16px: the overlay's padding */
.pc-state { min-width: 0; }
.pc-side { position: sticky; top: 0; min-width: 0; }
.pc-prev-tabs { margin-bottom: 10px; }
.pc-prev-empty { text-align: center; padding: 30px 10px; border: 1px dashed var(--line); border-radius: var(--r); }
.pv { border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); overflow: hidden; font-size: 14px; color: #1c1e21; }
.pv header { display: flex; align-items: center; gap: 8px; padding: 10px 12px; min-width: 0; }
.pv header > div { display: flex; flex-direction: column; min-width: 0; }
.pv header b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pv-av { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; flex: none; }
.pv-av.ini { display: grid; place-items: center; background: var(--canvas); font-size: 12px; font-weight: 600; }
.pv-text { margin: 0; padding: 0 12px 10px; overflow-wrap: anywhere; }
.pv-grid { display: grid; gap: 2px; }
.pv-grid.n2, .pv-grid.n4 { grid-template-columns: 1fr 1fr; }
.pv-grid.n3 { grid-template-columns: 1fr 1fr 1fr; }
.pv-cell { position: relative; aspect-ratio: 1; background: var(--canvas); overflow: hidden; }
.pv-grid.n1 .pv-cell { aspect-ratio: auto; max-height: 420px; }
.pv-cell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pv-grid.n1 .pv-cell img { height: auto; max-height: 420px; object-fit: contain; background: #000; }
.pv-grid.n1 .pv-video { aspect-ratio: 16 / 9; }
.pv-more { position: absolute; inset: 0; background: rgba(0,0,0,.45); color: #fff; font-size: 24px; font-weight: 600; display: grid; place-items: center; }
.pv-link { background: #f0f2f5; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; overflow-wrap: anywhere; }
.pv footer { padding: 8px 12px; border-top: 1px solid var(--line); }
.pv-ig-media { position: relative; width: 100%; background: #000; overflow: hidden; display: grid; place-items: center; }
.pv-ig-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pv-ig-media > .muted { color: #bbb; }
.pv-ig.story { max-width: 250px; margin-inline: auto; }
.pv-badge { position: absolute; top: 8px; inset-inline-end: 8px; background: rgba(0,0,0,.6); color: #fff; font-size: 11px; padding: 2px 8px; border-radius: 999px; }
.pv-dots { position: absolute; bottom: 8px; inset-inline: 0; display: flex; justify-content: center; gap: 4px; }
.pv-dots i { width: 6px; height: 6px; border-radius: 50%; background: rgba(255,255,255,.55); }
.pv-dots i.on { background: #fff; }
.pv-ig footer { border-top: 0; padding: 8px 12px 10px; }
.pv-ig-icons { font-size: 16px; letter-spacing: 2px; margin-bottom: 6px; direction: ltr; text-align: start; }
.pv-text.clamp { padding: 0; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.pv-story-note { margin: 0; padding: 8px 12px 10px; }

/* analytics → pages & accounts */
.dash-tabs { display: inline-flex; margin: -10px 0 18px; }
.dash-tabs .seg { flex: none; padding: 6px 14px; }
.ins-bar { margin-bottom: 14px; }
.ins-days { display: inline-flex; }
.ins-days .seg { flex: none; padding: 5px 14px; }
.ins-bar-end { align-items: center; }
.ins-card h3 { font-size: 14px; margin: 14px 0 0; }
.ins-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; min-width: 0; }
.ins-head b { display: block; overflow-wrap: anywhere; }
.ins-head small { display: flex; align-items: center; gap: 4px; }
.ins-pic { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex: none; }
.ins-pic.ini { display: grid; place-items: center; background: var(--canvas); font-weight: 600; font-size: 13px; }
.ins-kpis { margin-bottom: 6px; }
.ins-stat { min-width: 0; overflow-wrap: anywhere; }
.ins-stat small { line-height: 1.35; }
.ins-stat.up small { color: #1a7f37; }
.ins-stat.down small { color: var(--red); }
.ins-needs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.ins-needs p { margin: 0; flex: 1 1 260px; }
.ins-err { display: block; margin-bottom: 8px; }
.ins-posts { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; }
.ins-posts summary { cursor: pointer; font-weight: 600; font-size: 14px; }
.ins-plist { list-style: none; margin: 8px 0 0; padding: 0; }
.ins-prow { display: flex; align-items: flex-start; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.ins-prow:last-child { border-bottom: 0; }
.ins-pthumb { width: 56px; height: 56px; border-radius: var(--r-sm); object-fit: cover; flex: none; background: var(--canvas); }
.ins-pthumb.none { display: grid; place-items: center; color: var(--muted); }
.ins-ptext { margin: 0 0 2px; overflow-wrap: anywhere; font-size: 13.5px; }
.ins-nums { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 4px; font-size: 12.5px; color: var(--ink-2); }
.ins-open { flex: none; }
.ins-note { margin-top: 4px; }

/* channels: publishing & insights per Page / Instagram account */
.acct-pub { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; padding: 10px 0 2px; border-top: 1px solid var(--line); font-size: 14px; }
.acct-pub .grow { flex: 1 1 220px; min-width: 0; }
.acct-pub .grow b { display: block; }
.acct-pub .grow small { display: block; }
.acct-pub-ico { font-size: 16px; }
.acct-pub-list { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.acct-pub-list .pill { font-size: 11.5px; padding: 1px 8px; }

/* one line that may be cut: the text keeps its own direction (so its start stays visible and "…" is at its end), but lines up
   with the page on Arabic pages */
html[dir="rtl"] .pc-acc-name b, html[dir="rtl"] .post-chip-text, html[dir="rtl"] .post-row-text { text-align: right; }

/* platform admin */
.pub-panel { margin-bottom: 16px; }
.pub-panel h2 { font-size: 16px; margin: 0 0 4px; }
.pub-panel .ha-text p { margin: 0; max-width: 70ch; }
.pub-panel .pub-cfg-line { margin-top: 6px; }
/* v44: «أحداث الإعلانات / Ad events» — the same look as Human Agent / Publishing, its own class */
.ae-panel { margin-bottom: 16px; }
.ae-panel h2 { font-size: 16px; margin: 0 0 4px; }
.ae-panel .ha-text { flex: 1 1 360px; min-width: 0; }
.ae-panel .ha-text p { margin: 0; max-width: 70ch; }
.pub-warn { margin: 0; }

@media (max-width: 900px) {
  .pc { grid-template-columns: minmax(0, 1fr); }
  .pc-side { position: static; }
}
/* phones: a short page starts right under the top bar (the free height went to the top bar's row) */
@media (max-width: 860px) { .shell { grid-template-rows: auto 1fr; } }
@media (max-width: 860px) {
  .cal-grid, .cal-panel .cal-grid { display: none; }
  .cal-agenda { display: block; }
  .cal-panel { padding: 6px 14px; }
  .week-grid { grid-template-columns: minmax(0, 1fr); }
  .week-day { min-height: 0; }
  .posts-head .posts-views { min-width: 0; flex: 1 1 200px; }
  .dash-tabs { margin-top: 0; }
}
@media (max-width: 640px) {
  .overlay.overlay-post { padding: 0; }
  .dialog.dialog-post { width: 100%; max-width: none !important; min-height: 100dvh; margin: 0; border-radius: 0; padding: 16px; }
  .pc-actions { bottom: 0; padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }
  .pc-accs { grid-template-columns: minmax(0, 1fr); }
  .post-row { grid-template-columns: 44px minmax(0, 1fr); }
  .post-row .post-pill { grid-column: 2; justify-self: start; }
  .post-row-thumb { width: 44px; height: 44px; }
  .ins-prow { flex-wrap: wrap; }
  .ins-open { margin-inline-start: 66px; }
}

/* ---- v32 (API 1.38): the plan's limits, what each member may open, notifications ---- */
.plan-lock { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border: 1px dashed #d8d3c4; border-radius: var(--r); background: #fbfaf5; margin: 10px 0; }
.plan-lock .grow { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.plan-lock b { font-weight: 600; font-size: 14.5px; }
.plan-lock small { font-size: 12.5px; }
.plan-lock-ico { font-size: 20px; flex: none; }
.plan-lock.compact { padding: 10px 12px; gap: 10px; }
.plan-lock.compact b { font-size: 13.5px; }
.plan-lock.is-full { border-style: solid; border-color: #f3c24d; background: #fff8e3; }
.plan-cta { flex: none; }
.plan-ask { flex: none; max-width: 18ch; text-align: end; }
@media (max-width: 560px) { .plan-lock { flex-wrap: wrap; } .plan-cta, .plan-ask { margin-inline-start: 32px; text-align: start; max-width: none; } }
.limit-lines { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 6px; }
.limit-lines:empty { display: none; }
.limit-line { font-size: 12.5px; color: var(--ink-2); background: var(--canvas); border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; white-space: nowrap; }
.limit-line.is-full { background: #fff4d6; border-color: #f3c24d; color: #7a5200; }
/* ===== v34 — pages A (QA pass #4): templates, publishing, chatbot, auto-replies, AI, analytics, help, platform admin ===== */
/* WB4-29: a load that failed — the reason and "↻ Try again" side by side (they wrap on phones) */
.load-failed { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.load-failed .form-error { margin: 0; flex: 1 1 240px; }
/* WB3-19: the platform console — each part says it failed on its own */
.admin-kpi-fail { margin: -6px 0 16px; }
.admin-kpi-fail .form-error { margin: 0; padding: 6px 10px; font-size: 13px; }
.admin-failed .form-error { margin: 4px 0 0; }
/* PERF4-05: the templates' number picker starts at its usual width (it grew from nothing when the numbers came and pushed the
   buttons onto another line); on phones it takes the whole row, so the buttons are under it from the start */
.tpl-actions .tpl-ch { min-width: 300px; max-width: 100%; }
@media (max-width: 600px) { .tpl-actions .tpl-ch { width: 100%; min-width: 0; } }
/* PERF4-05: a page head's title keeps its own width, so whether the buttons sit beside it or under it no longer depends on
   how wide the text is — with the fallback font the subtitle pushed "Diagnose my problem" to the next line and the web font
   pulled it back up (CLS 0.42 on Help on a first visit; the same on Templates and the platform console) */
.help-page .page-head > div:first-child, .tpl-head > div:first-child, .admin-head > div:first-child { flex: 1 1 360px; min-width: 0; }
/* PERF4-05: Help keeps its place but shows once the web font is in (a first visit only, at most 2 s) */
.help-page.font-wait { visibility: hidden; }
/* WB4-11: "Try again" in the account diagnosis */
.diag-again { margin-top: 10px; }
/* WB4-19: the chatbot's trigger as three choices whose words wrap (a select cut them at 1366 and 390) */
.bot-trigger { border: 0; padding: 0; margin: 0 0 14px; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.bot-trigger legend { padding: 0; margin-bottom: 6px; }
.bot-tr { display: flex; align-items: flex-start; gap: 8px; cursor: pointer; font-size: 14px; min-width: 0; overflow-wrap: anywhere; }
.bot-tr input { flex: none; margin: 4px 0 0; }
/* WB4-20: the simulator's note when Wasil (AI) won't answer live */
.sim-ai-note { margin: 8px 0 0; font-size: 12.5px; }
/* WB4-21: a draft's optional day and time */
.pc-draft-time { margin: 8px 0 6px; align-items: center; }
.pc-draft-time .field-hint { flex: 1 1 220px; min-width: 0; }
.usage { display: flex; flex-direction: column; gap: 12px; margin: 8px 0 18px; }
.usage-row { display: flex; flex-direction: column; gap: 6px; }
.usage-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 14px; }
.usage-bar { height: 6px; border-radius: 999px; background: var(--canvas); border: 1px solid var(--line); overflow: hidden; }
.usage-bar > span { display: block; height: 100%; background: var(--ink); border-radius: inherit; }
.usage-row.is-near .usage-bar > span { background: #d99a1e; }
.usage-row.is-full .usage-bar > span { background: var(--red); }
.feat-list { list-style: none; margin: 8px 0 18px; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 18px; }
.feat-list li { font-size: 14px; }
.feat-list li.is-off { color: var(--muted); }
@media (max-width: 560px) { .feat-list { grid-template-columns: 1fr; } }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.nav-unread { margin-inline-start: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--lime); color: var(--lime-ink); font-size: 11.5px; font-weight: 700; display: inline-grid; place-items: center; line-height: 1; }
.nav-unread[hidden] { display: none; }
.nav-plan-lock { margin-inline-start: auto; font-size: 12px; opacity: .8; }
.nav-unread + .nav-plan-lock { margin-inline-start: 6px; }
.notif-btn { font-size: 15px; }
.notif-dialog section { border-bottom: 1px solid var(--line); padding-bottom: 14px; }
.notif-dialog section:last-of-type { border-bottom: 0; }
.notif-dialog h3 { margin: 0 0 6px; font-size: 15px; }
.notif-dialog .check { margin: 6px 0; }
.notif-state { display: flex; flex-direction: column; gap: 10px; padding: 12px 14px; border-radius: var(--r-sm); background: var(--canvas); margin-top: 8px; }
.notif-state p { margin: 0; font-size: 14px; }
.notif-state.is-on { background: var(--lime-soft); color: var(--lime-ink); }
.notif-state.is-warn { background: #fff4d6; color: #7a5200; }
.notif-install { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.notif-install p { margin: 0; }
.notif-banner { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px; margin: 0 0 10px; border-radius: var(--r-sm); background: var(--lime-soft); color: var(--lime-ink); font-size: 13.5px; }
.notif-banner[hidden] { display: none; }
.notif-banner > .grow { flex: 1 1 100%; line-height: 1.5; }
.mode-card.is-locked { opacity: .6; cursor: not-allowed; border-style: dashed; }
.mode-lock { font-size: 12px; font-weight: 500; color: var(--muted); }
.check.is-locked { color: var(--muted); }
.no-access .empty-state { max-width: 520px; margin: 40px auto; }
.no-access .nf-code { font-size: 44px; }
.pill-custom { background: #ece6ff; color: #3b2a8a; }
.lim-dialog .tbl td, .lim-dialog .tbl th { padding: 6px 8px; vertical-align: middle; }
.lim-in { width: 120px; }
div.stat { cursor: default; }

/* ================= v33 (QA pass #3) ================= */
/* WB3-20: a suspended / ended workspace is marked in the switcher */
.menu-item .org-lock { font-size: 11px; padding: 1px 8px; flex: none; }
/* WB3-23: an invitation whose e-mail didn't go */
.inv-mailed .pill-pending { font-size: 11.5px; }
/* WB2-13: an auto-reply that answers on every channel says so on its card */
.pill-all { background: #e4efff; color: #1d4ea0; font-size: 11.5px; padding: 1px 8px; }
/* the platform console: no workspace matches the search */
.admin-none { padding: 18px 4px; margin: 0; }
/* WB3-14: the channel check says it is running */
.diag-running { display: flex; align-items: center; gap: 8px; margin: 0; }
.spinner { display: inline-block; width: 14px; height: 14px; flex: none; border-radius: 50%; border: 2px solid var(--muted); border-inline-end-color: transparent; animation: spin .7s linear infinite; }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2s; } }

/* ================= v34 (QA pass #4) — pages B: team, invitation, settings, contacts ================= */
/* WB4-29: a list that failed inside a panel / dialog (the shared .load-failed of pages A) keeps some room around it */
.table > .load-failed, .list > .load-failed, .usage > .load-failed, .notes > .load-failed { padding: 10px 0; }
/* WB4-09: a feature WasilBox switched off for this workspace, in the Subscription box */
.feat-list .feat-off-here { font-size: 12.5px; color: #7a5200; }
/* WB4-15: what the invitation gives (its own permissions and channels) */
.inv-gives { margin: 4px 0 8px; font-size: 13.5px; color: var(--ink-2); }
.inv-gives p { margin: 0 0 4px; }
.inv-perms { margin: 0 0 6px; padding-inline-start: 18px; }
.inv-perms li { margin: 2px 0; line-height: 1.5; }
.inv-perms b { font-weight: 600; }
.inv-channels { overflow-wrap: anywhere; }

/* ================= v34 (QA pass #4) — inbox ================= */
/* WB4-08: grey rows until the list arrives; a list being refreshed keeps its rows (dimmed a moment) under a thin moving bar */
.conv-skel { display: flex; gap: 12px; align-items: center; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.skel { display: block; border-radius: 6px; background: linear-gradient(90deg, #eeeee8 25%, #f7f7f3 50%, #eeeee8 75%); background-size: 200% 100%; animation: skel 1.3s ease-in-out infinite; }
.skel-av { width: 34px; height: 34px; border-radius: 50%; flex: none; }
.skel-line { height: 11px; width: 72%; margin: 6px 0; }
.skel-line.skel-short { width: 46%; }
/* v37 (QA PERF5-07): a conversation being opened — grey shapes until its header, messages and reply box appear together */
.thread-wait { display: none; }
.thread.is-opening > .thread-wait { display: flex; flex-direction: column; gap: 14px; flex: 1; min-height: 0; padding-bottom: 20px; }
.thread.is-opening > :not(.thread-wait) { display: none !important; }
.thread-wait-head { display: flex; gap: 12px; align-items: center; padding: 14px 20px; background: var(--surface); border-bottom: 1px solid var(--line); }
.thread-wait-msg { height: 38px; width: 58%; border-radius: 14px; margin: 0 20px; }
.thread-wait-msg.out { align-self: flex-end; width: 44%; }
@keyframes skel { to { background-position: -200% 0; } }
.conv-list.is-loading::before { content: ''; display: block; position: sticky; top: 0; z-index: 2; height: 2px; margin-bottom: -2px; background: linear-gradient(90deg, transparent, var(--ink-2), transparent) no-repeat; background-size: 40% 100%; animation: list-bar 1s linear infinite; }
@keyframes list-bar { from { background-position: -60% 0; } to { background-position: 160% 0; } }
.conv-list.is-loading > .conv { opacity: .6; transition: opacity .2s .25s; }
/* WB4-29: a list / conversation that couldn't load says so, with "Try again" (.load-failed, as on the other pages) */
.list-err { margin: 16px 18px; }
.list-err.is-bar { margin: 8px 12px 10px; }
.list-err .form-error { font-size: 13.5px; }
.msgs > .thread-note.load-failed { margin: 8px auto; max-width: 560px; }
/* PERF4-08: "Searching…" inside the search field while a search runs */
.inbox-search { position: relative; }
.toolbar .inbox-search { width: 100%; max-width: 320px; }   /* v35 (review): Contacts' search keeps its width, nothing moves while it searches */
.search-busy { position: absolute; inset-inline-end: 12px; top: 50%; transform: translateY(-50%); display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); pointer-events: none; white-space: nowrap; }
.inbox-search.is-searching .input { padding-inline-end: 112px; }
.inbox-search.is-searching .input::-webkit-search-cancel-button { -webkit-appearance: none; display: none; }
/* WB4-25: the customer's number / @username stays whole; the channel badge gives way first (its full name in its tooltip) */
.thread-head .head-sub { flex-wrap: nowrap; }
.thread-head .head-sub .head-id { flex: 0 0 auto; max-width: 100%; }
.thread-head .head-sub .chan-badge { flex: 0 1 auto; min-width: 44px; }
/* WB4-27: the order sits at the end of the platforms' row */
.filter-row .plat-sort { order: 5; flex: 1 1 100%; display: flex; align-items: center; gap: 6px; min-width: 0; }
.filter-row .plat-sort .plat-row { order: 0; flex: 1 1 auto; min-width: 0; }
.filter-row .sort-sel { flex: 0 1 auto; min-width: 0; max-width: 60%; text-overflow: ellipsis; padding-inline-end: 26px; }
/* WB4-03 / PERF4-05: a picture keeps a box while it loads (its own size when known); "Load earlier messages" on top */
.media img[width], .media video[width] { height: auto; }
.media img.m-wait, .media video.m-wait { width: 240px; max-width: 100%; aspect-ratio: 4 / 3; background: var(--canvas); }
.older-row { display: flex; justify-content: center; padding: 0 0 4px; }
/* WB4-26: from 1280 px the Details panel sits beside the conversation instead of over its header (Status, Mark as unread
   and Details were under it at 1366); the list is a little narrower while it is open. Smaller screens and phones: as before */
@media (min-width: 1280px) and (max-width: 1440px) {
  .contact-panel { position: static; box-shadow: none; z-index: auto; width: 300px; }
  .inbox:has(> .contact-panel:not([hidden])) { grid-template-columns: 300px minmax(0, 1fr) auto; }
  .inbox:has(> .contact-panel:not([hidden])) .thread-head { gap: 8px 10px; padding-inline: 16px; }
  .inbox:has(> .contact-panel:not([hidden])) .thread-head > .grow { flex: 1 1 calc(100% - 56px); }   /* the name on its own line */
}
/* phones: the panel starts under the top bar (its title and ✕ were under the bar, so it couldn't be closed) */
@media (max-width: 860px) { .contact-panel { top: 56px; height: calc(100dvh - 56px); } }
@media (prefers-reduced-motion: reduce) { .skel, .conv-list.is-loading::before { animation: none; } }

/* ===== v34 — shell (lead) ===== */
/* QA WB4-18: Help / Support chat / Platform admin line up with the other menu items (they sat 12 px in, and the support
   button — 100% wide plus those margins — was 24 px wider than the menu: the sideways scrollbar under it on Windows) */
.admin-link { margin: 0 0 2px; }
.sidebar { overflow-x: hidden; }
/* PERF4-05: the support chat button is there from the start; a click while the chat loads shows it's working */
.support-chat-btn.is-busy { color: #cfcbc2 !important; cursor: progress; opacity: .75; }
.support-chat-btn.is-busy::after { display: none; }
/* QA WB4-29: no connection */
.offline-banner { background: #fff4d6; color: #7a5200; border: 1px solid #f3c24d; border-radius: var(--r-sm); padding: 9px 14px; margin-bottom: 16px; font-size: 14px; text-align: center; }
.offline-banner[hidden] { display: none; }

/* v36 (API 1.42) — the AI keys (Claude / OpenAI), voice notes as text, the wait before Wasil answers */
.ai-keys { display: grid; gap: 12px; min-width: 0; }
.key-row { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 12px 14px; background: var(--canvas); min-width: 0; }
.key-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.key-head b { font-size: 15px; }
.key-ico { font-size: 18px; line-height: 1; }
.key-status { display: inline-block; font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 999px; background: #ececea; color: var(--ink-2); white-space: nowrap; }
.key-status.st-ok { background: var(--lime-soft); color: var(--lime-ink); }
.key-status.st-invalid, .key-status.st-no_credit { background: var(--red-soft); color: #a8281f; }
.key-status.st-rate_limited, .key-status.st-error { background: #fff4d6; color: #7a5200; }
.key-does { margin: 4px 0 10px; }
.key-saved { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.key-mask { font-family: ui-monospace, Menlo, monospace; font-size: 14px; letter-spacing: .04em; unicode-bidi: isolate; }
.key-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.key-form .key-input { flex: 1 1 240px; min-width: 0; font-family: ui-monospace, Menlo, monospace; -webkit-text-security: disc; }   /* a text field shown as dots: password managers leave it alone (review) */
.key-row .field-hint { color: var(--ink-2); }
.key-note { margin: 8px 0; }
.key-note .block { display: block; margin-top: 2px; }
.key-actions { margin-top: 4px; }
.key-guide { margin-top: 10px; }
.key-guide summary { cursor: pointer; font-weight: 600; font-size: 14px; }
.key-guide ol { margin: 8px 0; padding-inline-start: 22px; display: grid; gap: 4px; font-size: 14px; }
.key-guide a { font-size: 14px; }
.ai-voice { border-top: 1px dashed var(--line); padding-top: 10px; display: grid; gap: 4px; }
.ai-voice-state { font-weight: 600; }
.ai-voice-state.off { color: var(--ink-2); font-weight: 500; }
/* v44 (API 1.48): the model choice and its approximate cost */
.ai-model { border-top: 1px dashed var(--line); padding-top: 10px; display: grid; gap: 6px; min-width: 0; }
.ai-model h3 { margin: 0; font-size: 1rem; }
.model-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
/* (the mode cards' look, a class of its own: the Wasil modes' tests and code select .mode-card) */
.model-card { font: inherit; text-align: start; display: flex; flex-direction: column; gap: 4px; padding: 12px; border: 2px solid var(--line); border-radius: var(--r); background: var(--surface); cursor: pointer; color: inherit; }
.model-card.on { border-color: var(--lime); background: var(--lime-soft); }
.model-card.is-locked { opacity: .6; cursor: not-allowed; border-style: dashed; }
.model-card .model-name { font-weight: 600; font-size: .85rem; color: var(--ink-2); overflow-wrap: anywhere; }
.model-card .model-cost { font-weight: 600; font-size: .9rem; }
.ai-model-month { font-weight: 600; margin: 0; }
.ai-model-notice { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ai-model-platform { margin: 0; }
.why-openai { border-inline-start: 3px solid var(--lime); padding-inline-start: 8px; }
.try-pick { margin-bottom: 8px; }
.try-pick .field { margin: 0; }
.try-meta { margin-top: 4px; }
@media (max-width: 700px) { .model-grid { grid-template-columns: 1fr; } }
.merge-wait { max-width: 460px; margin: 10px 0 6px; }
.transcript { margin: 6px 0 0; font-size: 13.5px; line-height: 1.5; overflow-wrap: anywhere; }
.transcript .tr-label { font-weight: 600; }
.transcript.muted { color: var(--muted); font-size: 12.5px; }
.transcript.unclear .tr-text { color: var(--ink-2); }
.admin-keys { margin-top: 4px; font-size: 12px; line-height: 1.8; }
.admin-keys .key-status { font-weight: 500; }

/* ===== v38 (API 1.43) — 📞 Smart calls: the page, the line on Channels, the Inbox's call card, the Dashboard, the admin ===== */
.plat-phone { background: #e8590c; } .dot-phone { background: #e8590c; } .chan-phone .chan-ico { background: #e8590c; } .ci-phone { background: #e8590c; }
.calls-page { display: flex; flex-direction: column; gap: 14px; }
.calls-page > .page-head { margin-bottom: 0; }
.calls-top { display: grid; gap: 6px; }
.calls-top p { margin: 0; }
.calls-ready { align-items: center; }
.calls-ready .pill { font-weight: 700; }
.calls-steps { gap: 10px; }
.calls-step-state { flex: none; }
.calls-step .sec-body > .stack, .calls-step .sec-body > fieldset > .stack { gap: 14px; }
fieldset.calls-locked { border: 0; margin: 0; padding: 0; min-width: 0; opacity: .78; }
.calls-form.calls-locked { opacity: .78; }
.calls-key { align-items: center; }
.calls-key p { margin: 0 0 4px; }
.calls-key .form-error { flex-basis: 100%; margin: 0; }
.calls-form { display: grid; gap: 4px; max-width: 620px; }
.calls-h3 { font-size: 15px; margin: 0 0 6px; }
.calls-secret, .calls-check, .calls-test, .calls-pbx, .calls-remove, .calls-sub { border-top: 1px solid var(--line); padding-top: 12px; }
.calls-addrs { display: grid; gap: 10px; }
.calls-copy { display: grid; gap: 4px; min-width: 0; }
.calls-copy .copy-box { margin-bottom: 0; }
.calls-copy .copy-box code { min-width: 0; white-space: normal; overflow-wrap: anywhere; word-break: break-all; text-overflow: clip; font-size: 13px; }   /* the whole address stays readable on a phone */
.calls-checks { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 6px; font-size: 14px; }
.calls-checks li.ok > span:first-child { color: var(--lime-ink); font-weight: 800; }
.calls-checks li.bad > span:first-child { color: var(--red); font-weight: 800; }
.calls-checks .block { display: block; }
.calls-wait { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.calls-got { background: var(--lime-soft); color: var(--lime-ink); padding: 10px 12px; border-radius: var(--r-sm); margin: 0 0 8px; }
.calls-got p { margin: 4px 0; color: var(--ink); }
.calls-remove { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.calls-brand { max-width: 380px; margin-bottom: 10px; }
.calls-guide ol li, .calls-pbx .steps-list li { overflow-wrap: anywhere; }
.calls-og th { text-align: start; width: 32%; font-weight: 600; vertical-align: top; }
.calls-og td { overflow-wrap: anywhere; }
.calls-script .calls-part { border-top: 1px dashed var(--line); padding-top: 10px; display: grid; gap: 4px; }
.calls-script textarea { resize: vertical; }
.calls-words { margin: 0; font-size: 13.5px; }
.calls-words.form-warn { margin: 0; }
.calls-version { border-bottom: 1px solid var(--line); padding: 8px 0; align-items: center; flex-wrap: wrap; }
.calls-sample { width: 100%; max-width: 420px; }
.calls-voice .segmented { max-width: 560px; flex-wrap: wrap; }
.calls-voice .seg { white-space: normal; }
.calls-try .btn-lg { min-width: 200px; }
.calls-clock { font-variant-numeric: tabular-nums; font-size: 18px; align-self: center; }
.calls-try-state { margin: 0; font-weight: 600; }
.calls-live { list-style: none; margin: 0; padding: 10px 12px; display: grid; gap: 6px; max-height: 300px; overflow-y: auto; background: var(--canvas); border: 1px solid var(--line); border-radius: var(--r-sm); font-size: 14px; }
.calls-live:empty { display: none; }
.calls-live li { overflow-wrap: anywhere; }
.calls-who { font-weight: 700; }
.calls-l-assistant .calls-who { color: var(--lime-ink); }
.calls-l-note { color: var(--ink-2); font-style: italic; }
.calls-main { align-items: center; }
.calls-main .block { display: block; }
.calls-when { flex-direction: column; gap: 8px; }
.calls-when .check { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.calls-num { width: 90px; }
.calls-when-hint { background: var(--canvas); padding: 10px 12px; border-radius: var(--r-sm); line-height: 1.7; overflow-wrap: anywhere; }
.calls-transfers { display: grid; gap: 8px; }
.calls-tr-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 90px auto auto; gap: 6px; align-items: center; }
.calls-tr-row .input { min-width: 0; width: 100%; }
.calls-ext { font-family: ui-monospace, Menlo, monospace; text-align: center; }
.calls-disc { margin: 4px 0; padding: 8px 12px; background: var(--canvas); border-radius: var(--r-sm); font-size: 14px; }
.calls-limits { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px 14px; }
.calls-models .choice-card { align-items: flex-start; text-align: start; border-style: solid; cursor: pointer; padding: 12px 14px; gap: 4px; }
.calls-models .choice-card.on { border-color: var(--lime); background: var(--lime-soft); }
.calls-models .choice-card input { margin: 0; }
.calls-rec { display: grid; gap: 10px; }
.calls-rec h2, .calls-rec > p { margin: 0; }
.calls-rec .key-input { font-family: ui-monospace, Menlo, monospace; -webkit-text-security: disc; }
.calls-fp { display: grid; gap: 6px; }
.calls-fp p { margin: 0; }
.calls-fp-code { display: block; font-size: 12.5px; padding: 6px 8px; background: var(--surface); border-radius: 6px; overflow-wrap: anywhere; word-break: break-all; }
.calls-connect .plat { color: #fff; }
@media (max-width: 640px) {
  .calls-tr-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .calls-tr-row .calls-ext { grid-column: 1; }
  .calls-try .btn-lg { width: 100%; min-width: 0; }
  .calls-models { grid-template-columns: minmax(0, 1fr); }
}
/* the Inbox: a call's card (its header, the summary, the details, the recording, the folded transcript) */
.call-card { display: grid; gap: 6px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); min-width: min(100%, 260px); max-width: 100%; }
.call-card p { margin: 0; }
.call-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; font-size: 13.5px; }
.call-head .pill { font-size: 11.5px; padding: 1px 8px; }
.call-lang { background: #e8f0ff; color: #1d4ea8; font-weight: 700; letter-spacing: .02em; }
.call-out-handled { background: var(--lime-soft); color: var(--lime-ink); }
.call-out-transferred { background: #e8f0ff; color: #1d4ea8; }
.call-out-message_taken { background: #fff4d6; color: #7a5200; }
.call-out-caller_hung_up { background: #ececea; color: var(--ink-2); }
.call-out-failed, .call-out-rejected { background: var(--red-soft); color: #a8281f; }
.call-test { background: #f1e8ff; color: #5b2ca0; }
.call-summary { white-space: pre-line; overflow-wrap: anywhere; }
.call-details { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 10px; margin: 0; font-size: 13.5px; }
.call-details dt { color: var(--muted); }
.call-details dd { margin: 0; overflow-wrap: anywhere; }
.call-consent { color: var(--lime-ink); font-weight: 600; font-size: 13.5px; }
.call-audio { width: 100%; max-width: 360px; height: 36px; }
.call-tr summary { cursor: pointer; font-weight: 600; font-size: 13.5px; }
.call-tr ol { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 4px; max-height: 360px; overflow-y: auto; font-size: 13.5px; }
.call-tr li { padding: 3px 0; border-bottom: 1px dashed var(--line); overflow-wrap: anywhere; }
.call-tr .tr-who { font-weight: 700; }
.call-tr .tr-assistant .tr-who { color: var(--lime-ink); }
.call-composer { align-items: center; padding: 10px 12px; }
.call-composer p { margin: 0; }
/* the Dashboard's calls */
.dash-calls .stats { margin-bottom: 12px; }
.calls-transfers > .btn { justify-self: start; }
.calls-when-hint ol { margin: 0; padding-inline-start: 20px; display: grid; gap: 6px; }
.calls-when-hint p { margin: 0; }
.calls-page .switch { flex: none; }   /* a long label beside it must not squeeze the switch (its knob covered the text on phones) */
/* a line of a call (the Inbox's transcript, 🎤 Try by voice): who on one side, the words as their own block in their own
   direction — an English line in an Arabic page starts on the left and wraps as English (and the reverse) */
.calls-live li:not(.calls-l-note), .call-tr li { display: flex; gap: 6px; align-items: baseline; }
.calls-live li > bdi, .call-tr li > .tr-text { flex: 1 1 auto; min-width: 0; text-align: start; }
.calls-who, .call-tr .tr-who, .call-tr li > small { flex: none; }
/* v37 (QA WB6-05): the AI page's unsaved changes — a bar kept at the bottom of the screen with its own Save */
.unsaved-bar { position: sticky; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); z-index: 30; display: flex; align-items: center; gap: 12px; margin-top: 18px; padding-block: 10px; padding-inline: 16px 12px; border-radius: var(--r); background: var(--dark); color: #f4f2ec; box-shadow: 0 8px 28px rgba(30, 28, 25, .22); }
.unsaved-bar[hidden] { display: none; }
.unsaved-bar .grow { font-size: 14px; font-weight: 500; }

/* v39 (QA PERF5-10): a workspace switch shows at once — the page dims (held still by inert) and the switcher spins until the new
   workspace is drawn */
#app.is-switching .content { opacity: .55; transition: opacity .12s ease-out; }
.org-btn.is-busy { color: inherit !important; }
.org-btn.is-busy .org-caret { visibility: hidden; }
.org-btn.is-busy::after { inset-inline-end: 12px; top: calc(50% - 8px); border-color: currentColor transparent currentColor currentColor; }
@media (prefers-reduced-motion: reduce) { #app.is-switching .content { transition: none; } }

/* v39 (QA WB6-24): the bot editor on a phone — the attachment row wraps (Upload went 32–62 px off the screen) and the on / off
   switch's checkbox covers the switch itself (it took the focus at a spot off the screen) */
.media-row > .input { flex: 1 1 180px; min-width: 0; }
.switch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; }
.botmap:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* v39 (QA WB6-10): Platform admin → Limits on a phone — each limit is a small card (its name on top, then the plan's value, what is
   used, what applies now and this workspace's own value, each with its column name); the five columns cut the names */
@media (max-width: 560px) {
  .lim-tbl thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .lim-tbl, .lim-tbl tbody { display: block; width: 100%; }
  .lim-tbl tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
  .lim-dialog .lim-tbl td { display: block; padding: 2px 0; border: 0; }
  .lim-tbl td:first-child { grid-column: 1 / -1; font-weight: 600; }
  .lim-tbl td:last-child { grid-column: 1 / -1; }
  .lim-tbl td:empty { display: none; }
  .lim-tbl td[data-label]::before { content: attr(data-label); display: block; color: var(--muted); font-size: 12px; }
  .lim-tbl .lim-in, .lim-tbl select { width: 100%; }
}

/* v39 (QA WB6-20 / WB6-21): Templates and Broadcasts on a phone — each row a small card: its name on top, then every value under
   its column's name (five / six columns cut the names and pushed the status off the screen) */
@media (max-width: 560px) {
  .tbl-cards thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .tbl-cards, .tbl-cards tbody { display: block; width: 100%; }
  .tbl-cards tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 12px; padding: 12px 4px; border-bottom: 1px solid var(--line); }
  .tbl-cards tr:last-child { border-bottom: 0; }
  .tbl .tbl-cards td, .tbl-cards td { display: block; padding: 0; border: 0; min-width: 0; overflow-wrap: anywhere; }
  .tbl-cards td:first-child { grid-column: 1 / -1; }
  .tbl-cards td:last-child:not([data-label]) { grid-column: 1 / -1; }
  .tbl-cards td:empty { display: none; }
  .tbl-cards td[data-label]::before { content: attr(data-label); display: block; color: var(--muted); font-size: 12px; margin-bottom: 2px; }
  .tbl-cards td.row { display: flex; flex-wrap: wrap; justify-content: flex-start; white-space: normal; }
}
.tpl-name { overflow-wrap: normal; word-break: normal; }

/* v39 (QA WB6-25): touch targets of at least 24 px (WCAG 2.5.8) — the clickable area grows, the layout stays: an inline link's
   padding doesn't move the lines; the labels around check boxes and radio buttons, the icon buttons and the "How do I get a key?"
   summaries get a minimum size */
.link { padding-block: 4px; }
.check, .bot-tr { min-height: 24px; }
.icon-btn { min-width: 28px; min-height: 28px; }
details > summary { min-height: 24px; }

/* v39 (QA WB5-18): the channels' marks keep their platforms' colours with text that can be read (≥ 4.5:1): dark letters on
   WhatsApp's green (white was 1.98:1), a darker shade of Messenger's blue, Instagram's pink and the phone's orange */
.chan-whatsapp .chan-ico, .plat-whatsapp { color: #0b2e17; }
.chan-messenger .chan-ico, .chan-facebook_comments .chan-ico, .plat-messenger, .plat-facebook_comments { background: #1466d6; }
.chan-instagram .chan-ico, .chan-instagram_comments .chan-ico, .plat-instagram, .plat-instagram_comments { background: #c42a5e; }
.chan-phone .chan-ico, .plat-phone, .ci-phone { background: #c2410c; }
/* (review) the Inbox's platform filters too */
.ci-whatsapp { color: #0b2e17; } .ci-messenger, .ci-facebook_comments { background: #1466d6; } .ci-instagram, .ci-instagram_comments { background: #c42a5e; }

.set-sub { margin-top: 22px; }   /* v39 (QA §7 Settings): "Company details" no longer touches the line above it */

/* v39 (§8.4): Delete workspace — the accounts are tick boxes, not a bulleted list */
.dw-acc-list { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 6px; }
.dw-acc.is-kept { color: var(--muted); }
/* v39 (review): on a phone the Channels page's connect cards wait below the connected list until it is known (no jump) */
.ch-page.is-loading > .ch-connect { visibility: hidden; }
/* v40 (Meta App Review): an Instagram row names its account — «Instagram · [picture] @username»; a long @username ends with "…" */
.ig-acct { display: inline-flex; align-items: center; gap: 6px; max-width: calc(100% - 6px); min-width: 0; vertical-align: middle; margin-inline-start: 6px; }
.ig-acct-sep { color: var(--muted); flex: none; }
.ig-acct-pic { width: 20px; height: 20px; border-radius: 50%; object-fit: cover; flex: none; }
.ig-acct-user { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; unicode-bidi: isolate; }
/* v40: the open conversation's badge — the Instagram account after the name */
.chan-badge .chan-user { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; unicode-bidi: isolate; }

/* ---------------------------------------------------------------- v41 (API 1.45): ads, photos / videos in auto-replies */
.pill-ads { background: #fff1e0; color: #8a4b00; font-size: 11.5px; padding: 1px 8px; }
.ad-hint { margin: 0 0 12px; }
.ads-picker { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.ads-mode, .media-layout { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; }
.ads-mode legend, .media-layout legend { width: 100%; margin-bottom: 4px; }
.media-layout .field-hint { width: 100%; margin: 2px 0 0; }
.ads-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 260px; overflow-y: auto; }
.ad-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-sm); cursor: pointer; min-width: 0; }
.ad-row img, .ad-row .ad-noimg { width: 44px; height: 44px; border-radius: 6px; object-fit: cover; flex: none; display: grid; place-items: center; background: var(--canvas); }
.ad-row .grow { min-width: 0; display: flex; flex-direction: column; overflow-wrap: anywhere; }
.ads-paste { align-items: center; flex-wrap: wrap; }
.ads-paste .input { flex: 1 1 180px; min-width: 0; }
.ads-paste .field-label { margin: 0; }
.media-editor { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.media-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.media-list:empty { display: none; }
.media-item { display: flex; align-items: flex-start; gap: 10px; padding: 8px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); min-width: 0; }
.media-thumb { width: 64px; height: 64px; flex: none; border-radius: 8px; overflow: hidden; background: var(--canvas); display: grid; place-items: center; }
.media-thumb img, .media-thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-fields { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.media-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-actions { display: flex; flex-direction: column; gap: 2px; flex: none; }
.media-actions .icon-btn { width: 30px; height: 28px; font-size: 12px; }
@media (max-width: 600px) {
  .media-thumb { width: 52px; height: 52px; }
  .media-actions { flex-direction: row; flex-wrap: wrap; width: 64px; justify-content: flex-end; }
}
.ad-line { display: block; color: #8a4b00; overflow-wrap: anywhere; margin-top: 2px; }
.ad-line .link { color: inherit; text-decoration: underline; }
.standby-note { display: block; color: var(--muted); margin-top: 2px; overflow-wrap: anywhere; cursor: help; }
.ctx-ad { color: #8a4b00; }
.msg-cards { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 4px; max-width: min(520px, 72vw); white-space: normal; }
.msg-card { flex: 0 0 180px; scroll-snap-align: start; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface); display: flex; flex-direction: column; }
.msg-card img, .msg-card video, .msg-card-ph { width: 100%; aspect-ratio: 1.91 / 1; object-fit: cover; display: block; background: var(--canvas); }
.msg-card-ph { display: grid; place-items: center; font-size: 22px; }
.msg-card > b, .msg-card > p { padding: 6px 10px 0; margin: 0; font-size: 13px; }
.msg-card .wa-btns { padding: 6px 8px 8px; margin-top: auto; }
.reply-here { margin-top: 4px; font-size: 12px; padding: 2px 8px; }
.reply-here.on { background: var(--lime-soft); border-color: transparent; color: var(--lime-ink); }
.reply-target { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 13px; padding: 0 2px 6px; min-width: 0; }
.reply-target q { overflow-wrap: anywhere; min-width: 0; }
.mention-check { margin-inline-start: auto; font-size: 13px; }
/* v41 — WhatsApp carousel templates: the text, then the cards side by side that swipe (Templates, Campaigns) */
.wa-carousel { display: flex; flex-direction: column; gap: 6px; max-width: 320px; min-width: 0; }
.wa-cards { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 2px 0 6px; min-width: 0; direction: rtl; }
[dir='ltr'] .wa-cards { direction: ltr; }
.wa-card { flex: 0 0 78%; scroll-snap-align: start; background: #fff; border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; font-size: 13px; }
.wa-card img, .wa-card video, .wa-card-ph { width: 100%; aspect-ratio: 1.91 / 1; object-fit: cover; display: block; background: #f0f0f0; }
.wa-card-ph { display: grid; place-items: center; font-size: 26px; color: #666; }
.wa-card > p { padding: 6px 8px 0; margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.wa-card .wa-btns { padding: 6px 8px 8px; margin-top: auto; }
.wa-card .wa-btn { border: 1px solid #e6e6e6; }
.pill-car { margin-inline-start: 6px; font-size: 11px; vertical-align: middle; }
.car-list { display: flex; flex-direction: column; gap: 8px; }
.car-item { display: flex; align-items: flex-start; gap: 10px; padding: 8px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); min-width: 0; }
.car-thumb { width: 72px; height: 72px; flex: none; border-radius: 8px; object-fit: cover; display: block; background: var(--canvas); }
.car-thumb-empty { display: grid; place-items: center; font-size: 22px; color: var(--muted); }
.car-fields { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.car-fields .field { margin: 0; }
.car-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.car-actions { display: flex; flex-direction: column; gap: 2px; flex: none; }
.car-actions .icon-btn { width: 30px; height: 28px; font-size: 12px; }
.car-src { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 13px; }
.car-src .check { margin: 0; }
@media (max-width: 600px) {
  .car-thumb { width: 56px; height: 56px; }
  .car-actions { flex-direction: row; flex-wrap: wrap; width: 64px; justify-content: flex-end; }
}
.renew-failed ul { margin: 6px 0 0; padding-inline-start: 18px; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.renew-why { white-space: pre-line; overflow-wrap: anywhere; }
/* v41 — what to change at Meta so the automatic answers reach messages from ads (Auto-replies, Chatbot, AI assistant) */
.ads-note { border: 1px solid #d6e2f2; background: #f5f9ff; border-radius: var(--r); padding: 10px 14px; margin: 0 0 14px; font-size: 13.5px; line-height: 1.6; }
.ads-note summary { cursor: pointer; font-weight: 600; }
.ads-note p { margin: 6px 0 0; }
.ads-note ol { margin: 6px 0 0; padding-inline-start: 20px; display: flex; flex-direction: column; gap: 4px; }
.ads-path { background: #fff; border: 1px solid #e1e7f0; border-radius: 6px; padding: 0 5px; white-space: nowrap; }

/* v42 (the owner's request) — «🔥 Interested» stands out among a conversation's tags */
.chip.chip-hot { background: #ffe9dc; color: #8a2c0d; }
/* v42: Home's six numbers — two a row on a phone, three below 1000 px; a long word never widens the page (review) */
.home-stats .stat { min-width: 0; }
.home-stats .stat span { overflow-wrap: anywhere; }
@media (max-width: 1000px) { .home-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 560px) { .home-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* v43 (QA pass #7, UX7-01) — the person's pending invitations above «Create your workspace» */
.onb-checking { position: fixed; inset: 0; margin: 0; display: flex; align-items: center; justify-content: center; gap: 6px; pointer-events: none; }   /* over the page while the card waits — never in its flow */
.onb-invites { border: 1px solid #d9e7a1; background: var(--lime-soft); border-radius: var(--r); padding: 14px 16px; margin: 0 0 18px; }
.onb-invites h2 { font-size: 16px; margin: 0 0 8px; }
.onb-invite { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.onb-invite + .onb-invite { margin-top: 10px; padding-top: 10px; border-top: 1px solid #d9e7a1; }
.onb-invite p { margin: 0; flex: 1 1 220px; min-width: 0; overflow-wrap: anywhere; }
.onb-or { margin: 0 0 14px; color: var(--ink-2); font-weight: 600; }

/* v43 (QA pass #7, WB7-03): an option's ✕ in the bot editor keeps its 28 px (the row's "min-width: 0" made it 22 px with the
   real fonts) — more specific than ".flow .opt-row > *" */
.flow .opt-row > .icon-btn { min-width: 28px; }
/* v43 (WB6-25p): Home's setup links are a tap target of at least 24 px (23 px before) */
.setup-link { min-height: 24px; display: flex; align-items: center; }
/* v43 (PERF7-04): Analytics' filters keep their shape when the channel list arrives — the select grew to its longest name, the
   row went under the title and the numbers moved down 43 px on a phone */
.dash-filters .input { width: 220px; max-width: 100%; text-overflow: ellipsis; }
@media (max-width: 700px) {
  .dash-head > .dash-filters { flex: 1 1 100%; flex-wrap: nowrap; }
  .dash-filters .input { flex: 1 1 0; width: auto; min-width: 0; }
}
/* v43 (UX7-06): the steps at Meta read in order on a phone (the menu names wrapped into one hard-to-follow chain) */
@media (max-width: 600px) {
  .ads-note ol { gap: 8px; }
  .ads-note li { line-height: 2; }
  .ads-path { display: inline-block; line-height: 1.5; }
}

/* v44: Platform admin — AI models */
.aim-old { color: var(--warn, #b45309); }
.aim-tbl td { vertical-align: top; }
.aim-registry summary { cursor: pointer; margin: 8px 0; }

/* v44 (API 1.48, §4.4): «عميل محتمل / شراء» in a Click-to-WhatsApp conversation's header; notes on a WhatsApp number's card */
.ad-events { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; min-width: 0; }
.ad-ev-btns .btn { padding-block: 2px; }
.ad-ev-btn.is-sent { color: #166534; border-color: currentColor; }
.ad-ev-line { display: block; overflow-wrap: anywhere; color: var(--muted); }
.ad-ev-sent { color: #166534; }
.ad-ev-failed { color: var(--red); }
.ad-ev-unsure { color: #92400e; }
.ad-buy-row > * { flex: 1 1 140px; min-width: 0; }
.acct-notes { display: flex; flex-direction: column; gap: 6px; padding: 8px 12px 10px; }
.acct-note { margin: 0; font-size: .9em; overflow-wrap: anywhere; }
.acct-note.warn { color: #92400e; }
.acct-note.ok { color: #166534; }
