/* WhatsApp-style interface (RTL). Colours follow the current WhatsApp light/dark themes. */
:root {
  --bg: #ffffff; --ink: #111b21; --muted: #667781; --line: #e9edef;
  --green: #008069; --fab: #25d366; --fab-ink: #0b1410; --send: #00a884; --send-ink: #ffffff;
  --in: #ffffff; --out: #d9fdd3; --wall: #efeae2; --wall-ink: rgba(11, 20, 26, .045);
  --chip: #f0f2f5; --chip-ink: #3b4a54; --tick: #53bdeb; --link: #027eb5; --danger: #ea0038; --good: #1fa855; --warn: #b45309;
  --nav-active: #d9fdd3; --shadow: 0 1px .5px rgba(11, 20, 26, .13);
  --bar: #ffffff; --bar-ink: #111b21; --warn-bg: #fff4e0;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111b21; --ink: #e9edef; --muted: #8696a0; --line: #222d34;
    --green: #00a884; --fab: #00a884; --fab-ink: #0b1410; --send: #00a884;
    --in: #202c33; --out: #005c4b; --wall: #0b141a; --wall-ink: rgba(255, 255, 255, .03);
    --chip: #202c33; --chip-ink: #c5d0d6; --link: #53bdeb; --danger: #f15c6d; --good: #4ade80; --warn: #f59e0b;
    --nav-active: #103529; --shadow: 0 1px .5px rgba(0, 0, 0, .4); --bar: #111b21; --bar-ink: #e9edef; --warn-bg: #2b2412;
  }
  :root:not([data-theme="light"]) .bubble.out .meta, :root:not([data-theme="light"]) .bubble.out .tick:not(.read) { color: rgba(255, 255, 255, .68); }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Arial, sans-serif; -webkit-text-size-adjust: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { display: block; fill: currentColor; }
#app { max-width: 640px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; position: relative; background: var(--bg); }

/* ---- app bar ---- */
#bar { position: sticky; top: 0; z-index: 8; background: var(--bar); padding-top: env(safe-area-inset-top); }
.appbar { position: relative; display: flex; align-items: center; gap: 12px; padding: 8px 12px 8px 16px; min-height: 56px;
  background: var(--bar); color: var(--bar-ink); }
.appbar h1 { margin: 0; flex: 1; font-size: 1.45rem; font-weight: 700; color: var(--green); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.appbar .title { flex: 1; min-width: 0; line-height: 1.2; }
.appbar .title b { display: block; font-size: 1.05rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.appbar .title span { display: block; font-size: .8rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.iconbtn { width: 40px; height: 40px; border: 0; background: transparent; border-radius: 50%; display: grid; place-items: center; color: inherit; flex: none; }
.iconbtn:active { background: var(--chip); }
.menu { position: absolute; top: 48px; inset-inline-end: 12px; z-index: 12; background: var(--in); color: var(--ink); border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .25); min-width: 190px; padding: 6px 0; }
.menu button { display: block; width: 100%; text-align: start; padding: 12px 18px; border: 0; background: none; }
.menu button:active { background: var(--chip); }

/* ---- main + bottom nav ---- */
main { padding: 0 0 calc(86px + env(safe-area-inset-bottom)); min-height: calc(100dvh - 56px); }
main.pad { padding: 8px 16px calc(96px + env(safe-area-inset-bottom)); }
.bottomnav { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: min(100%, 640px); z-index: 9; display: flex;
  background: var(--bar); border-top: 1px solid var(--line); padding: 8px 2px calc(8px + env(safe-area-inset-bottom)); }
.bottomnav button { flex: 1; border: 0; background: none; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: .7rem; font-weight: 600; min-width: 0; }
.navpill { position: relative; width: 52px; height: 30px; border-radius: 16px; display: grid; place-items: center; }
.bottomnav button.on { color: var(--ink); }
.bottomnav button.on .navpill { background: var(--nav-active); }
.badge { position: absolute; top: -4px; inset-inline-end: 0; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--fab);
  color: var(--fab-ink); font-size: .7rem; font-weight: 700; line-height: 18px; text-align: center; }
.badge[hidden] { display: none; }
.badge.inline { position: static; flex: none; }
.fab { position: fixed; bottom: calc(88px + env(safe-area-inset-bottom)); inset-inline-end: max(16px, calc(50% - 304px)); z-index: 7; width: 56px; height: 56px;
  border: 0; border-radius: 16px; background: var(--fab); color: var(--fab-ink); display: grid; place-items: center; box-shadow: 0 3px 8px rgba(0, 0, 0, .3); }

/* ---- chat list ---- */
.searchpill { display: flex; align-items: center; gap: 10px; margin: 4px 16px 10px; padding: 0 14px; height: 44px; border-radius: 22px; background: var(--chip); color: var(--muted); }
.searchpill input { flex: 1; border: 0; background: none; outline: 0; min-width: 0; height: 100%; color: var(--ink); }
.fchips { display: flex; gap: 8px; padding: 0 16px 8px; overflow-x: auto; }
.fchip { flex: none; padding: 6px 14px; border-radius: 18px; border: 1px solid var(--line); background: none; color: var(--muted); font-weight: 600; }
.fchip.on { background: var(--nav-active); border-color: transparent; color: var(--ink); }
.chatrow { display: flex; align-items: center; gap: 14px; padding: 10px 16px; cursor: pointer; }
.chatrow:active { background: var(--chip); }
.avatar { width: 50px; height: 50px; border-radius: 50%; display: grid; place-items: center; flex: none; color: #fff; font-weight: 700; font-size: 1.2rem; }
.avatar.big { width: 96px; height: 96px; font-size: 2.4rem; }
.avatar.small { width: 40px; height: 40px; font-size: 1rem; }
.chatmain { flex: 1; min-width: 0; }
.chatmain .l1, .chatmain .l2 { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.chatmain b { font-size: 1.02rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.chatmain .time { font-size: .75rem; color: var(--muted); flex: none; }
.chatmain .time.unread { color: var(--fab); font-weight: 700; }
.preview { color: var(--muted); font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.empty { color: var(--muted); text-align: center; padding: 40px 24px; }

/* ---- chat screen ---- */
.chatscreen { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
.msgs { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; padding: 10px 12px;
  background-color: var(--wall);
  background-image: radial-gradient(var(--wall-ink) 1.5px, transparent 1.6px), radial-gradient(var(--wall-ink) 1.5px, transparent 1.6px);
  background-size: 26px 26px; background-position: 0 0, 13px 13px; }
.dateline { align-self: center; margin: 8px 0; padding: 4px 12px; border-radius: 8px; background: var(--in); color: var(--muted); font-size: .78rem; box-shadow: var(--shadow); }
.bubble { position: relative; max-width: 84%; padding: 6px 9px 4px; border-radius: 8px; box-shadow: var(--shadow); overflow-wrap: anywhere; }
.bubble.in { background: var(--in); align-self: flex-start; }
.bubble.out { background: var(--out); align-self: flex-end; }
.bubble.tail { margin-top: 6px; }
.bubble.tail.in { border-start-start-radius: 0; }
.bubble.tail.out { border-start-end-radius: 0; }
.bubble.tail::before { content: ""; position: absolute; top: 0; width: 8px; height: 13px; }
.bubble.tail.in::before { inset-inline-start: -8px; background: var(--in); clip-path: polygon(0 0, 100% 0, 0 100%); }
.bubble.tail.out::before { inset-inline-end: -8px; background: var(--out); clip-path: polygon(0 0, 100% 0, 100% 100%); }
.bubble .sender { font-size: .8rem; font-weight: 700; margin-bottom: 1px; }
.bubble .body { white-space: pre-wrap; }
.meta { display: flex; justify-content: flex-end; align-items: center; gap: 3px; font-size: .68rem; color: var(--muted); margin-top: 1px; }
.tick { width: 17px; height: 17px; color: var(--muted); }
.tick.read { color: var(--tick); }
.ridebubble { width: min(88%, 420px); }
.ridebubble .route { font-size: 1.12rem; font-weight: 700; }
.ridebubble .head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.price { font-weight: 700; color: var(--warn); white-space: nowrap; }
.botbtns { align-self: flex-start; width: min(88%, 420px); display: flex; flex-direction: column; gap: 2px; margin-bottom: 4px; }
.botbtns.out { align-self: flex-end; }
.head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.route { font-size: 1.12rem; font-weight: 700; }
.botbtn { border: 0; background: var(--in); color: var(--link); font-weight: 600; padding: 11px 10px; border-radius: 8px; box-shadow: var(--shadow); text-align: center; }
.botbtn.danger { color: var(--danger); }
.botbtn:disabled { opacity: .55; }
.composer { display: flex; align-items: flex-end; gap: 8px; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); background: var(--wall); }
.composer .field { flex: 1; display: flex; align-items: center; background: var(--in); border-radius: 24px; padding: 0 14px; min-height: 46px; box-shadow: var(--shadow); }
.composer input { flex: 1; border: 0; background: none; outline: 0; min-width: 0; height: 44px; }
.sendbtn { width: 46px; height: 46px; border-radius: 50%; border: 0; background: var(--send); color: var(--send-ink); display: grid; place-items: center; flex: none; }

/* ---- generic content ---- */
.card { background: var(--in); border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin: 0 0 12px; overflow-wrap: anywhere; }
.card h2, .card h3 { margin: 0 0 6px; font-size: 1.05rem; }
.cardbtns { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.cardbtns .botbtn { background: var(--chip); box-shadow: none; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.num { color: var(--muted); font-size: .82rem; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; margin: 6px 0; }
.chip { background: var(--chip); color: var(--chip-ink); border-radius: 999px; padding: 2px 10px; font-size: .8rem; overflow-wrap: anywhere; }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.bad { background: rgba(234, 0, 56, .1); color: var(--danger); }
.chip.good { background: rgba(31, 168, 85, .12); color: var(--good); }
.raw { color: var(--muted); font-size: .85rem; margin: 4px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.btn { background: var(--send); color: var(--send-ink); border: 0; border-radius: 22px; padding: 10px 18px; font-weight: 700; }
.btn.ghost { background: transparent; color: var(--green); border: 1px solid var(--line); }
.btn.danger { background: transparent; color: var(--danger); border: 1px solid var(--line); }
.btn.small { padding: 6px 14px; font-size: .9rem; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; }
input[type=text], input[type=tel], input[type=number], input[type=password], select, textarea {
  width: 100%; background: var(--chip); border: 0; border-bottom: 2px solid transparent; border-radius: 10px; padding: 11px 12px; outline: 0; }
input:focus, select:focus, textarea:focus { border-bottom-color: var(--send); }
textarea { min-height: 84px; resize: vertical; }
label { display: block; font-size: .82rem; color: var(--muted); margin: 12px 0 4px; }
label.check { display: flex; align-items: center; gap: 8px; color: var(--ink); font-size: 1rem; margin: 6px 0; }
label.check input { width: auto; }
.notice { background: var(--warn-bg); color: var(--warn); border-radius: 10px; padding: 8px 12px; font-size: .9rem; margin: 0 0 12px; }
.status { font-weight: 700; }
.status.open, .status.accepted { color: var(--green); } .status.done { color: var(--good); } .status.cancelled { color: var(--danger); }
.cust { background: var(--chip); border-radius: 10px; padding: 8px 12px; margin: 8px 0; }
.cust a { color: var(--link); font-weight: 700; }
.cand { border-top: 1px solid var(--line); padding: 10px 0; }
.light { font-size: .85rem; font-weight: 700; white-space: nowrap; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-inline-end: 5px; background: #d97706; }
.dot.green { background: var(--good); } .dot.red { background: var(--danger); } .dot.yellow { background: #d97706; }
.err { color: var(--danger); min-height: 1.2em; font-size: .9rem; margin: 6px 0; }
.seg { display: flex; gap: 8px; margin: 4px 0 12px; }
.seg button { flex: 1; padding: 9px; border-radius: 20px; border: 1px solid var(--line); background: none; color: var(--muted); font-weight: 600; }
.seg button.on { background: var(--nav-active); color: var(--ink); border-color: transparent; }
.total { text-align: center; padding: 14px 0 6px; }
.total b { display: block; font-size: 1.8rem; }
.profilehead { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px 0 8px; }
.sectionhead { padding: 14px 0 4px; color: var(--green); font-size: .85rem; font-weight: 700; }
.memberrow { display: flex; align-items: center; gap: 12px; padding: 8px 0; }
.profilehead h2, .memberrow .grow, .vrow, .sheet, .login { overflow-wrap: anywhere; }
.vrow > div { min-width: 0; }
.vrow { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.vrow .state { font-weight: 700; font-size: .85rem; }
.vrow .state.approved { color: var(--good); } .vrow .state.pending { color: var(--warn); }
.vrow .state.rejected, .vrow .state.outdated { color: var(--danger); }
.docimg { width: 100%; max-height: 260px; object-fit: contain; border-radius: 10px; background: var(--chip); margin: 4px 0; }
.picker { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.picker img { width: 72px; height: 72px; object-fit: cover; border-radius: 10px; background: var(--chip); }

/* ---- sheets + toast ---- */
.backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: min(100%, 640px); background: var(--bg); border-radius: 18px 18px 0 0; padding: 16px 16px calc(18px + env(safe-area-inset-bottom)); max-height: 88dvh; overflow-y: auto; }
.sheet h2 { margin: 0 0 8px; font-size: 1.15rem; }
.sheet .opt { display: flex; align-items: center; gap: 14px; padding: 12px 4px; border: 0; background: none; width: 100%; text-align: start; font-size: 1.02rem; }
.etachips { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.etachips button { padding: 8px 14px; border-radius: 18px; border: 1px solid var(--line); background: none; font-weight: 600; }
.etachips button.on { background: var(--nav-active); border-color: transparent; }
.toast { position: fixed; bottom: calc(96px + env(safe-area-inset-bottom)); inset-inline: 16px; margin-inline: auto; width: fit-content; max-width: min(420px, 100% - 32px);
  background: #1f2c34; color: #fff; padding: 10px 16px; border-radius: 10px; text-align: center; z-index: 30; }

/* ---- login ---- */
.login { max-width: 400px; margin: 0 auto; padding: 8vh 20px 24px; text-align: center; }
.logo { width: 84px; height: 84px; margin: 0 auto 12px; border-radius: 24px; background: var(--send); color: #fff; display: grid; place-items: center; }
.login h1 { margin: 0 0 4px; color: var(--green); font-size: 2rem; }
.login .sub { color: var(--muted); margin: 0 0 20px; }
.login form { text-align: start; }
.demo { margin-top: 22px; padding-top: 14px; border-top: 1px dashed var(--line); text-align: center; }
.demo .row { justify-content: center; margin-top: 8px; }

.bottomnav[hidden], #bar[hidden], .fab[hidden] { display: none; }
main.chat { padding: 0; min-height: 0; }

/* ---- replies, reactions, lists ---- */
.fchip.plus { padding: 6px 10px; display: grid; place-items: center; }
.favmark { color: var(--fab); display: inline-flex; margin-inline-end: 4px; }
.quote { border-inline-start: 4px solid var(--green); background: rgba(0, 0, 0, .06); border-radius: 6px; padding: 4px 8px; margin-bottom: 4px; cursor: pointer; overflow: hidden; min-width: 0; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .quote { background: rgba(255, 255, 255, .07); } }
.qname { font-size: .78rem; font-weight: 700; }
.qtext { font-size: .85rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.replybtn { position: absolute; top: 50%; transform: translateY(-50%); width: 28px; height: 28px; border: 0; border-radius: 50%; background: var(--in); color: var(--muted);
  display: grid; place-items: center; opacity: 0; box-shadow: var(--shadow); padding: 0; }
.replybtn svg { transform: scaleX(-1); }
.bubble.in .replybtn { inset-inline-end: -34px; }
.bubble.out .replybtn { inset-inline-start: -34px; }
@media (hover: hover) { .bubble:hover .replybtn { opacity: 1; } }
.reacts { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.react { border: 1px solid var(--line); background: var(--in); border-radius: 12px; padding: 1px 7px; font-size: .9rem; line-height: 1.5; }
.react.mine { background: var(--nav-active); border-color: var(--green); }
.react span { font-size: .75rem; color: var(--muted); }
.composerwrap { background: var(--wall); }
.replybar { display: flex; align-items: center; gap: 8px; background: var(--in); border-radius: 12px 12px 0 0; padding: 8px 10px; margin: 0 8px; }
.replybar .quote { background: var(--chip); cursor: default; }
.quickreacts { display: flex; gap: 4px; justify-content: space-between; background: var(--chip); border-radius: 30px; padding: 6px 8px; margin-bottom: 10px; }
.quickreacts button { border: 0; background: none; font-size: 1.7rem; border-radius: 50%; width: 46px; height: 46px; line-height: 1; display: grid; place-items: center; color: var(--ink); }
.quickreacts button.on { background: var(--nav-active); }
.emojigrid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.emojigrid button { border: 0; background: none; font-size: 1.8rem; border-radius: 12px; height: 50px; }
.emojigrid button:active { background: var(--chip); }
.bubble.flash { animation: flash 1.3s; }
@keyframes flash { 0%, 60% { outline: 3px solid var(--fab); } 100% { outline: 3px solid transparent; } }

.fchips { scrollbar-width: none; }
.fchips::-webkit-scrollbar { display: none; }
.favmark { color: var(--fab); display: inline-flex; margin-inline-end: 4px; }

.sender[data-act] { cursor: pointer; }
.phonelink { color: var(--link); text-decoration: none; font-weight: 600; direction: ltr; }
.vrow span:last-child { color: var(--muted); }

/* ================= WhatsApp parity pass: colours sampled from a real WhatsApp screen recording ================= */
:root {
  --bg: #fdfdfd; --bar: #fdfdfd; --chip: #f4f4f2; --nav-active: #d4fcd1; --out: #d4fcd1; --in: #fdfdff; --wall: #ede8df;
  --fab: #1ba85f; --fab-ink: #ffffff; --send: #1ba85f; --send-ink: #ffffff;
  --doodle: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%22200%22 height=%22200%22 viewBox=%220 0 200 200%22 fill=%22rgba(11%2C20%2C26%2C0.04)%22%3E%3Cg transform=%22translate(14 16) rotate(18 12 12) scale(.9)%22%3E%3Cpath d=%22M20 2H4a2 2 0 0 0-2 2v18l4-4h14a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2z%22/%3E%3C/g%3E%3Cg transform=%22translate(120 22) rotate(-12 12 12) scale(.9)%22%3E%3Cpath d=%22M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z%22/%3E%3C/g%3E%3Cg transform=%22translate(70 62) rotate(14 12 12) scale(.9)%22%3E%3Cpath d=%22M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z%22/%3E%3C/g%3E%3Cg transform=%22translate(150 92) rotate(20 12 12) scale(.9)%22%3E%3Cpath d=%22M6.62 10.79c1.44 2.83 3.76 5.14 6.59 6.59l2.2-2.2c.27-.27.67-.36 1.02-.24 1.12.37 2.33.57 3.57.57.55 0 1 .45 1 1V20c0 .55-.45 1-1 1-9.39 0-17-7.61-17-17 0-.55.45-1 1-1h3.5c.55 0 1 .45 1 1 0 1.25.2 2.45.57 3.57.11.35.03.74-.25 1.02l-2.2 2.2z%22/%3E%3C/g%3E%3Cg transform=%22translate(20 108) rotate(-8 12 12) scale(.9)%22%3E%3Cpath d=%22M18.92 6.01C18.72 5.42 18.16 5 17.5 5h-11c-.66 0-1.21.42-1.42 1.01L3 12v8a1 1 0 0 0 1 1h1a1 1 0 0 0 1-1v-1h12v1a1 1 0 0 0 1 1h1a1 1 0 0 0 1-1v-8l-2.08-5.99z%22/%3E%3C/g%3E%3Cg transform=%22translate(96 128) rotate(10 12 12) scale(.9)%22%3E%3Cpath d=%22M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20zm-3.5 8a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3zm7 0a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3zM12 18c-2.33 0-4.31-1.46-5.11-3.5h10.22C16.31 16.54 14.33 18 12 18z%22/%3E%3C/g%3E%3Cg transform=%22translate(168 160) rotate(-16 12 12) scale(.9)%22%3E%3Cpath d=%22M12 22c1.1 0 2-.9 2-2h-4a2 2 0 0 0 2 2zm6-6v-5c0-3.07-1.64-5.64-4.5-6.32V4a1.5 1.5 0 0 0-3 0v.68C7.63 5.36 6 7.92 6 11v5l-2 2v1h16v-1l-2-2z%22/%3E%3C/g%3E%3Cg transform=%22translate(52 170) rotate(24 12 12) scale(.9)%22%3E%3Cpath d=%22M16 9V4h1c.55 0 1-.45 1-1s-.45-1-1-1H7c-.55 0-1 .45-1 1s.45 1 1 1h1v5c0 1.66-1.34 3-3 3v2h5.97v7l1 1 1-1v-7H19v-2c-1.66 0-3-1.34-3-3z%22/%3E%3C/g%3E%3C/svg%3E");
  font-family: Roboto, "Noto Sans Hebrew", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --doodle: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%22200%22 height=%22200%22 viewBox=%220 0 200 200%22 fill=%22rgba(255%2C255%2C255%2C0.032)%22%3E%3Cg transform=%22translate(14 16) rotate(18 12 12) scale(.9)%22%3E%3Cpath d=%22M20 2H4a2 2 0 0 0-2 2v18l4-4h14a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2z%22/%3E%3C/g%3E%3Cg transform=%22translate(120 22) rotate(-12 12 12) scale(.9)%22%3E%3Cpath d=%22M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z%22/%3E%3C/g%3E%3Cg transform=%22translate(70 62) rotate(14 12 12) scale(.9)%22%3E%3Cpath d=%22M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z%22/%3E%3C/g%3E%3Cg transform=%22translate(150 92) rotate(20 12 12) scale(.9)%22%3E%3Cpath d=%22M6.62 10.79c1.44 2.83 3.76 5.14 6.59 6.59l2.2-2.2c.27-.27.67-.36 1.02-.24 1.12.37 2.33.57 3.57.57.55 0 1 .45 1 1V20c0 .55-.45 1-1 1-9.39 0-17-7.61-17-17 0-.55.45-1 1-1h3.5c.55 0 1 .45 1 1 0 1.25.2 2.45.57 3.57.11.35.03.74-.25 1.02l-2.2 2.2z%22/%3E%3C/g%3E%3Cg transform=%22translate(20 108) rotate(-8 12 12) scale(.9)%22%3E%3Cpath d=%22M18.92 6.01C18.72 5.42 18.16 5 17.5 5h-11c-.66 0-1.21.42-1.42 1.01L3 12v8a1 1 0 0 0 1 1h1a1 1 0 0 0 1-1v-1h12v1a1 1 0 0 0 1 1h1a1 1 0 0 0 1-1v-8l-2.08-5.99z%22/%3E%3C/g%3E%3Cg transform=%22translate(96 128) rotate(10 12 12) scale(.9)%22%3E%3Cpath d=%22M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20zm-3.5 8a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3zm7 0a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3zM12 18c-2.33 0-4.31-1.46-5.11-3.5h10.22C16.31 16.54 14.33 18 12 18z%22/%3E%3C/g%3E%3Cg transform=%22translate(168 160) rotate(-16 12 12) scale(.9)%22%3E%3Cpath d=%22M12 22c1.1 0 2-.9 2-2h-4a2 2 0 0 0 2 2zm6-6v-5c0-3.07-1.64-5.64-4.5-6.32V4a1.5 1.5 0 0 0-3 0v.68C7.63 5.36 6 7.92 6 11v5l-2 2v1h16v-1l-2-2z%22/%3E%3C/g%3E%3Cg transform=%22translate(52 170) rotate(24 12 12) scale(.9)%22%3E%3Cpath d=%22M16 9V4h1c.55 0 1-.45 1-1s-.45-1-1-1H7c-.55 0-1 .45-1 1s.45 1 1 1h1v5c0 1.66-1.34 3-3 3v2h5.97v7l1 1 1-1v-7H19v-2c-1.66 0-3-1.34-3-3z%22/%3E%3C/g%3E%3C/svg%3E"); --fab: #00a884; --fab-ink: #0b141a; --send: #00a884; --send-ink: #0b141a; }
}
body { font-family: inherit; }
.msgs { background-image: var(--doodle); background-size: 200px 200px; background-position: 0 0; }
.searchpill { height: 46px; }
.fchips { gap: 8px; padding: 0 16px 10px; }
.fchip { border: 0; background: var(--chip); color: var(--ink); padding: 9px 18px; font-size: .95rem; font-weight: 500; }
.fchip.on { background: var(--nav-active); color: var(--ink); }
.fchip.plus { padding: 9px 14px; }
.chatrow { gap: 16px; padding: 9px 16px; }
.avatar { width: 56px; height: 56px; font-size: 1.35rem; }
.avatar.small { width: 42px; height: 42px; font-size: 1.05rem; }
.chatmain b { font-size: 1.06rem; font-weight: 500; }
.preview { font-size: .92rem; }
.chatmain .time { font-size: .78rem; }
.badge { background: var(--fab); color: var(--fab-ink); }
.badge.inline { min-width: 22px; height: 22px; line-height: 22px; font-size: .78rem; font-weight: 600; }
.navpill { width: 64px; height: 32px; border-radius: 16px; }
.bottomnav { padding-top: 10px; }
.bottomnav button { font-size: .75rem; }
.bottomnav button.on { font-weight: 700; }
.fab { width: 60px; height: 60px; border-radius: 18px; }
.sendbtn { width: 52px; height: 52px; }
.composer .field { min-height: 50px; gap: 6px; padding: 0 6px 0 14px; }
.composer .field .iconbtn { width: 36px; height: 36px; color: var(--muted); }
.chatsearch { display: flex; align-items: center; gap: 10px; padding: 8px 16px; background: var(--bar); border-top: 1px solid var(--line); color: var(--muted); }
.chatsearch[hidden] { display: none; }
.chatsearch input { flex: 1; border: 0; background: none; outline: 0; color: var(--ink); height: 36px; min-width: 0; }
mark { background: rgba(255, 213, 0, .45); color: inherit; border-radius: 3px; padding: 0 1px; }
.appbar .iconbtn { color: var(--ink); }

/* ---- chat list exactly as in WhatsApp (from the user's screenshots): outlined chips, archive row, pin / mute marks ---- */
.fchip { background: transparent; border: 1px solid #d1d7db; color: var(--ink); font-weight: 500; }
.fchip.on { background: var(--nav-active); border-color: #9fe2a8; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .fchip { border-color: var(--line); } :root:not([data-theme="light"]) .fchip.on { border-color: transparent; } }
.rowicons { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); flex: none; }
.rowicons svg { width: 18px; height: 18px; }
.pt { display: inline-flex; vertical-align: middle; margin-inline-end: 3px; }
.pt .tick { width: 16px; height: 16px; }
.archrow { display: flex; align-items: center; gap: 16px; padding: 10px 16px; cursor: pointer; color: var(--ink); }
.archicon { width: 56px; display: grid; place-items: center; color: var(--muted); }
.archhead { display: flex; align-items: center; gap: 8px; padding: 4px 8px 8px; font-size: 1.2rem; }
.chatmain .time.unread { color: var(--fab); font-weight: 600; }
.avatar { font-weight: 600; }

/* ---- group info / contact info / settings, laid out like WhatsApp ---- */
main.full { padding: 0 0 24px; min-height: calc(100dvh - 56px); }
.gihead { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 20px 16px; text-align: center; }
.gihead h2 { margin: 6px 0 0; font-size: 1.6rem; font-weight: 500; overflow-wrap: anywhere; }
.avatar.huge { width: 132px; height: 132px; font-size: 3.4rem; }
.avatar.mid { width: 48px; height: 48px; font-size: 1.2rem; }
.actionrow { display: flex; justify-content: center; gap: 14px; padding: 4px 16px 18px; }
.actbtn { border: 0; background: none; color: var(--ink); display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: .85rem; min-width: 76px; text-decoration: none; }
.actcircle { width: 76px; height: 54px; border-radius: 27px; background: var(--chip); color: var(--ink); display: grid; place-items: center; }
.divider { height: 8px; background: var(--chip); }
.memberhead { display: flex; justify-content: space-between; align-items: center; padding: 14px 20px 6px; color: var(--muted); font-size: .9rem; }
.memberrow.big { padding: 9px 20px; gap: 16px; cursor: pointer; }
.memberrow.big:active, .setrow.tap:active { background: var(--chip); }
.greencircle { width: 48px; height: 48px; border-radius: 50%; background: var(--fab); color: var(--fab-ink); display: grid; place-items: center; flex: none; }
.adminpill { background: var(--nav-active); color: #0b6b3e; border-radius: 6px; padding: 2px 10px; font-size: .78rem; white-space: nowrap; }
.setrow { display: flex; align-items: center; gap: 22px; padding: 14px 20px; }
.setrow.tap { cursor: pointer; }
.setrow .ic { color: var(--muted); display: grid; place-items: center; width: 28px; flex: none; }
.setrow b { font-weight: 500; font-size: 1.02rem; }
.setrow.good .ic { color: var(--good); }
.setrow.red, .setrow.red .ic, .menu button.red, .opt.red { color: var(--danger); }
.addform { padding: 6px 20px 10px; flex-wrap: nowrap; }
.addform input { flex: 1; }
.padform { padding: 8px 20px 24px; }
.padform h3 { margin: 4px 0 0; }

.addform[hidden], .actbtn[hidden] { display: none; }

/* ---- conversation features: pins, delete tombstones, forwards, unread divider, jump button, multi-select ---- */
.msgswrap { flex: 1; min-height: 0; position: relative; display: flex; flex-direction: column; }
.msgswrap .msgs { flex: 1; }
.tobottom { position: absolute; inset-inline-start: 14px; bottom: 14px; width: 46px; height: 46px; border-radius: 50%; border: 0; background: var(--in); color: var(--muted);
  box-shadow: 0 2px 6px rgba(0, 0, 0, .3); display: grid; place-items: center; z-index: 2; }
.tobottom[hidden] { display: none; }
.tobottom .badge { position: absolute; top: -8px; inset-inline-end: -4px; }
.olderbtn { align-self: center; margin: 6px 0; padding: 6px 16px; border-radius: 16px; border: 0; background: var(--in); color: var(--link); box-shadow: var(--shadow); }
.unreaddiv { align-self: stretch; text-align: center; margin: 10px -12px; padding: 5px 12px; background: rgba(0, 0, 0, .07); color: var(--muted); font-size: .82rem; }
.pinbanner { display: flex; align-items: center; gap: 12px; padding: 8px 16px; background: var(--bar); border-bottom: 1px solid var(--line); cursor: pointer; color: var(--muted); }
.pinbanner b { color: var(--ink); font-size: .85rem; font-weight: 500; }
.mflag { display: inline-flex; color: var(--muted); }
.fwdlabel { display: flex; align-items: center; gap: 4px; color: var(--muted); font-size: .78rem; font-style: italic; margin-bottom: 2px; }
.tomb { color: var(--muted); font-style: italic; display: flex; align-items: center; gap: 6px; }
.body a { color: var(--link); }
#chatsub { display: block; font-size: .8rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#chatsub:empty { display: none; }
#chatsub.typing { color: var(--green); }
.composer .field { align-items: flex-end; }
.composer textarea { flex: 1; border: 0; background: none; outline: 0; resize: none; min-width: 0; padding: 13px 0; max-height: 130px; line-height: 1.3; font: inherit; color: var(--ink); overflow-y: auto; }
.composer .field .iconbtn { margin-bottom: 6px; }
.blockedbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; background: var(--in); color: var(--muted); }
.draft { color: var(--danger); }
.badge.dot { min-width: 12px; height: 12px; padding: 0; border-radius: 6px; line-height: 12px; }
.chatrow.sel { background: var(--nav-active); }
.avwrap { position: relative; flex: none; }
.selcheck { position: absolute; bottom: -2px; inset-inline-end: -2px; width: 22px; height: 22px; border-radius: 50%; background: var(--fab); color: var(--fab-ink); display: grid; place-items: center; border: 2px solid var(--bg); }
.appbar.sel { background: var(--nav-active); }
.appbar.sel .title b { font-size: 1.2rem; }
.sectionhead.pad { padding-inline: 16px; }
.gidesc { color: var(--muted); max-width: 90%; overflow-wrap: anywhere; cursor: pointer; white-space: pre-wrap; }
.gidesc.empty { color: var(--link); }
.replybar .ic { color: var(--muted); display: grid; place-items: center; }
.opt svg { flex: none; }

.composer textarea { min-height: 0; width: auto; border-radius: 0; box-shadow: none; }

/* long unbroken names/about text must wrap on a phone */
.setrow .grow, .gihead .num { overflow-wrap: anywhere; min-width: 0; }

/* selecting several messages */
.chatscreen.selmode > .appbar:not(.sel) { display: none; }
#selbar { position: relative; z-index: 6; }
#selbar .quickreacts { position: absolute; top: 100%; inset-inline: 8px; background: var(--bg, #fff); border-radius: 26px; box-shadow: 0 2px 12px rgba(0, 0, 0, .22); margin-top: 6px; }
.bubble.msel { box-shadow: 0 0 0 3px rgba(27, 168, 95, .55); }
.chatrow, .bubble { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.bubble .body { -webkit-user-select: text; user-select: text; }

/* attachments, voice notes, recording */
.sendbtn[hidden] { display: none; }
.mediaimg { display: block; max-width: min(260px, 70vw); max-height: 320px; min-width: 120px; min-height: 90px; border-radius: 8px; object-fit: cover; background: var(--chip); cursor: pointer; }
.imgbubble { padding: 4px 4px 6px; }
.imgbubble .body { padding: 4px 6px 0; }
.voice { display: flex; align-items: center; gap: 10px; min-width: 190px; padding: 4px 4px 0; }
.vplay { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--send); color: var(--send-ink); display: grid; place-items: center; flex: none; }
.vbar { flex: 1; height: 4px; border-radius: 2px; background: rgba(0, 0, 0, .18); overflow: hidden; }
.vbar i { display: block; height: 100%; width: 0; background: var(--send); }
.vdur { font-size: .8rem; color: var(--muted); min-width: 34px; text-align: end; }
.filerow { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: rgba(0, 0, 0, .06); border-radius: 8px; padding: 10px; text-align: start; color: inherit; font: inherit; cursor: pointer; }
.filerow.static { cursor: default; margin-bottom: 8px; }
.filerow svg { flex: none; color: var(--muted); }
.fname { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.fsize { font-size: .8rem; color: var(--muted); flex: none; }
.previmg { display: block; max-width: 100%; max-height: 50dvh; margin: 0 auto 10px; border-radius: 10px; }
#mediacap { width: 100%; margin-bottom: 8px; }
.recbar { display: flex; align-items: center; gap: 12px; padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); background: var(--wall); }
.recdot { width: 12px; height: 12px; border-radius: 50%; background: #e0245e; animation: recpulse 1s infinite; }
@keyframes recpulse { 50% { opacity: .25; } }
.viewer { position: fixed; inset: 0; z-index: 60; background: rgba(0, 0, 0, .92); display: grid; place-items: center; cursor: zoom-out; }
.viewer img { max-width: 100%; max-height: 100%; object-fit: contain; }

.pushask { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--chip); border-bottom: 1px solid var(--line, rgba(0,0,0,.08)); font-size: .92rem; }

.sysmsg { align-self: center; max-width: 86%; margin: 8px auto; padding: 6px 12px; border-radius: 10px; background: rgba(0, 0, 0, .07); color: var(--muted); font-size: .8rem; text-align: center; overflow-wrap: anywhere; }
.opt.on { font-weight: 700; }

/* photos, mentions, formatting, previews, text size */
.avatar { position: relative; overflow: hidden; }
.avatar .avimg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.bubble .body { font-size: var(--msgfont, 1rem); }
.bubble .body code { font-family: ui-monospace, Menlo, Consolas, monospace; background: rgba(0, 0, 0, .08); border-radius: 4px; padding: 0 4px; }
.mention { color: var(--link, #027eb5); font-weight: 600; }
.badge.at { background: var(--send); color: var(--send-ink); min-width: 20px; }
.mentionpick { display: flex; flex-direction: column; background: var(--bg, #fff); border-top: 1px solid var(--line, rgba(0,0,0,.1)); max-height: 220px; overflow-y: auto; }
.mentionpick button { display: flex; align-items: center; gap: 10px; border: 0; background: none; padding: 8px 14px; text-align: start; font: inherit; color: var(--ink); }
.mentionpick button:active { background: var(--chip); }
.lpcard { display: block; margin: 6px 0 2px; padding: 8px 10px; border-radius: 8px; background: rgba(0, 0, 0, .06); border-inline-start: 3px solid var(--send); color: inherit; text-decoration: none; overflow-wrap: anywhere; }
.lpcard .lpd { font-size: .82rem; color: var(--muted); }
.wallsw { display: inline-block; width: 18px; height: 18px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, .25); vertical-align: middle; }
