/* ==========================================================
   Wamy — messenger UI (WhatsApp-style), Arabic RTL + English LTR
   Prefix: ws-  (no Bootstrap class names)
   ========================================================== */

:root {
  /* --ws-brand / --ws-brand-rgb come inline from the admin setting */
  --ws-brand: #017672;
  --ws-brand-rgb: 1, 118, 114;
  --ws-brand-ink: var(--ws-brand);
  --ws-on-brand: #ffffff;
  /* the icon's colours */
  --ws-cyan: #0ce2da;
  --ws-mint: #05e4aa;
  --ws-navy: #022847;
  --ws-grad: linear-gradient(135deg, #0ce2da 0%, #017672 50%, #022847 100%);
  --ws-badge: #05e4aa;
  --ws-on-badge: #022847;
  --ws-ink: #0d2230;
  --ws-muted: #5d7280;
  --ws-icon: #4b6271;
  --ws-line: #e2eaee;
  --ws-panel: #ffffff;
  --ws-panel-2: #eef4f5;
  --ws-hover: #f3f8f8;
  --ws-active: #e4eef0;
  --ws-chat-bg: #e6f0ef;
  --ws-wall: #022847;
  --ws-wall-op: .05;
  --ws-in: #ffffff;
  --ws-out: #d3f6ec;
  --ws-quote: rgba(2, 40, 71, .05);
  --ws-read: #1c96d4;
  --ws-pill: #ffffff;
  --ws-danger: #d92d20;
  --ws-danger-bg: #fdecea;
  --ws-info: #1d4ed8;
  --ws-info-bg: #e7f0ff;
  --ws-warn: #5f4aa6;
  --ws-warn-bg: #f7f5fd;
  --ws-shadow: 0 1px .5px rgba(11, 20, 26, .13);
  --ws-shadow-lg: 0 2px 5px rgba(11, 20, 26, .14), 0 16px 40px rgba(11, 20, 26, .18);
  --ws-font: 'Cairo', system-ui, Tahoma, sans-serif;
  --ws-ease: 200ms cubic-bezier(.2, .7, .3, 1);
  --ws-head: 64px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --ws-brand-ink: #2ee6cf;
  --ws-on-brand: #022847;
  --ws-ink: #e6f1f3;
  --ws-muted: #8fa6b2;
  --ws-icon: #a9bcc6;
  --ws-line: #1a3242;
  --ws-panel: #0a1c28;
  --ws-panel-2: #12293a;
  --ws-hover: #12293a;
  --ws-active: #1b3549;
  --ws-chat-bg: #061520;
  --ws-wall: #ffffff;
  --ws-wall-op: .03;
  --ws-in: #12293a;
  --ws-out: #015359;
  --ws-quote: rgba(255, 255, 255, .06);
  --ws-read: #53bdeb;
  --ws-pill: #0f2433;
  --ws-danger: #f87171;
  --ws-danger-bg: rgba(248, 113, 113, .12);
  --ws-info: #93b4ff;
  --ws-info-bg: rgba(147, 180, 255, .12);
  --ws-warn: #b9a6ff;
  --ws-warn-bg: rgba(167, 139, 250, .09);
  --ws-shadow: 0 1px .5px rgba(0, 0, 0, .3);
  --ws-shadow-lg: 0 2px 5px rgba(0, 0, 0, .4), 0 16px 40px rgba(0, 0, 0, .5);
  color-scheme: dark;
}
/* in dark mode the main button is the icon's bright cyan with navy text */
:root[data-theme="dark"] .ws-btn:not(.ws-btn-ghost):not(.ws-btn-danger) { background: var(--ws-cyan); }

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--ws-panel); color: var(--ws-ink); font-family: var(--ws-font); font-size: 16px; line-height: 1.6; -webkit-font-smoothing: antialiased; overflow: hidden; overscroll-behavior: none; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--ws-brand-ink); }
small { font-size: 15px; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid rgba(var(--ws-brand-rgb), .55); outline-offset: 2px; border-radius: 8px; }
.ws-num { direction: ltr; unicode-bidi: isolate; display: inline-block; white-space: nowrap; }
.ws-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[dir="rtl"] .flip-rtl { transform: scaleX(-1); }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

/* ---------- icon buttons ---------- */
.ws-ib { width: 44px; height: 44px; flex: 0 0 auto; display: inline-grid; place-items: center; border: 0; border-radius: 50%; background: none; color: var(--ws-icon); font-size: 1.25rem; position: relative; transition: background var(--ws-ease); }
.ws-ib:hover { background: var(--ws-active); }
.ws-ib[aria-pressed="true"], .ws-ib[aria-expanded="true"] { background: var(--ws-active); }
.ws-btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 44px; padding: 0 22px; border: 0; border-radius: 999px; background: var(--ws-brand); color: var(--ws-on-brand); font-weight: 700; font-size: 16px; text-decoration: none; transition: filter var(--ws-ease), background var(--ws-ease); }
.ws-btn:hover { filter: brightness(.95); }
.ws-btn-ghost { background: transparent; color: var(--ws-brand-ink); border: 1.5px solid var(--ws-line); }
.ws-btn-ghost:hover { background: var(--ws-hover); filter: none; }
.ws-btn-danger { background: var(--ws-danger); color: #fff; }
.ws-btn-sm { min-height: 40px; padding: 0 16px; font-size: 15px; }
.ws-btn.is-loading { pointer-events: none; opacity: .75; }
.ws-btn.is-loading::after { content: ""; width: 16px; height: 16px; border: 2px solid currentColor; border-inline-end-color: transparent; border-radius: 50%; animation: ws-spin .7s linear infinite; }
@keyframes ws-spin { to { transform: rotate(360deg); } }

/* ---------- avatar ---------- */
.ws-av { --c: var(--ws-brand); width: 49px; height: 49px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 50%; background: var(--c); color: #fff; font-weight: 800; font-size: 20px; overflow: hidden; position: relative; }
.ws-av img { width: 100%; height: 100%; object-fit: cover; }
.ws-av.sm { width: 40px; height: 40px; font-size: 17px; }
.ws-av.lg { width: 200px; height: 200px; font-size: 76px; }
.ws-av.me { --c: #dfe5e7; color: #54656f; }
[data-theme="dark"] .ws-av.me { --c: #6a7175; color: #cfd6d9; }
.ws-tick-v { color: #02a47f; font-size: 1rem; vertical-align: -1px; }

/* ==========================================================
   App grid
   ========================================================== */
.ws-app { height: 100dvh; display: grid; grid-template-columns: 64px minmax(340px, 30%) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); background: var(--ws-panel); }
.ws-app.info-open { grid-template-columns: 64px minmax(340px, 30%) minmax(0, 1fr) 400px; }
@media (max-width: 1279.98px) { .ws-app.info-open { grid-template-columns: 64px minmax(340px, 36%) minmax(0, 1fr); } }

/* left rail (desktop) */
.ws-rail { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 0; background: var(--ws-panel-2); border-inline-end: 1px solid var(--ws-line); }
.ws-rail .sp { flex: 1; }
.ws-rail .ws-ib .dot { position: absolute; top: 2px; inset-inline-end: 0; min-width: 20px; height: 20px; padding: 0 5px; display: grid; place-items: center; border-radius: 10px; background: var(--ws-badge); color: var(--ws-on-badge); font-size: 15px; font-weight: 800; line-height: 1; }
.ws-rail .ws-ib[aria-current="true"] { background: var(--ws-active); color: var(--ws-ink); }
.ws-rail .ws-av { width: 40px; height: 40px; font-size: 17px; cursor: pointer; border: 0; }

/* side column: chat list / archived / settings */
.ws-side { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--ws-panel); border-inline-end: 1px solid var(--ws-line); }
.ws-pane { position: absolute; inset: 0; display: flex; flex-direction: column; min-height: 0; background: var(--ws-panel); }
.ws-pane[data-on="0"] { visibility: hidden; }
.ws-pane.slide { transform: translateX(-100%); transition: transform 260ms cubic-bezier(.2, .7, .3, 1), visibility 260ms; }
[dir="rtl"] .ws-pane.slide { transform: translateX(100%); }
.ws-pane.slide[data-on="1"] { transform: none; }
.ws-ph { flex: 0 0 auto; display: flex; align-items: center; gap: 6px; min-height: var(--ws-head); padding: 10px 16px; padding-inline-end: 10px; }
.ws-ph h1, .ws-ph h2 { flex: 1; margin: 0; font-size: 22px; font-weight: 800; line-height: 1.3; }
.ws-ph h1 { color: var(--ws-brand-ink); }
.ws-ph.sub { background: var(--ws-panel); padding-inline-start: 8px; }
.ws-ph.sub h2 { font-size: 19px; }
.ws-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: rgba(var(--ws-brand-rgb), .25) transparent; }

/* search */
.ws-search { position: relative; margin: 0 12px 8px; }
.ws-search input { width: 100%; height: 42px; padding: 0 44px; border: 0; border-radius: 10px; background: var(--ws-panel-2); color: var(--ws-ink); font-size: 16px; }
.ws-search input::placeholder { color: var(--ws-muted); }
.ws-search input:focus { outline: 2px solid rgba(var(--ws-brand-rgb), .5); outline-offset: 0; }
.ws-search > i { position: absolute; top: 50%; inset-inline-start: 15px; transform: translateY(-50%); color: var(--ws-muted); pointer-events: none; }
.ws-search .clr { position: absolute; top: 0; inset-inline-end: 0; width: 42px; height: 42px; border: 0; background: none; color: var(--ws-muted); }

/* filter chips */
.ws-chips { display: flex; gap: 8px; padding: 0 12px 10px; overflow-x: auto; scrollbar-width: none; }
.ws-chips::-webkit-scrollbar { display: none; }
.ws-chip { flex: 0 0 auto; display: inline-flex; align-items: center; gap: .35rem; min-height: 36px; padding: 0 14px; border: 0; border-radius: 999px; background: var(--ws-panel-2); color: var(--ws-muted); font-size: 15px; font-weight: 700; }
.ws-chip[aria-pressed="true"] { background: rgba(var(--ws-brand-rgb), .14); color: var(--ws-brand-ink); }
.ws-chip .n { font-weight: 800; }

/* banners at the top of the list (notifications / install) */
.ws-banner { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; margin: 0 12px 10px; padding: 12px 14px; border-radius: 14px; background: var(--ws-info-bg); color: var(--ws-ink); text-align: start; border: 0; width: calc(100% - 24px); }
.ws-banner .bic { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; background: var(--ws-info); color: #fff; font-size: 1.2rem; }
[data-theme="dark"] .ws-banner .bic { color: #022847; }
.ws-banner > span > b { display: block; font-size: 16px; color: var(--ws-ink); }
.ws-banner > span > span { display: block; color: var(--ws-muted); font-size: 15px; line-height: 1.5; }
.ws-banner .go { color: var(--ws-info); font-size: 1.1rem; }
.ws-banner.warn { background: var(--ws-warn-bg); }
.ws-banner.warn .bic { background: var(--ws-warn); }
button.ws-banner { cursor: pointer; }

/* archived row */
.ws-arch { display: flex; align-items: center; gap: 22px; width: 100%; min-height: 52px; padding: 0 28px; border: 0; background: none; color: var(--ws-ink); font-weight: 700; text-align: start; }
.ws-arch:hover { background: var(--ws-hover); }
.ws-arch i { color: var(--ws-brand-ink); font-size: 1.15rem; }
.ws-arch .n { margin-inline-start: auto; color: var(--ws-brand-ink); font-weight: 800; }

/* ---------- chat list ---------- */
.ws-list { list-style: none; margin: 0; padding: 0 0 12px; }
.ws-row { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 14px; width: 100%; min-height: 72px; padding: 0 14px 0 14px; border: 0; background: none; text-align: start; cursor: pointer; }
.ws-row:hover, .ws-row:focus-visible { background: var(--ws-hover); }
.ws-row[aria-current="true"] { background: var(--ws-active); }
.ws-row .bd { display: grid; gap: 1px; min-width: 0; padding: 11px 0; border-bottom: 1px solid var(--ws-line); align-self: stretch; align-content: center; }
.ws-list li:last-child .ws-row .bd { border-bottom: 0; }
.ws-row .l1, .ws-row .l2 { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ws-row .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 17px; font-weight: 700; }
.ws-row .tm { flex: 0 0 auto; color: var(--ws-muted); font-size: 15px; }
.ws-row.has-unread .tm { color: var(--ws-brand-ink); font-weight: 700; }
.ws-row .pv { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ws-muted); font-size: 15px; }
.ws-row .pv b { color: var(--ws-ink); font-weight: 700; }
.ws-row .pv i { vertical-align: -2px; margin-inline-end: 2px; }
.ws-row .pv .rd { color: var(--ws-read); }
.ws-row .flags { flex: 0 0 auto; display: flex; align-items: center; gap: 6px; color: var(--ws-muted); }
.ws-row .cnt { min-width: 22px; height: 22px; padding: 0 6px; display: grid; place-items: center; border-radius: 11px; background: var(--ws-badge); color: var(--ws-on-badge); font-size: 15px; font-weight: 800; line-height: 1; }
.ws-row .cnt.dot { min-width: 14px; width: 14px; height: 14px; padding: 0; }
.ws-row .more { position: absolute; inset-inline-end: 10px; top: 50%; width: 32px; height: 32px; margin-top: 4px; display: grid; place-items: center; border: 0; border-radius: 50%; background: var(--ws-hover); color: var(--ws-muted); opacity: 0; transition: opacity var(--ws-ease); }
.ws-row:hover .more, .ws-row .more:focus-visible, .ws-row .more[aria-expanded="true"] { opacity: 1; }
@media (hover: none) { .ws-row .more { display: none; } }
.ws-hit { background: rgba(var(--ws-brand-rgb), .22); color: inherit; border-radius: 3px; }

.ws-sec-h { margin: 6px 0 0; padding: 10px 28px 6px; color: var(--ws-brand-ink); font-size: 16px; font-weight: 800; }
.ws-res { display: grid; gap: 2px; width: 100%; padding: 10px 24px; border: 0; border-bottom: 1px solid var(--ws-line); background: none; text-align: start; }
.ws-res:hover { background: var(--ws-hover); }
.ws-res .l1 { display: flex; justify-content: space-between; gap: 8px; color: var(--ws-muted); font-size: 15px; }
.ws-res .tx { color: var(--ws-ink); font-size: 15px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* empty state */
.ws-empty { display: grid; justify-items: center; gap: 8px; padding: 48px 28px; text-align: center; color: var(--ws-muted); }
.ws-empty .ic { width: 88px; height: 88px; display: grid; place-items: center; border-radius: 50%; background: rgba(var(--ws-brand-rgb), .1); color: var(--ws-brand-ink); font-size: 2.2rem; }
.ws-empty b { color: var(--ws-ink); font-size: 18px; }
.ws-empty p { margin: 0; max-width: 34ch; }

/* ==========================================================
   Main: welcome + conversation
   ========================================================== */
.ws-main { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--ws-chat-bg); }
.ws-welcome { flex: 1; display: grid; place-items: center; align-content: center; gap: 0; padding: 40px clamp(24px, 6vw, 96px); text-align: center; background: var(--ws-panel-2); border-bottom: 6px solid; border-image: var(--ws-grad) 1; }
.ws-welcome .art { width: min(320px, 70%); margin-bottom: 26px; }
.ws-welcome h2 { margin: 0 0 10px; font-size: clamp(26px, 2.4vw, 34px); font-weight: 700; }
.ws-welcome p { margin: 0 auto; max-width: 560px; color: var(--ws-muted); font-size: 16px; line-height: 1.8; }
.ws-welcome .acts { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 22px; }
.ws-welcome .lock { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 42px; color: var(--ws-muted); font-size: 15px; }

.ws-chat { position: relative; flex: 1; display: flex; flex-direction: column; min-height: 0; }
.ws-ch { flex: 0 0 auto; display: flex; align-items: center; gap: 10px; min-height: var(--ws-head); padding: 8px 16px; padding-inline-end: 10px; background: var(--ws-panel-2); border-inline-start: 1px solid var(--ws-line); z-index: 3; }
.ws-ch .back { display: none; margin-inline-start: -8px; }
.ws-ch .who { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; border: 0; background: none; padding: 0; text-align: start; }
.ws-ch .who > span:last-child { min-width: 0; display: grid; }
.ws-ch .nm { font-size: 17px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-ch .st { color: var(--ws-muted); font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* messages area with drawn wallpaper */
.ws-msgs { position: relative; flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; padding: 14px clamp(14px, 6%, 80px) 10px; isolation: isolate; }
.ws-wall { position: absolute; inset: 0; z-index: -1; pointer-events: none; background: var(--ws-wall); opacity: var(--ws-wall-op); -webkit-mask: url(../img/wall.svg) 0 0 / 360px repeat; mask: url(../img/wall.svg) 0 0 / 360px repeat; }
.ws-mlist { display: flex; flex-direction: column; gap: 2px; min-height: 100%; justify-content: flex-end; }
.ws-more-old { align-self: center; margin: 4px 0 10px; }

.ws-day { position: sticky; top: 6px; z-index: 2; align-self: center; margin: 10px 0 8px; padding: 4px 12px; border-radius: 8px; background: var(--ws-pill); color: var(--ws-muted); font-size: 15px; font-weight: 700; box-shadow: var(--ws-shadow); }
.ws-note { align-self: center; max-width: min(560px, 92%); margin: 4px 0 10px; padding: 8px 14px; border-radius: 8px; background: color-mix(in srgb, var(--ws-pill) 82%, rgba(var(--ws-brand-rgb), 1) 18%); color: var(--ws-ink); font-size: 15px; text-align: center; box-shadow: var(--ws-shadow); }
.ws-note i { color: var(--ws-brand-ink); margin-inline-end: 4px; }
.ws-unread-sep { align-self: stretch; margin: 10px calc(-1 * clamp(14px, 6%, 80px)); padding: 5px; background: rgba(255, 255, 255, .35); text-align: center; }
[data-theme="dark"] .ws-unread-sep { background: rgba(0, 0, 0, .25); }
.ws-unread-sep span { display: inline-block; padding: 3px 14px; border-radius: 8px; background: var(--ws-pill); color: var(--ws-muted); font-size: 15px; font-weight: 700; box-shadow: var(--ws-shadow); }

/* bubbles */
.ws-m { position: relative; display: flex; flex-direction: column; max-width: min(65%, 640px); margin-top: 2px; }
.ws-m.first { margin-top: 10px; }
.ws-m.in { align-self: flex-start; }
.ws-m.out { align-self: flex-end; }
.ws-b { position: relative; padding: 6px 9px 8px; border-radius: 10px; background: var(--ws-in); box-shadow: var(--ws-shadow); color: var(--ws-ink); overflow-wrap: anywhere; }
.ws-m.out .ws-b { background: var(--ws-out); }
.ws-m.first .ws-b::before { content: ""; position: absolute; top: 0; width: 8px; height: 13px; background: inherit; }
/* tail: incoming on the start side, outgoing on the end side (mirrored for RTL) */
[dir="ltr"] .ws-m.in.first .ws-b { border-top-left-radius: 0; }
[dir="ltr"] .ws-m.in.first .ws-b::before { left: -8px; clip-path: polygon(0 0, 100% 0, 100% 100%); }
[dir="ltr"] .ws-m.out.first .ws-b { border-top-right-radius: 0; }
[dir="ltr"] .ws-m.out.first .ws-b::before { right: -8px; clip-path: polygon(0 0, 100% 0, 0 100%); }
[dir="rtl"] .ws-m.in.first .ws-b { border-top-right-radius: 0; }
[dir="rtl"] .ws-m.in.first .ws-b::before { right: -8px; clip-path: polygon(0 0, 100% 0, 0 100%); }
[dir="rtl"] .ws-m.out.first .ws-b { border-top-left-radius: 0; }
[dir="rtl"] .ws-m.out.first .ws-b::before { left: -8px; clip-path: polygon(0 0, 100% 0, 100% 100%); }
.ws-b .tt { display: block; font-weight: 800; margin-bottom: 2px; }
.ws-b .tx { white-space: pre-wrap; line-height: 1.7; }
.ws-b .tx code, .ws-b .tx pre { font-family: ui-monospace, Consolas, monospace; font-size: 15px; direction: ltr; unicode-bidi: isolate; }
.ws-b .tx pre { margin: 4px 0; white-space: pre-wrap; }
.ws-b .tx a { color: #027eb5; text-decoration: underline; }
[data-theme="dark"] .ws-b .tx a { color: #53bdeb; }
.ws-b .sp { display: inline-block; width: 64px; height: 1px; }
.ws-m.out .ws-b .sp { width: 86px; }
.ws-b .mt { position: absolute; inset-inline-end: 8px; bottom: 3px; display: inline-flex; align-items: center; gap: 3px; color: var(--ws-muted); font-size: 15px; line-height: 1.4; white-space: nowrap; }
.ws-b .mt i { font-size: 1.05rem; line-height: 1; }
.ws-b .mt .rd { color: var(--ws-read); }
.ws-b .mt .fl { color: var(--ws-danger); }
.ws-b .img { display: block; margin: -2px -5px 6px; border-radius: 7px; overflow: hidden; border: 0; padding: 0; background: var(--ws-quote); cursor: zoom-in; }
.ws-b .img img { display: block; width: 100%; max-height: 340px; object-fit: cover; }
.ws-b .q { display: block; margin: 0 -3px 6px; padding: 6px 10px; border-radius: 7px; background: var(--ws-quote); border-inline-start: 4px solid var(--ws-brand-ink); font-size: 15px; cursor: pointer; }
.ws-b .q b { display: block; color: var(--ws-brand-ink); font-size: 15px; }
.ws-b .q span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--ws-muted); }
/* template buttons under an incoming bubble */
.ws-bts { display: grid; gap: 0; margin-top: 2px; border-radius: 10px; background: var(--ws-in); box-shadow: var(--ws-shadow); overflow: hidden; }
.ws-bt { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 6px 12px; border: 0; border-top: 1px solid var(--ws-line); background: none; color: #027eb5; font-weight: 700; font-size: 16px; text-decoration: none; }
[data-theme="dark"] .ws-bt { color: #53bdeb; }
.ws-bt:first-child { border-top: 0; }
.ws-bt:hover { background: var(--ws-hover); }
.ws-bt[disabled] { color: var(--ws-muted); cursor: default; }
.ws-bt[disabled]:hover { background: none; }
/* message menu */
.ws-mm { position: absolute; top: 4px; inset-inline-end: 4px; width: 32px; height: 28px; display: grid; place-items: center; border: 0; border-radius: 8px; background: inherit; color: var(--ws-muted); opacity: 0; z-index: 1; }
.ws-m:hover .ws-mm, .ws-mm:focus-visible, .ws-mm[aria-expanded="true"] { opacity: 1; }
@media (hover: none) { .ws-mm { display: none; } }
.ws-m.flash .ws-b { animation: ws-flash 1.2s ease; }
@keyframes ws-flash { 30% { box-shadow: 0 0 0 3px rgba(var(--ws-brand-rgb), .5); } }

/* scroll-to-bottom button */
.ws-down { position: absolute; inset-inline-end: 18px; bottom: 84px; z-index: 4; width: 44px; height: 44px; display: grid; place-items: center; border: 0; border-radius: 50%; background: var(--ws-pill); color: var(--ws-icon); box-shadow: var(--ws-shadow-lg); font-size: 1.2rem; }
.ws-down .cnt { position: absolute; top: -8px; inset-inline-end: -4px; min-width: 22px; height: 22px; padding: 0 6px; display: grid; place-items: center; border-radius: 11px; background: var(--ws-badge); color: var(--ws-on-badge); font-size: 15px; font-weight: 800; }

/* composer */
.ws-foot { flex: 0 0 auto; background: var(--ws-panel-2); z-index: 3; padding-bottom: env(safe-area-inset-bottom); }
.ws-reply { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 8px 16px 0; }
.ws-reply .q { padding: 8px 12px; border-radius: 8px; background: var(--ws-quote); border-inline-start: 4px solid var(--ws-brand-ink); font-size: 15px; min-width: 0; }
.ws-reply .q b { display: block; color: var(--ws-brand-ink); }
.ws-reply .q span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ws-muted); }
.ws-comp { display: flex; align-items: flex-end; gap: 8px; padding: 8px 12px; }
.ws-comp textarea { flex: 1; min-height: 44px; max-height: 160px; padding: 9px 14px; border: 0; border-radius: 10px; background: var(--ws-panel); color: var(--ws-ink); font-size: 16px; line-height: 1.6; resize: none; overflow-y: auto; }
[data-theme="dark"] .ws-comp textarea { background: #1b3549; }
.ws-comp textarea::placeholder { color: var(--ws-muted); }
.ws-comp textarea:focus { outline: none; }
.ws-send { width: 46px; height: 46px; flex: 0 0 auto; display: grid; place-items: center; border: 0; border-radius: 50%; background: var(--ws-brand); color: #fff; font-size: 1.15rem; transition: transform var(--ws-ease); }
:root[data-theme="dark"] .ws-send { background: var(--ws-cyan); color: #022847; }
.ws-send:disabled { opacity: .5; cursor: default; }
.ws-locked { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 62px; padding: 10px 20px; color: var(--ws-muted); font-size: 15px; text-align: center; }
.ws-locked i { color: var(--ws-brand-ink); font-size: 1.1rem; }
.ws-locked.blk { color: var(--ws-danger); }
.ws-locked .ws-btn { margin-inline-start: 6px; }

/* ==========================================================
   Info panel (account details)
   ========================================================== */
.ws-info { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--ws-panel-2); border-inline-start: 1px solid var(--ws-line); }
.ws-info .ws-ph { background: var(--ws-panel); }
.ws-info .ws-ph h2 { font-size: 18px; }
.ws-card { margin-top: 10px; padding: 18px 24px; background: var(--ws-panel); }
.ws-card:first-child { margin-top: 0; }
.ws-card.hero { display: grid; justify-items: center; gap: 4px; padding: 28px 24px; text-align: center; }
.ws-card.hero .ws-av { margin-bottom: 12px; }
.ws-card.hero h3 { margin: 0; font-size: 24px; font-weight: 700; }
.ws-card.hero p { margin: 0; color: var(--ws-muted); }
.ws-card h4 { margin: 0 0 6px; color: var(--ws-muted); font-size: 15px; font-weight: 700; }
.ws-card .about { margin: 0; line-height: 1.8; }
.ws-act { display: flex; align-items: center; gap: 18px; width: 100%; min-height: 56px; padding: 0 24px; border: 0; background: var(--ws-panel); color: var(--ws-ink); font-size: 16px; text-align: start; text-decoration: none; }
.ws-act:hover { background: var(--ws-hover); }
.ws-act > i { width: 24px; color: var(--ws-icon); font-size: 1.2rem; text-align: center; }
.ws-act > span { flex: 1; min-width: 0; }
.ws-act > span small { display: block; color: var(--ws-muted); }
.ws-act.dz, .ws-act.dz > i { color: var(--ws-danger); }
.ws-acts { margin-top: 10px; background: var(--ws-panel); }

/* switch */
.ws-sw { appearance: none; -webkit-appearance: none; position: relative; width: 44px; height: 26px; margin: 0; flex: 0 0 auto; border-radius: 999px; background: #c6ced2; cursor: pointer; transition: background var(--ws-ease); }
[data-theme="dark"] .ws-sw { background: #3b4a54; }
.ws-sw::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: inset-inline-start var(--ws-ease); }
.ws-sw::before { content: ""; position: absolute; inset: -10px -6px; }
.ws-sw:checked { background: var(--ws-brand); }
[data-theme="dark"] .ws-sw:checked { background: var(--ws-cyan); }
.ws-sw:checked::after { inset-inline-start: 21px; }

/* ==========================================================
   Settings pane
   ========================================================== */
.ws-me { display: flex; align-items: center; gap: 16px; padding: 18px 20px; border-bottom: 1px solid var(--ws-line); }
.ws-me .ws-av { width: 72px; height: 72px; font-size: 28px; }
.ws-me > div { min-width: 0; flex: 1; }
.ws-me > div > b { display: block; font-size: 19px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-me > div > span { display: block; color: var(--ws-muted); font-size: 15px; direction: ltr; unicode-bidi: isolate; text-align: start; overflow: hidden; text-overflow: ellipsis; }
.ws-set { padding: 14px 20px; border-bottom: 1px solid var(--ws-line); }
.ws-set > h3 { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; font-size: 16px; font-weight: 800; color: var(--ws-brand-ink); }
.ws-set > p { margin: 0 0 10px; color: var(--ws-muted); font-size: 15px; line-height: 1.7; }
.ws-srow { display: flex; align-items: center; gap: 14px; min-height: 52px; }
.ws-srow > span:first-child { flex: 1; min-width: 0; }
.ws-srow > span:first-child > b { display: block; font-weight: 700; }
.ws-srow > span:first-child > small { display: block; color: var(--ws-muted); line-height: 1.6; }
.ws-seg { display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; border-radius: 12px; background: var(--ws-panel-2); width: 100%; }
.ws-seg button { min-height: 40px; padding: 0 10px; border: 0; border-radius: 9px; background: none; color: var(--ws-muted); font-weight: 700; font-size: 15px; }
.ws-seg button[aria-pressed="true"] { background: var(--ws-panel); color: var(--ws-ink); box-shadow: var(--ws-shadow); }
[data-theme="dark"] .ws-seg button[aria-pressed="true"] { background: var(--ws-active); }
.ws-pill { display: inline-flex; align-items: center; gap: .3rem; padding: 0 10px; border-radius: 999px; font-size: 15px; font-weight: 800; white-space: nowrap; }
.ws-pill.ok { background: rgba(var(--ws-brand-rgb), .12); color: var(--ws-brand-ink); }
.ws-pill.off { background: var(--ws-panel-2); color: var(--ws-muted); }
.ws-pill.bad { background: var(--ws-danger-bg); color: var(--ws-danger); }
.ws-dev { display: flex; align-items: center; gap: 12px; min-height: 58px; border-top: 1px solid var(--ws-line); }
.ws-dev:first-of-type { border-top: 0; }
.ws-dev > i { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; background: var(--ws-panel-2); color: var(--ws-icon); }
.ws-dev > span { flex: 1; min-width: 0; }
.ws-dev b { display: block; font-weight: 700; }
.ws-dev small { color: var(--ws-muted); }
.ws-edit { display: flex; gap: 8px; margin-top: 8px; }
.ws-edit input { flex: 1; min-width: 0; height: 44px; padding: 0 12px; border: 1.5px solid var(--ws-line); border-radius: 10px; background: var(--ws-panel); color: var(--ws-ink); }
.ws-edit input:focus { outline: none; border-color: var(--ws-brand); }
.ws-out { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 56px; padding: 0 20px; border: 0; background: none; color: var(--ws-danger); font-weight: 700; text-align: start; }
.ws-out:hover { background: var(--ws-danger-bg); }
.ws-ver { padding: 16px 20px 28px; color: var(--ws-muted); font-size: 15px; text-align: center; }

/* ==========================================================
   Popup menu, dialogs, toasts, image viewer
   ========================================================== */
.ws-menu { position: fixed; z-index: 80; min-width: 220px; padding: 8px 0; border-radius: 12px; background: var(--ws-panel); box-shadow: var(--ws-shadow-lg); animation: ws-pop 140ms ease-out; }
[data-theme="dark"] .ws-menu { background: #15304a; }
.ws-menu button, .ws-menu a { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 44px; padding: 0 20px; border: 0; background: none; color: var(--ws-ink); font-size: 16px; text-align: start; text-decoration: none; }
.ws-menu button:hover, .ws-menu a:hover, .ws-menu button:focus-visible { background: var(--ws-hover); outline: none; }
[data-theme="dark"] .ws-menu button:hover, [data-theme="dark"] .ws-menu button:focus-visible { background: #0f2433; }
.ws-menu i { width: 20px; color: var(--ws-icon); text-align: center; }
.ws-menu .dz, .ws-menu .dz i { color: var(--ws-danger); }
@keyframes ws-pop { from { opacity: 0; transform: scale(.96); } }

dialog.ws-dlg { width: min(460px, calc(100vw - 32px)); padding: 0; border: 0; border-radius: 18px; background: var(--ws-panel); color: var(--ws-ink); box-shadow: var(--ws-shadow-lg); }
[data-theme="dark"] dialog.ws-dlg { background: #15304a; }
dialog.ws-dlg::backdrop { background: rgba(2, 40, 71, .55); }
.ws-dlg .in { padding: 24px 24px 18px; }
.ws-dlg h3 { margin: 0 0 8px; font-size: 19px; font-weight: 800; }
.ws-dlg p { margin: 0; color: var(--ws-muted); line-height: 1.8; }
.ws-dlg .acts { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.ws-dlg .steps { margin: 14px 0 0; padding: 0; list-style: none; display: grid; gap: 12px; counter-reset: st; }
.ws-dlg .steps li { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 12px; align-items: center; color: var(--ws-ink); }
.ws-dlg .steps li::before { counter-increment: st; content: counter(st); width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: rgba(var(--ws-brand-rgb), .12); color: var(--ws-brand-ink); font-weight: 800; }
.ws-dlg .steps i { color: var(--ws-info); font-size: 1.1rem; margin: 0 2px; }

.ws-toasts { position: fixed; z-index: 90; bottom: calc(18px + env(safe-area-inset-bottom)); inset-inline: 0; display: grid; justify-items: center; gap: 8px; pointer-events: none; }
.ws-toast { display: flex; align-items: center; gap: 12px; max-width: min(520px, calc(100vw - 32px)); padding: 10px 12px 10px 18px; padding-inline: 18px 12px; border-radius: 12px; background: #0f2a3d; color: #e6f1f3; box-shadow: var(--ws-shadow-lg); font-size: 15px; pointer-events: auto; animation: ws-up 200ms ease-out; }
.ws-toast button { min-height: 36px; padding: 0 10px; border: 0; border-radius: 8px; background: none; color: #53bdeb; font-weight: 800; }
.ws-toast.err { background: #8a1c14; }
@keyframes ws-up { from { opacity: 0; transform: translateY(10px); } }

.ws-viewer { position: fixed; inset: 0; z-index: 95; display: grid; place-items: center; padding: 56px 16px 16px; background: rgba(2, 24, 40, .94); }
.ws-viewer img { max-width: 100%; max-height: 100%; border-radius: 6px; }
.ws-viewer .ws-ib { position: absolute; top: 8px; inset-inline-end: 8px; color: #fff; }

/* ==========================================================
   Phone tab bar
   ========================================================== */
.ws-tabs { display: none; }

/* ==========================================================
   Tablet: no rail
   ========================================================== */
@media (max-width: 899.98px) {
  .ws-app, .ws-app.info-open { grid-template-columns: minmax(300px, 40%) minmax(0, 1fr); }
  .ws-rail { display: none; }
  .ws-msgs { padding-inline: 14px; }
  .ws-unread-sep { margin-inline: -14px; }
}

/* ==========================================================
   Phone: one screen at a time
   ========================================================== */
@media (max-width: 699.98px) {
  .ws-app, .ws-app.info-open { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
  .ws-side { grid-row: 1; grid-column: 1; border: 0; }
  .ws-main { grid-row: 1 / -1; grid-column: 1; }
  .ws-info { grid-row: 1 / -1; grid-column: 1; border: 0; z-index: 6; }
  .ws-app[data-view="list"] .ws-main, .ws-app[data-view="settings"] .ws-main, .ws-app[data-view="archived"] .ws-main, .ws-app[data-view="team"] .ws-main { display: none; }
  .ws-app[data-view="chat"] .ws-side, .ws-app[data-view="info"] .ws-side { display: none; }
  .ws-app[data-view="chat"] .ws-tabs, .ws-app[data-view="info"] .ws-tabs { display: none; }
  .ws-app:not([data-view="info"]) .ws-info { display: none; }
  .ws-welcome { display: none; }
  .ws-ch { padding-inline: 4px 6px; gap: 4px; border: 0; background: var(--ws-panel); }
  .ws-ch .back { display: inline-grid; margin-inline-start: 0; }
  .ws-ch .who { gap: 10px; }
  .ws-ph { padding-inline-start: 16px; }
  .ws-ph h1 { font-size: 24px; }
  .ws-m { max-width: 86%; }
  .ws-row { min-height: 76px; }
  .ws-down { bottom: 80px; inset-inline-end: 12px; }
  .ws-tabs { grid-row: 2; grid-column: 1; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); background: var(--ws-panel); border-top: 1px solid var(--ws-line); z-index: 5; }
  .ws-tabs button { display: grid; justify-items: center; gap: 2px; min-height: 56px; border: 0; background: none; color: var(--ws-muted); font-size: 15px; font-weight: 700; }
  .ws-tabs button .ic { position: relative; width: 64px; height: 32px; display: grid; place-items: center; border-radius: 16px; font-size: 1.25rem; transition: background var(--ws-ease); }
  .ws-tabs button[aria-current="true"] { color: var(--ws-ink); }
  .ws-tabs button[aria-current="true"] .ic { background: rgba(var(--ws-brand-rgb), .16); color: var(--ws-brand-ink); }
  .ws-tabs .ic .dot { position: absolute; top: -4px; inset-inline-end: 6px; min-width: 20px; height: 20px; padding: 0 5px; display: grid; place-items: center; border-radius: 10px; background: var(--ws-badge); color: var(--ws-on-badge); font-size: 15px; font-weight: 800; line-height: 1; }
  .ws-card.hero .ws-av.lg { width: 140px; height: 140px; font-size: 56px; }
  .ws-pane.slide { transition: none; }
}

/* account details over the conversation when there is no room for a fourth column */
@media (min-width: 700px) and (max-width: 1279.98px) {
  .ws-info { position: fixed; inset-block: 0; inset-inline-end: 0; width: min(400px, 100%); z-index: 20; box-shadow: var(--ws-shadow-lg); }
}
[dir="rtl"] .ws-me > div > span { text-align: right; }

/* brand name in the icon's gradient (plain teal where background-clip text is not supported) */
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .ws-ph h1 .ws-bn { display: inline-block; padding: .05em .05em .3em; margin-bottom: -.25em; line-height: 1.5; background: var(--ws-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
  [data-theme="dark"] .ws-ph h1 .ws-bn { background: linear-gradient(135deg, #0ce2da, #05e4aa); -webkit-background-clip: text; background-clip: text; }
}
[data-theme="dark"] .ws-tick-v { color: var(--ws-mint); }

/* reply inbox (core/team.php): who on the team wrote a reply, and which account a conversation is with */
.ws-b .by { display: block; margin-bottom: 2px; color: var(--ws-brand-ink); font-size: 15px; font-weight: 800; }
.ws-row .ws-to { color: var(--ws-brand-ink); font-weight: 700; }

/* attachments (core/files.php): the paperclip, the chosen file above the box, a document in a bubble, the drop zone */
.ws-comp .ws-att { flex: 0 0 auto; color: var(--ws-muted); }
.ws-attbar .q { display: flex; align-items: center; gap: 10px; }
.ws-attbar .th { width: 44px; height: 44px; flex: 0 0 auto; display: grid; place-items: center; overflow: hidden; border-radius: 8px; background: var(--ws-panel); color: var(--ws-brand-ink); font-size: 1.4rem; }
.ws-attbar .th img { width: 100%; height: 100%; object-fit: cover; }
.ws-attbar .tx { min-width: 0; display: grid; }
.ws-attbar .tx b, .ws-attbar .tx span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-file { display: flex; align-items: center; gap: 10px; min-width: min(260px, 62vw); margin: -2px -5px 6px; padding: 10px 12px; border-radius: 8px; background: var(--ws-quote); color: inherit; text-decoration: none; }
.ws-file:hover { filter: brightness(.97); }
.ws-file .fi { width: 40px; height: 40px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 8px; background: rgba(var(--ws-brand-rgb), .14); color: var(--ws-brand-ink); font-size: 1.35rem; }
.ws-file .fn { flex: 1; min-width: 0; display: grid; }
.ws-file .fn b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
.ws-file .fn small { color: var(--ws-muted); font-size: 15px; }
.ws-file .dl { color: var(--ws-muted); font-size: 1.15rem; }
.ws-b .img img[width] { height: auto; }
.ws-chat.is-drop .ws-msgs { outline: 3px dashed rgba(var(--ws-brand-rgb), .6); outline-offset: -10px; }
