:root {
  --fs-dev: 1; --fs-user: 1; --fs: calc(var(--fs-dev) * var(--fs-user));
  --bg: #f5f6f8; --panel: #fff; --ink: #18212f; --muted: #6b7686; --line: #e5e8ee;
  --brand: #128c7e; --brand-2: #25d366; --brand-ink: #075e54; --soft: #e9f7f3; --side: #0f2a28; /* --brand / --side are set per client (Vejace Super admin) */
  --danger: #d93f4c; --warn: #d98a00; --ok: #1a9b5c; --info: #2f6fdb;
  --rainbow: linear-gradient(90deg,#075e54,#128c7e,#25d366,#c9a227);
  --radius: 10px; --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, Segoe UI, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font-size: calc(14px * var(--fs)); }
a { color: var(--brand); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1 { font-size: calc(20px * var(--fs)); margin: 0; font-weight: 700; }
h2 { font-size: calc(16px * var(--fs)); margin: 0 0 12px; font-weight: 600; }
h3 { font-size: calc(14px * var(--fs)); margin: 0 0 8px; font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: calc(12px * var(--fs)); }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0,1fr)); }

/* shell */
.shell { display: grid; grid-template-columns: 220px 1fr; height: 100vh; }
.side { background: var(--side); color: #d7ebe7; display: flex; flex-direction: column; position: relative; }
.side::before { content: ''; height: 4px; background: var(--rainbow); }
.brand { padding: 18px 18px 14px; display: flex; align-items: center; gap: 10px; }
.brand img { width: 34px; height: 34px; border-radius: 8px; object-fit: cover; background: #fff; flex: none; }
.brand b { display: block; font-size: calc(15px * var(--fs)); color: #fff; }
.brand span { font-size: calc(11px * var(--fs)); opacity: .7; letter-spacing: .02em; }
.nav { display: flex; flex-direction: column; padding: 6px 10px; gap: 2px; }
.nav a { color: #cfe4e0; padding: 9px 12px; border-radius: 8px; display: flex; align-items: center; gap: 10px; font-weight: 500; }
.nav a:hover { background: rgba(255,255,255,.06); }
.nav a.active { background: rgba(255,255,255,.13); color: #fff; }
.nav .count { margin-left: auto; background: var(--brand-2); color: #04332b; font-size: calc(11px * var(--fs)); font-weight: 700; border-radius: 99px; padding: 1px 7px; }
.side .me { margin-top: auto; padding: 14px 18px; border-top: 1px solid rgba(255,255,255,.08); font-size: calc(12px * var(--fs)); }
.side .me button { background: none; border: 0; color: #9fc9c1; cursor: pointer; padding: 0; margin-top: 4px; }
.main { overflow: auto; display: flex; flex-direction: column; min-width: 0; }
.page { padding: 22px 26px; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.sim-banner { background: #fff7e0; border-bottom: 1px solid #f3dfa4; color: #7a5600; padding: 8px 26px; font-size: calc(13px * var(--fs)); }

/* cards & tables */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.card.flush { padding: 0; overflow: hidden; }
.stat .v { font-size: calc(26px * var(--fs)); font-weight: 700; margin-top: 4px; }
.stat .l { color: var(--muted); font-size: calc(12px * var(--fs)); text-transform: uppercase; letter-spacing: .04em; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: calc(12px * var(--fs)); color: var(--muted); font-weight: 600; background: #fafbfc; text-transform: uppercase; letter-spacing: .03em; }
tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; } tr.click:hover td { background: #f8fbfa; }
.empty { padding: 40px; text-align: center; color: var(--muted); }

/* controls */
.btn { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 8px 14px; cursor: pointer; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.btn:hover { background: #f6f7f9; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-ink); }
.btn.danger { color: var(--danger); }
.btn.sm { padding: 5px 10px; font-size: calc(12px * var(--fs)); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.input, select.input, textarea.input { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #fff; outline: none; }
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(18,140,126,.12); }
textarea.input { resize: vertical; min-height: 80px; }
label.f { display: block; margin-bottom: 12px; }
label.f > span { display: block; font-size: calc(12px * var(--fs)); font-weight: 600; color: var(--muted); margin-bottom: 5px; }
.hint { font-size: calc(12px * var(--fs)); color: var(--muted); margin-top: 4px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tabs a { padding: 9px 14px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; }
.tabs a.active { color: var(--brand-ink); border-color: var(--brand); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 5px; border-radius: 99px; padding: 2px 9px; font-size: calc(12px * var(--fs)); font-weight: 600; background: #eef0f4; }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; }
.chip.pick { cursor: pointer; border: 1px solid transparent; }
.chip.pick.on { border-color: currentColor; background: #fff; }
.badge { display: inline-block; font-size: calc(11px * var(--fs)); font-weight: 700; padding: 2px 8px; border-radius: 6px; letter-spacing: .02em; text-transform: uppercase; }
.b-gray { background: #eef0f4; color: #4b5565; } .b-green { background: #dcf5e7; color: #10703f; }
.b-amber { background: #fff1d6; color: #8a5a00; } .b-red { background: #fde4e6; color: #a8232f; }
.b-blue { background: #e1ecff; color: #2350a8; } .b-purple { background: #efe6ff; color: #5b2ea8; }
.progress { height: 8px; background: #edf0f3; border-radius: 99px; overflow: hidden; display: flex; }
.progress i { display: block; height: 100%; }

/* modal & toast */
.modal-wrap { position: fixed; inset: 0; background: rgba(15,23,42,.45); display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow: auto; z-index: 50; }
.modal { background: #fff; border-radius: 14px; width: 100%; max-width: 560px; box-shadow: 0 20px 50px rgba(0,0,0,.2); }
.modal.wide { max-width: 980px; }
.modal header { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; }
.modal header h2 { margin: 0; }
.modal .body { padding: 18px 20px; }
.modal footer { padding: 12px 20px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; }
.x { margin-left: auto; background: none; border: 0; font-size: calc(22px * var(--fs)); cursor: pointer; color: var(--muted); line-height: 1; }
#toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 99; }
.toast { background: #18212f; color: #fff; padding: 10px 14px; border-radius: 8px; box-shadow: var(--shadow); max-width: 380px; }
.toast.err { background: var(--danger); }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(circle at 20% 10%, #e3f7ef, transparent 50%), radial-gradient(circle at 90% 90%, #efe6ff, transparent 50%), var(--bg); }
.login .card { width: 360px; padding: 28px; position: relative; overflow: hidden; }
.login .card::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 5px; background: var(--rainbow); }
.login h1 { margin-bottom: 4px; }
.motto { font-style: italic; color: var(--brand-ink); font-size: calc(13px * var(--fs)); }

/* inbox */
.inbox { display: grid; grid-template-columns: 320px 1fr 340px; grid-template-rows: minmax(0, 1fr); position: relative; height: 100%; min-height: 0; }
.inbox > * { min-height: 0; }
.convos { border-right: 1px solid var(--line); background: #fff; display: flex; flex-direction: column; }
.convos .top { padding: 14px; border-bottom: 1px solid var(--line); }
.convos .filters { display: flex; gap: 4px; margin-top: 10px; flex-wrap: wrap; }
.convos .filters a { font-size: calc(12px * var(--fs)); padding: 4px 9px; border-radius: 99px; color: var(--muted); cursor: pointer; font-weight: 600; }
.convos .filters a.on { background: var(--soft); color: var(--brand-ink); }
.convo-list { overflow: auto; flex: 1; }
.convo { padding: 12px 14px; border-bottom: 1px solid #f0f2f5; cursor: pointer; display: grid; grid-template-columns: 38px 1fr auto; gap: 10px; align-items: center; }
.convo:hover { background: #f8faf9; } .convo.on { background: var(--soft); }
.avatar { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #fff; font-size: calc(14px * var(--fs)); }
.convo .n { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.convo .p { color: var(--muted); font-size: calc(12px * var(--fs)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.convo .meta { text-align: right; font-size: calc(11px * var(--fs)); color: var(--muted); }
.unread { background: var(--brand-2); color: #04332b; border-radius: 99px; font-size: calc(11px * var(--fs)); font-weight: 700; padding: 1px 7px; display: inline-block; margin-top: 4px; }
.thread { display: flex; flex-direction: column; background: #efeae2; min-width: 0; }
.thread .head { background: #fff; padding: 10px 16px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.msgs { flex: 1; overflow: auto; padding: 18px 8%; display: flex; flex-direction: column; gap: 6px;
  background-image: radial-gradient(rgba(0,0,0,.035) 1px, transparent 1px); background-size: 18px 18px; }
.bubble { max-width: 70%; padding: 7px 10px 5px; border-radius: 9px; box-shadow: 0 1px 1px rgba(0,0,0,.08); word-wrap: break-word; position: relative; }
.bubble.in { background: #fff; align-self: flex-start; border-top-left-radius: 2px; }
.bubble.out { background: #d9fdd3; align-self: flex-end; border-top-right-radius: 2px; }
.bubble.bot { background: #e7f0ff; }
.bubble .who { font-size: calc(11px * var(--fs)); font-weight: 700; color: var(--brand-ink); margin-bottom: 2px; }
.bubble.bot .who { color: var(--info); }
.bubble .t { font-size: calc(10.5px * var(--fs)); color: #667781; text-align: right; margin-top: 2px; display: flex; gap: 4px; justify-content: flex-end; align-items: center; }
.bubble .err { color: var(--danger); font-size: calc(11px * var(--fs)); margin-top: 3px; }
.tick { font-weight: 700; letter-spacing: -3px; padding-right: 3px; } .tick.read { color: #34b7f1; } .tick.failed { color: var(--danger); letter-spacing: 0; }
.daysep { align-self: center; background: #fff; color: var(--muted); font-size: calc(11px * var(--fs)); padding: 3px 10px; border-radius: 6px; margin: 6px 0; box-shadow: 0 1px 1px rgba(0,0,0,.06); }
.composer { background: #f0f2f5; padding: 10px 14px; display: flex; gap: 8px; align-items: flex-end; }
.composer textarea { flex: 1; border: 0; border-radius: 8px; padding: 10px 12px; resize: none; max-height: 140px; min-height: 42px; outline: none; }
.window-note { background: #fff7e0; color: #7a5600; padding: 8px 14px; font-size: calc(12px * var(--fs)); border-top: 1px solid #f3dfa4; display: flex; gap: 10px; align-items: center; }
.details { background: #fff; border-left: 1px solid var(--line); overflow: auto; padding: 16px; }
.details .sec { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px; }
.kv { display: grid; grid-template-columns: 1fr; gap: 2px; margin-bottom: 8px; }
.kv b { font-size: calc(11px * var(--fs)); color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.mode { display: flex; background: #f0f2f5; border-radius: 8px; padding: 3px; }
.mode a { flex: 1; text-align: center; padding: 6px; border-radius: 6px; color: var(--muted); font-weight: 600; cursor: pointer; font-size: calc(12px * var(--fs)); }
.mode a.on { background: #fff; color: var(--ink); box-shadow: var(--shadow); }
.sim { background: #fffaf0; border: 1px dashed #e7c56e; border-radius: 10px; padding: 12px; margin: 12px; }
.noconv { display: grid; place-items: center; height: 100%; color: var(--muted); text-align: center; }

/* template preview */
.wa-preview { background: #efeae2; border-radius: 12px; padding: 20px; min-height: 260px;
  background-image: radial-gradient(rgba(0,0,0,.035) 1px, transparent 1px); background-size: 18px 18px; }
.wa-card { background: #fff; border-radius: 8px; max-width: 300px; box-shadow: 0 1px 1px rgba(0,0,0,.1); overflow: hidden; }
.wa-card .media { background: #cfd8dc; height: 140px; display: grid; place-items: center; color: #546e7a; font-weight: 600; background-size: cover; background-position: center; }
.wa-card .c { padding: 8px 10px; word-wrap: break-word; }
.pre { white-space: pre-wrap; }
.wa-card .h { font-weight: 700; margin-bottom: 4px; }
.wa-card .f { color: #8696a0; font-size: calc(12px * var(--fs)); margin-top: 4px; }
.wa-card .btns div { border-top: 1px solid #eef0f2; text-align: center; padding: 9px; color: #027eb5; font-weight: 600; }
.var { background: #fff3c4; border-radius: 3px; padding: 0 2px; white-space: nowrap; }
.btn-row { display: grid; grid-template-columns: 130px 1fr 1fr 32px; gap: 6px; margin-bottom: 6px; }
.cond { display: grid; grid-template-columns: 1fr 120px 1fr 32px; gap: 6px; margin-bottom: 6px; }
.map-row { display: grid; grid-template-columns: 105px 150px 1fr 1fr; gap: 6px; align-items: center; margin-bottom: 6px; }
.review-note { background: #fff1d6; border-radius: 8px; padding: 8px 10px; font-size: calc(13px * var(--fs)); margin-bottom: 12px; }

@media (max-width: 1100px) { .inbox { grid-template-columns: 280px 1fr; } .details { display: none; } .g4 { grid-template-columns: repeat(2,1fr); } }

/* campaign report tabs */
.rtabs { display: flex; overflow-x: auto; }
.rtabs a { flex: 1; min-width: 120px; padding: 12px 16px; cursor: pointer; border-bottom: 3px solid transparent; color: var(--ink); }
.rtabs a div { color: var(--muted); font-size: calc(13px * var(--fs)); margin-top: 2px; }
.rtabs a:hover { background: #f8faf9; }
.rtabs a.on { border-color: var(--brand-2); background: linear-gradient(#fff, #effbf4); }
.rtabs a.on div { color: var(--brand-ink); font-weight: 600; }
/* flow builder */
.fnode { border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-bottom: 10px; background: #fff; position: relative; }
.fnode.start { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(18,140,126,.12); }
.fnode .fhead { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.fnode .num { background: var(--soft); color: var(--brand-ink); font-weight: 700; border-radius: 6px; padding: 2px 8px; font-size: calc(12px * var(--fs)); }
.fchoice { display: grid; grid-template-columns: 1fr 200px 32px; gap: 6px; margin-bottom: 6px; }
.faction { display: grid; grid-template-columns: 150px 1fr 1fr 32px; gap: 6px; margin-bottom: 6px; }
.fmap { font-family: ui-monospace, Menlo, monospace; font-size: calc(12px * var(--fs)); background: #fafbfc; border-radius: 8px; padding: 10px; white-space: pre-wrap; line-height: 1.6; }
.side .me .build { margin-top: 10px; font-size: calc(11px * var(--fs)); color: #7fa9a1; letter-spacing: .01em; }
.otp { font-size: calc(30px * var(--fs)); letter-spacing: 18px; text-align: center; font-weight: 700; padding: 12px; }
.pwbox { display: flex; flex-wrap: wrap; gap: 6px 12px; margin: -6px 0 12px; font-size: calc(12px * var(--fs)); color: var(--muted); }
.pwr.ok { color: var(--ok); font-weight: 600; }
.spin { width: 14px; height: 14px; border: 2px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin 0.9s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== v1.4 components ===== */
.switch { position: relative; display: inline-block; width: 42px; height: 24px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch i { position: absolute; inset: 0; background: #cfd6dd; border-radius: 99px; transition: .2s; cursor: pointer; }
.switch i::before { content: ''; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + i { background: var(--brand); }
.switch input:checked + i::before { transform: translateX(18px); }
.switch input:disabled + i { opacity: .45; cursor: not-allowed; }
.setrow { display: flex; align-items: center; gap: 16px; margin-bottom: 14px; }
.setrow h3 { margin: 0 0 4px; }
.setrow > div:first-child { flex: 1; }
.card + .card { margin-top: 0; }
.mbody .card { margin-bottom: 14px; }
.kwlist { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.kw { background: #eef0f4; border-radius: 8px; padding: 6px 10px; font-weight: 600; display: inline-flex; gap: 8px; align-items: center; }
.kw a { cursor: pointer; color: var(--muted); font-weight: 400; }
.reditor .rtypes { display: flex; gap: 4px; margin-bottom: 8px; flex-wrap: wrap; }
.reditor .rtypes a { padding: 5px 10px; border-radius: 99px; border: 1px solid var(--line); cursor: pointer; font-size: calc(12px * var(--fs)); font-weight: 600; color: var(--muted); }
.reditor .rtypes a.on { background: var(--soft); color: var(--brand-ink); border-color: var(--brand); }
.reditor .rmedia { margin-bottom: 8px; }
.wa-card .doc { padding: 14px 10px; background: #f0f2f5; font-weight: 600; }
.hours { display: grid; gap: 6px; margin: 6px 0 16px; }
.hrow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hrow .input { width: 120px; }
.tscroll { overflow-x: auto; }
.fav { cursor: pointer; font-size: calc(20px * var(--fs)); color: #c4cbd3; }
.fav.on { color: #f2b01e; }
.manage { display: grid; grid-template-columns: 240px 1fr; min-height: 100%; }
.mnav { border-right: 1px solid var(--line); background: #fff; padding: 14px 10px; }
.mnav .mgroup { font-size: calc(11px * var(--fs)); font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; padding: 14px 10px 4px; }
.mnav a { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 8px; color: var(--ink); font-weight: 500; }
.mnav a:hover { background: #f4f6f8; }
.mnav a.on { background: var(--soft); color: var(--brand-ink); font-weight: 600; }
.mnav a span { width: 20px; text-align: center; }
.mselect { display: none; }
.mbody { padding: 22px 26px; min-width: 0; }
.cpanel { background: #fff; border-top: 1px solid var(--line); padding: 10px 14px; max-height: 320px; overflow: auto; }
.clist { display: grid; gap: 2px; }
.clist a { padding: 7px 8px; border-radius: 6px; cursor: pointer; color: var(--ink); }
.clist a:hover, .clist a.on { background: var(--soft); }
.mtop, .mback, .mob { display: none; }
.page-head.wrap { flex-wrap: wrap; }

/* ===== phones & small tablets ===== */
@media (max-width: 860px) {
  .shell { display: block; height: 100dvh; }
  .mtop { display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 12px; background: var(--side); color: #fff; position: sticky; top: 0; z-index: 40; }
  .mtop::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--rainbow); }
  .mtop .mtitle { color: #a9d3cb; font-size: calc(13px * var(--fs)); }
  .mtop .count { margin-left: auto; background: var(--brand-2); color: #04332b; font-size: calc(11px * var(--fs)); font-weight: 700; border-radius: 99px; padding: 1px 7px; }
  .mburger { background: none; border: 0; color: #fff; font-size: calc(22px * var(--fs)); padding: 4px 6px; cursor: pointer; }
  .side { position: fixed; top: 0; bottom: 0; left: -270px; width: 260px; z-index: 60; transition: left .2s; overflow-y: auto; }
  .shell.nav-open .side { left: 0; }
  .shell.nav-open .mback { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 50; }
  .main { height: calc(100dvh - 52px); }
  .sim-banner { padding: 6px 12px; font-size: calc(12px * var(--fs)); }
  .page { padding: 14px 12px; }
  .page-head { flex-wrap: wrap; gap: 8px; }
  .page-head h1 { font-size: calc(18px * var(--fs)); width: 100%; }
  .g2, .g3, .g4 { grid-template-columns: 1fr !important; }
  .grid[style*="grid-template-columns"] { grid-template-columns: 1fr !important; }
  .card.flush, .card { overflow-x: auto; }
  table { min-width: 560px; }
  .modal-wrap { padding: 0; align-items: stretch; }
  .modal, .modal.wide { max-width: none; border-radius: 0; min-height: 100dvh; }
  .modal .body { padding: 14px; }
  .btn-row, .cond, .map-row, .faction, .fchoice { grid-template-columns: 1fr 1fr !important; }
  .rtabs a { min-width: 96px; padding: 10px; }
  .row.wrap > .input { max-width: none !important; width: 100% !important; }
  /* inbox: list ↔ chat ↔ details */
  .inbox { display: block; position: relative; height: 100% !important; }
  .inbox .convos { height: 100%; }
  .inbox .thread, .inbox .details { display: none; }
  .inbox.has-thread .convos { display: none; }
  .inbox.has-thread .thread { display: flex; height: 100%; }
  .inbox.show-details .details { display: block; position: absolute; inset: 0; z-index: 20; }
  .msgs { padding: 12px 10px; }
  .bubble { max-width: 86%; }
  .composer { padding: 8px; gap: 6px; }
  .composer .btn { padding: 8px 10px; }
  .mob { display: inline-flex; }
  .sim { margin: 8px; }
  /* settings: side menu → dropdown */
  .manage { display: block; max-width: 100vw; overflow-x: hidden; }
  .main { overflow-x: hidden; }
  .mnav { display: none; }
  select.input.mselect { display: block; margin: 12px 12px 0; width: calc(100% - 24px); }
  .mbody { padding: 12px; }
  .setrow { align-items: flex-start; }
  .login .card { width: calc(100vw - 32px) !important; }
}

/* v1.4.1: message pop-up + notification choices */
.npop { display: flex; gap: 10px; align-items: flex-start; width: 330px; max-width: calc(100vw - 36px); background: #fff; color: var(--ink); border: 1px solid var(--line); border-left: 4px solid var(--brand); border-radius: 10px; box-shadow: 0 8px 28px rgba(15,42,40,.18); padding: 10px 12px; cursor: pointer; animation: npop-in .2s ease-out; }
.npop:hover { background: #f7fbfa; }
.npop .av { width: 36px; height: 36px; border-radius: 50%; color: #fff; display: grid; place-items: center; font-weight: 700; font-size: calc(13px * var(--fs)); flex: none; }
.npop .nb { flex: 1; min-width: 0; }
.npop .nt { font-weight: 700; display: flex; gap: 8px; }
.npop .nt span { margin-left: auto; font-weight: 400; font-size: calc(11px * var(--fs)); color: var(--muted); }
.npop .nm { color: var(--muted); font-size: calc(13px * var(--fs)); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.npop .nx { color: var(--muted); font-size: calc(18px * var(--fs)); line-height: 1; padding: 0 2px; }
@keyframes npop-in { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }
.radio { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 8px; cursor: pointer; }
.radio:has(input:checked) { border-color: var(--brand); background: var(--soft); }
.radio input { margin-top: 3px; accent-color: var(--brand); }
@media (max-width: 860px) { #toasts { left: 12px; right: 12px; bottom: 12px; } .npop { width: auto; max-width: none; } }

/* ===== v1.5 Chat Profile ===== */
.details { padding: 14px; background: #f7f9fa; }
.mob-d { display: none; }
.phead { display: flex; gap: 12px; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 12px; position: relative; }
.phead .avatar { width: 48px; height: 48px; font-size: calc(17px * var(--fs)); flex: none; }
.phead b { font-size: calc(15px * var(--fs)); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.phead .mob-d { position: absolute; right: 8px; top: 8px; }
.psum { background: var(--soft); border-radius: 10px; padding: 10px 12px; margin-top: 10px; }
.pkv { display: grid; grid-template-columns: 1fr 1.25fr; gap: 8px; font-size: calc(12.5px * var(--fs)); padding: 3px 0; align-items: center; }
.pkv span { color: var(--muted); }
.pkv b { font-weight: 600; overflow-wrap: anywhere; }
.pkv .switch { transform: scale(.85); transform-origin: left center; }
.details .sec { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.pacc { background: #fff; border: 1px solid var(--line); border-radius: 10px; margin-top: 10px; }
.pacc > summary { list-style: none; cursor: pointer; padding: 12px; font-weight: 600; display: flex; align-items: center; gap: 6px; user-select: none; }
.pacc > summary::-webkit-details-marker { display: none; }
.pacc > summary::after { content: '▾'; color: var(--muted); margin-left: 6px; transition: transform .15s; }
.pacc[open] > summary::after { transform: rotate(180deg); }
.pcount { margin-left: auto; font-size: calc(11.5px * var(--fs)); font-weight: 600; color: var(--muted); background: #eef1f4; border-radius: 99px; padding: 1px 8px; }
.pbody { padding: 0 12px 12px; }
.pay, .pnote, .pcamp { display: block; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin-bottom: 8px; color: var(--ink); }
.pay .amt { font-size: calc(15px * var(--fs)); color: var(--brand-ink); }
.pay code { font-size: calc(11.5px * var(--fs)); }
.pby { margin-top: 4px; line-height: 1.45; }
.phist { margin-top: 6px; border-top: 1px dashed var(--line); padding-top: 6px; font-size: calc(12px * var(--fs)); display: grid; gap: 6px; }
.pcamp:hover { border-color: var(--brand); background: #f7fbfa; }
.pcamp b { font-size: calc(13px * var(--fs)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.pnote .pre { white-space: pre-wrap; font-size: calc(13px * var(--fs)); }
.journey { position: relative; }
.jitem { display: flex; gap: 10px; position: relative; padding-bottom: 12px; }
.jitem:not(:last-child)::before { content: ''; position: absolute; left: 13px; top: 28px; bottom: 0; width: 2px; background: var(--line); }
.jdot { width: 28px; height: 28px; border-radius: 50%; background: var(--soft); display: grid; place-items: center; font-size: calc(13px * var(--fs)); flex: none; }
.jtxt { min-width: 0; font-size: calc(13px * var(--fs)); overflow-wrap: anywhere; }

/* laptops: profile opens as an overlay with the ⓘ button */
@media (max-width: 1100px) and (min-width: 861px) {
  #tinfo { display: inline-flex; }
  .mob-d { display: inline-flex; }
  .inbox.show-details .details { display: block; position: absolute; top: 0; right: 0; bottom: 0; width: 360px; z-index: 20; box-shadow: -8px 0 24px rgba(0,0,0,.12); }
}
@media (max-width: 860px) { .mob-d { display: inline-flex; } }
.phist[hidden] { display: none; }


/* ===== v1.5.1: text size + phone comfort ===== */
.tsize { display: flex; align-items: center; gap: 4px; margin: 6px 0 4px; font-size: calc(12px * var(--fs)); color: #a9d3cb; }
.tsize button { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.18); color: #fff; border-radius: 6px; min-width: 30px; height: 26px; cursor: pointer; font-weight: 700; }
.tsize button:hover { background: rgba(255,255,255,.18); }
.tsize b { min-width: 42px; text-align: center; color: #fff; }
.tsize a { color: #a9d3cb; cursor: pointer; text-decoration: underline; margin-left: 4px; }
@media (max-width: 860px) {
  :root { --fs-dev: 1.15; }
  /* chat header: one-line name, big touch targets */
  .thread-head, #thead { gap: 8px; padding: 8px 10px; }
  #thead .avatar { width: 40px; height: 40px; flex: none; }
  #thead b, #thead .tname { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #thead > div:not(.avatar) { min-width: 0; flex: 1; }
  #tback, #tinfo, #dclose { min-width: 44px; height: 44px; padding: 0; justify-content: center; align-items: center; font-size: calc(22px * var(--fs)); border-radius: 10px; }
  #tback { font-size: calc(30px * var(--fs)); line-height: 1; }
  /* composer: taller box that grows with the message, above the phone's bottom bar */
  .composer { padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); align-items: flex-end; }
  .composer textarea { min-height: 52px; max-height: 40vh; padding: 13px 12px; line-height: 1.4; border-radius: 22px; }
  .composer .btn { min-width: 46px; height: 52px; border-radius: 14px; }
  .composer .btn.primary { padding: 0 16px; }
}

.sicon { display: none; }
@media (max-width: 860px) {
  .tname-wrap .small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #thead .btn.sm:not(.mob) { padding: 8px 10px; }
  .composer { gap: 6px; }
  .composer #tplbtn, .composer #cnbtn { min-width: 40px; width: 40px; padding: 0; justify-content: center; }
  .composer #sendbtn { width: 52px; min-width: 52px; padding: 0; border-radius: 50%; justify-content: center; }
  .composer #sendbtn .stext { display: none; }
  .composer #sendbtn .sicon { display: block; }
}

.tmode-m { display: none; }
@media (max-width: 860px) {
  #thead { display: grid; grid-template-columns: 44px 40px minmax(0, 1fr) 44px; grid-template-areas: "back av name info" "act act act act"; column-gap: 10px; row-gap: 6px; align-items: center; }
  #thead #tback { grid-area: back; }
  #thead .avatar { grid-area: av; }
  #thead .tname-wrap { grid-area: name; }
  #thead #tinfo { grid-area: info; }
  #thead .spacer { display: none; }
  #thead .tact { grid-area: act; display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--line); padding-top: 6px; }
  #thead .tmode-m { display: inline; }
  #thead .tmode-d { display: none; }
  #thead .tname { font-size: calc(16px * var(--fs)); }
}

/* v1.5.3: A− / A+ / Reset look and feel like buttons */
.side .me .tsize { gap: 6px; margin: 10px 0 6px; }
.side .me .tsize button { background: rgba(255,255,255,.1); border: 1.5px solid rgba(255,255,255,.45); color: #fff; border-radius: 8px; min-width: 38px; height: 32px; padding: 0 8px; margin: 0; font-weight: 700; font-size: calc(13px * var(--fs)); display: inline-flex; align-items: center; justify-content: center; }
.side .me .tsize button:hover { background: rgba(255,255,255,.2); }
.side .me .tsize button:active { background: rgba(255,255,255,.3); transform: scale(.96); }
.side .me .tsize button.fsr { font-weight: 600; color: #cfe7e2; margin-left: 2px; }
@media (max-width: 860px) { .side .me .tsize button { min-width: 46px; height: 40px; } }
.side .me .tsize { flex-wrap: wrap; }
.side .me .tsize .tslabel { flex-basis: 100%; color: #a9d3cb; margin-bottom: 2px; }
@media (min-width: 861px) { .side .me .tsize { gap: 5px; } .side .me .tsize button { min-width: 34px; padding: 0 7px; } .side .me .tsize b { min-width: 38px; } }

/* ===== v1.6 Contacts · Segments · Lists ===== */
.ctabs { display: flex; gap: 4px; margin-bottom: 14px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.ctab { padding: 9px 14px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.ctab.on { color: var(--brand-ink); border-bottom-color: var(--brand); }
.fbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.fgroup { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 0; border: 1px solid var(--line); border-radius: 8px; background: #fff; overflow: hidden; }
.fchip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 8px 7px 10px; font-size: calc(13px * var(--fs)); }
.fchip .ft { cursor: pointer; }
.fchip .ft:hover { color: var(--brand-ink); text-decoration: underline; }
.fchip .fx { color: var(--muted); cursor: pointer; font-size: calc(16px * var(--fs)); line-height: 1; padding: 0 2px; }
.fchip .fx:hover { color: var(--danger); }
.fand { font-size: calc(11px * var(--fs)); color: var(--muted); background: #f4f6f8; align-self: stretch; display: inline-flex; align-items: center; padding: 0 8px; border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
.fadd { border: 0; border-left: 1px solid var(--line); background: #fafbfc; color: var(--brand-ink); font-weight: 700; padding: 7px 11px; cursor: pointer; align-self: stretch; }
.fgroup .fadd:first-child { border-left: 0; }
.fadd:hover { background: var(--soft); }
.for { font-size: calc(11px * var(--fs)); font-weight: 700; color: #8a6bff; text-transform: uppercase; }
.fctl { margin-top: 10px; gap: 14px; align-items: center; }
.fctl a { cursor: pointer; }
.flist { max-height: 55vh; overflow: auto; display: grid; }
.flist .fgrp { font-size: calc(11px * var(--fs)); font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 10px 6px 4px; }
.flist a { display: flex; gap: 10px; align-items: center; padding: 8px 8px; border-radius: 6px; color: var(--ink); cursor: pointer; }
.flist a:hover { background: var(--soft); }
.flist a span { width: 22px; text-align: center; }
.dd { position: relative; }
.ddm { position: absolute; right: 0; top: calc(100% + 4px); background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.12); min-width: 220px; z-index: 30; padding: 6px; display: grid; }
.ddm[hidden] { display: none; }
.ddm a { padding: 9px 10px; border-radius: 6px; cursor: pointer; color: var(--ink); white-space: nowrap; }
.ddm a:hover { background: var(--soft); }
.selbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; background: #e1ecff; border-radius: 8px; padding: 8px 12px; margin-bottom: 10px; }
.selbar[hidden] { display: none; }
.selbar a { cursor: pointer; text-decoration: underline; }
.cform .crow { display: grid; grid-template-columns: 170px 1fr; gap: 12px; align-items: center; margin-bottom: 10px; }
.cform .crow > span { font-weight: 600; color: #3a4350; }
.phonein { display: grid; grid-template-columns: minmax(140px, 190px) 1fr; gap: 8px; }
.pickc { display: block; cursor: pointer; color: var(--ink); }
.pickc:hover { border-color: var(--brand); background: #f7fbfa; }
@media (max-width: 860px) {
  .cform .crow { grid-template-columns: 1fr; gap: 4px; }
  .phonein { grid-template-columns: 130px 1fr; }
  .ddm { right: auto; left: 0; }
  .fgroup { max-width: 100%; }
}

/* v1.6.1: install-the-app offer on phones */
.ibar { position: fixed; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 90; display: flex; align-items: center; gap: 10px; background: #0f2a28; color: #fff; border-radius: 14px; padding: 10px 10px 10px 12px; box-shadow: 0 10px 30px rgba(0,0,0,.3); animation: npop-in .25s ease-out; }
.ibar img { width: 40px; height: 40px; border-radius: 10px; flex: none; }
.ibar .it { flex: 1; min-width: 0; display: grid; font-size: calc(13px * var(--fs)); line-height: 1.3; }
.ibar .it span { color: #a9d3cb; font-size: calc(12px * var(--fs)); }
.ibar .btn { flex: none; background: var(--brand-2); border-color: var(--brand-2); color: #04332b; font-weight: 700; }
.ibar .ix { color: #a9d3cb; font-size: calc(18px * var(--fs)); padding: 4px 6px; cursor: pointer; }
.side .me .iapp { display: block; width: 100%; margin: 10px 0 4px; padding: 9px 10px; border-radius: 8px; background: var(--brand-2); color: #04332b; font-weight: 700; border: 0; text-align: center; }
.isteps { padding-left: 20px; line-height: 1.7; }
.isteps li { margin-bottom: 6px; }
body:has(.shell.nav-open) .ibar, body:has(.inbox.has-thread) .ibar, body:has(.modal-wrap) .ibar { display: none; }

/* ===== v1.7 media in chat ===== */
.mimg { display: block; max-width: 280px; max-height: 320px; width: auto; border-radius: 8px; margin: 2px 0 4px; background: #e9edef; cursor: zoom-in; }
.mimg.sticker { max-width: 140px; background: none; }
.mvid { display: block; width: 300px; max-width: 100%; max-height: 360px; border-radius: 8px; margin: 2px 0 4px; background: #000; }
.maud { display: block; width: 260px; max-width: 100%; margin: 4px 0; }
.mdoc { display: flex; gap: 10px; align-items: center; background: rgba(0,0,0,.05); border-radius: 8px; padding: 8px 10px; margin: 2px 0 4px; color: var(--ink); min-width: 220px; max-width: 300px; }
.mdoc:hover { background: rgba(0,0,0,.09); }
.mdoc .mdi { font-size: calc(26px * var(--fs)); }
.mdoc .mdn { display: grid; min-width: 0; font-weight: 600; overflow-wrap: anywhere; }
.mdoc small { font-weight: 400; color: var(--muted); }
.mph { font-size: calc(13px * var(--fs)); color: var(--muted); background: rgba(0,0,0,.04); border-radius: 8px; padding: 8px 10px; margin: 2px 0 4px; }
.mph a { cursor: pointer; text-decoration: underline; color: var(--brand-ink); }
.aprev { display: block; max-width: 100%; max-height: 50vh; margin: 0 auto; border-radius: 8px; background: #000; }
.aprog { height: 6px; border-radius: 99px; background: #e5e8ee; overflow: hidden; margin-top: 10px; }
.aprog i { display: block; height: 100%; width: 0; background: var(--brand); transition: width .2s; }
.thread.dropping { outline: 3px dashed var(--brand); outline-offset: -6px; }
@media (max-width: 860px) {
  .mimg { max-width: 70vw; }
  .composer #attbtn { min-width: 38px; width: 38px; padding: 0; justify-content: center; }
  .composer #tplbtn, .composer #cnbtn { min-width: 36px; width: 36px; }
}
.dbar { height: 12px; border-radius: 99px; background: #e5e8ee; overflow: hidden; }
.dbar i { display: block; height: 100%; }

/* ---- data protection: watermark + print block (Agents and Super agents) ---- */
#wm { position: fixed; inset: 0; pointer-events: none; z-index: 9999; background-repeat: repeat; }
@media print { body.dlp > * { display: none !important; } body.dlp::after { content: 'Printing is disabled for customer data.'; display: block; padding: 40px; font: 16px sans-serif; } }
/* profile → Documents */
.pdoc { display: flex; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.pdoc:last-of-type { border-bottom: 0; }
.pdn { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
