:root {
  --accent: #0f766e;
  --ink: #1c1917;
  --muted: #78716c;
  --paper: #f4f1ea;
  --card: #fffdf8;
  --line: #e7e1d6;
  --bubble-me: var(--accent);
  --bubble-them: #ffffff;
  --radius: 18px;
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--paper); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button, input, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  border: 0; border-radius: 999px; padding: .85rem 1.4rem; font-weight: 700; cursor: pointer;
  background: var(--accent); color: #fff; text-decoration: none; transition: transform .12s, filter .12s;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--line); }
.btn.wa { background: #1fa855; }
.btn.small { padding: .5rem .9rem; font-size: .85rem; }
.btn.danger { background: #b91c1c; }

.input {
  width: 100%; padding: .9rem 1.1rem; border-radius: 14px; border: 1.5px solid var(--line);
  background: #fff; outline: none; transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 15%, transparent); }
label { font-size: .82rem; font-weight: 600; color: var(--muted); display: block; margin-bottom: .35rem; }

/* Install banner */
.install-banner {
  display: flex; align-items: center; gap: .75rem; padding: .6rem 1rem;
  background: var(--ink); color: #fff; font-size: .88rem;
}
.install-banner img { width: 32px; height: 32px; border-radius: 8px; }
.install-banner .grow { flex: 1; line-height: 1.25; }
.install-banner small { opacity: .7; display: block; }
.install-banner .x { background: none; border: 0; color: #fff; opacity: .6; cursor: pointer; font-size: 1.2rem; }

/* Header */
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 1rem clamp(1rem, 4vw, 3rem); }
.logo { display: flex; align-items: center; gap: .6rem; font-weight: 800; font-size: 1.1rem; text-decoration: none; letter-spacing: -.01em; }
.logo img { width: 34px; height: 34px; border-radius: 10px; }
.topbar nav a { text-decoration: none; font-weight: 600; color: var(--muted); }
.topbar nav a:hover { color: var(--ink); }

/* Landing */
.hero {
  display: grid; grid-template-columns: 1.05fr .95fr; gap: clamp(2rem, 5vw, 5rem); align-items: center;
  max-width: 1120px; margin: 0 auto; padding: 2rem clamp(1rem, 4vw, 3rem) 4rem;
}
.eyebrow { display: inline-flex; align-items: center; gap: .45rem; font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); }
.eyebrow .dot { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 4px #22c55e33; animation: pulse 2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px #22c55e00; } }
.hero h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); line-height: 1.04; letter-spacing: -.035em; margin: .8rem 0 1rem; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero p.lead { font-size: 1.1rem; color: var(--muted); max-width: 32rem; line-height: 1.55; margin: 0 0 1.8rem; }
.start-card { background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 1.4rem; max-width: 30rem; box-shadow: 0 20px 40px -24px #1c191733; }
.start-card .row { display: grid; gap: .9rem; }
.start-card .btn { width: 100%; margin-top: .3rem; }
.start-card .note { font-size: .8rem; color: var(--muted); margin: .8rem 0 0; text-align: center; }
.error { color: #b91c1c; font-size: .85rem; margin: .2rem 0 0; }
.badges { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.4rem; }
.badge { display: inline-flex; gap: .4rem; align-items: center; font-size: .82rem; font-weight: 600; padding: .45rem .8rem; border-radius: 999px; background: #fff; border: 1px solid var(--line); }
.wa-row { margin-top: 1.2rem; display: flex; flex-wrap: wrap; gap: .6rem; }
.link-row { display: contents; }
.btn.call { background: #2563eb; }
.btn.tg { background: #229ed9; }

/* Phone mockup */
.phone {
  width: min(330px, 100%); margin: 0 auto; aspect-ratio: 9/18.5; border-radius: 44px; background: var(--ink);
  padding: 12px; box-shadow: 0 40px 80px -30px #1c191766, inset 0 0 0 2px #44403c; transform: rotate(2deg);
}
.phone-screen { height: 100%; border-radius: 34px; overflow: hidden; background: #ece5d8; display: flex; flex-direction: column; }
.phone-status { display: flex; justify-content: space-between; padding: .7rem 1.3rem .3rem; font-size: .75rem; font-weight: 700; }
.phone-head { display: flex; align-items: center; gap: .6rem; padding: .5rem 1rem .8rem; background: var(--card); border-bottom: 1px solid var(--line); }
.phone-head .av { width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: .85rem; }
.phone-head b { display: block; font-size: .9rem; }
.phone-head small { color: #16a34a; font-size: .72rem; font-weight: 600; }
.phone-body { flex: 1; padding: 1rem .8rem; display: flex; flex-direction: column; gap: .5rem; font-size: .82rem; }
.phone-body .b { max-width: 80%; padding: .55rem .8rem; border-radius: 14px; line-height: 1.35; opacity: 0; animation: pop .4s forwards; }
.phone-body .b.them { background: #fff; border-bottom-left-radius: 4px; }
.phone-body .b.me { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.phone-body .b:nth-child(1) { animation-delay: .3s } .phone-body .b:nth-child(2) { animation-delay: 1s } .phone-body .b:nth-child(3) { animation-delay: 1.8s } .phone-body .b:nth-child(4) { animation-delay: 2.6s }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.96); } to { opacity: 1; transform: none; } }
.phone-input { margin: .6rem; padding: .6rem .9rem; border-radius: 999px; background: #fff; color: var(--muted); font-size: .8rem; }

.features { max-width: 1120px; margin: 0 auto; padding: 0 clamp(1rem, 4vw, 3rem) 4rem; display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.feature { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.3rem; }
.feature .ico { font-size: 1.4rem; }
.feature h3 { margin: .6rem 0 .3rem; font-size: 1rem; }
.feature p { margin: 0; color: var(--muted); font-size: .9rem; line-height: 1.5; }
footer.site { text-align: center; color: var(--muted); font-size: .8rem; padding: 0 1rem 2rem; }

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; padding-top: .5rem; }
  .phone { display: none; }
  .features { grid-template-columns: 1fr; }
}

/* Chat page */
.chat-app { height: 100dvh; display: flex; flex-direction: column; max-width: 760px; margin: 0 auto; background: #ece5d8; border-inline: 1px solid var(--line); }
.chat-head { display: flex; align-items: center; gap: .75rem; padding: .8rem 1rem; background: var(--card); border-bottom: 1px solid var(--line); }
.chat-head .av { width: 40px; height: 40px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 800; }
.chat-head .who { flex: 1; min-width: 0; }
.chat-head b { display: block; }
.chat-head small { color: var(--muted); font-size: .78rem; }
.chat-head small.online::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #22c55e; margin-right: .35rem; vertical-align: middle; }
.icon-btn { background: none; border: 0; width: 38px; height: 38px; border-radius: 50%; cursor: pointer; display: grid; place-items: center; color: var(--muted); text-decoration: none; font-size: 1.1rem; }
.icon-btn:hover { background: #0000000d; color: var(--ink); }
.messages { flex: 1; overflow-y: auto; padding: 1.2rem 1rem; display: flex; flex-direction: column; gap: .35rem;
  background-image: radial-gradient(#00000009 1px, transparent 1px); background-size: 18px 18px; }
.msg { max-width: min(78%, 520px); padding: .6rem .85rem .4rem; border-radius: 16px; line-height: 1.42; white-space: pre-wrap; word-wrap: break-word; box-shadow: 0 1px 1px #0000000f; animation: pop .25s; }
.msg time { display: block; text-align: right; font-size: .68rem; opacity: .6; margin-top: .15rem; }
.msg.them { background: var(--bubble-them); border-bottom-left-radius: 5px; }
.msg.me { align-self: flex-end; background: var(--bubble-me); color: #fff; border-bottom-right-radius: 5px; }
.msg.system { align-self: center; background: #fff8; font-size: .8rem; color: var(--muted); box-shadow: none; border-radius: 999px; padding: .35rem .9rem; }
.msg.system time { display: none; }
.msg.pending { opacity: .6; }
.day-sep { align-self: center; font-size: .72rem; font-weight: 700; color: var(--muted); background: #fff9; padding: .2rem .7rem; border-radius: 999px; margin: .5rem 0; }
.composer { display: flex; gap: .5rem; padding: .7rem; background: var(--card); border-top: 1px solid var(--line); align-items: flex-end; }
.composer textarea { flex: 1; resize: none; max-height: 140px; border-radius: 22px; padding: .7rem 1rem; border: 1.5px solid var(--line); outline: none; background: #fff; line-height: 1.35; }
.composer textarea:focus { border-color: var(--accent); }
.send { width: 46px; height: 46px; border-radius: 50%; border: 0; background: var(--accent); color: #fff; cursor: pointer; display: grid; place-items: center; flex: none; }
.send:disabled { opacity: .5; }
.center-screen { flex: 1; display: grid; place-items: center; padding: 1.5rem; }

/* Admin */
.admin { height: 100dvh; display: grid; grid-template-columns: 340px 1fr; background: var(--paper); }
.admin aside { border-right: 1px solid var(--line); background: var(--card); display: flex; flex-direction: column; min-height: 0; }
.admin .side-head { padding: 1rem; border-bottom: 1px solid var(--line); display: grid; gap: .7rem; }
.admin .side-head .top { display: flex; align-items: center; justify-content: space-between; }
.tabs { display: flex; gap: .3rem; background: var(--paper); padding: .25rem; border-radius: 999px; }
.tabs button { flex: 1; border: 0; background: none; padding: .4rem; border-radius: 999px; font-size: .82rem; font-weight: 600; cursor: pointer; color: var(--muted); }
.tabs button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 2px #0001; }
.conv-list { flex: 1; overflow-y: auto; }
.conv { display: flex; gap: .7rem; align-items: center; padding: .85rem 1rem; border-bottom: 1px solid var(--line); cursor: pointer; }
.conv:hover { background: #00000005; }
.conv.active { background: color-mix(in srgb, var(--accent) 9%, transparent); }
.conv .av { width: 40px; height: 40px; border-radius: 50%; background: #e7e1d6; display: grid; place-items: center; font-weight: 800; flex: none; }
.conv .meta { flex: 1; min-width: 0; }
.conv .meta b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv .meta small { color: var(--muted); font-size: .78rem; }
.conv .right { text-align: right; font-size: .72rem; color: var(--muted); display: grid; gap: .3rem; justify-items: end; }
.unread { background: var(--accent); color: #fff; border-radius: 999px; padding: .05rem .5rem; font-weight: 700; font-size: .72rem; }
.pill { font-size: .7rem; padding: .1rem .5rem; border-radius: 999px; background: #e7e1d6; font-weight: 600; }
.pill.open { background: #dcfce7; color: #166534; }
.admin main { display: flex; flex-direction: column; min-height: 0; }
.admin main .chat-app { max-width: none; height: 100%; border: 0; }
.empty { color: var(--muted); text-align: center; }
.empty .big { font-size: 2.5rem; }
.login-wrap { min-height: 100dvh; display: grid; place-items: center; padding: 1rem; }
.login-card { width: min(400px, 100%); background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 2rem; display: grid; gap: 1rem; }
.login-card h1 { margin: 0; font-size: 1.5rem; letter-spacing: -.02em; }
.modal-bg { position: fixed; inset: 0; background: #1c191766; display: grid; place-items: center; padding: 1rem; z-index: 10; }
.modal { width: min(520px, 100%); background: var(--card); border-radius: 22px; padding: 1.6rem; display: grid; gap: .9rem; max-height: 90dvh; overflow: auto; }
.modal h2 { margin: 0; }
.modal .actions { display: flex; gap: .5rem; justify-content: flex-end; }
.back-btn { display: none; }
@media (max-width: 800px) {
  .admin { grid-template-columns: 1fr; }
  .admin.has-active aside { display: none; }
  .admin:not(.has-active) main { display: none; }
  .back-btn { display: grid; }
}

/* Push notifications */
.push-card { display: flex; align-items: center; gap: .8rem; max-width: 30rem; margin-top: 1rem; padding: .8rem 1rem; border-radius: 16px; background: #fff; border: 1px solid var(--line); }
.push-card > span { font-size: 1.4rem; }
.push-card div { flex: 1; line-height: 1.3; }
.push-card small { display: block; color: var(--muted); font-size: .8rem; }
.push-strip { display: flex; align-items: center; justify-content: center; gap: .7rem; flex-wrap: wrap; padding: .5rem 1rem; background: #fffbeb; border-bottom: 1px solid #fde68a; font-size: .85rem; }
.notif-list { max-width: 720px; margin: 0 auto; padding: 0 1rem 3rem; display: grid; gap: .8rem; }
.notif { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 1rem 1.2rem; }
.notif h3 { margin: 0 0 .3rem; font-size: 1rem; }
.notif p { margin: 0; color: #44403c; line-height: 1.5; white-space: pre-wrap; }
.notif .meta { display: flex; justify-content: space-between; align-items: center; margin-top: .6rem; font-size: .78rem; color: var(--muted); }
.notif.new { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent); }

/* Voice call screen */
.call-ov { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 1rem; background: color-mix(in srgb, #0c1412 82%, transparent); backdrop-filter: blur(6px); }
.call-card { width: min(340px, 100%); text-align: center; color: #fff; padding: 2rem 1.4rem 1.6rem; border-radius: 28px; background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 70%, #0c1412), #0c1412); box-shadow: 0 30px 80px #0008; }
.call-av { width: 96px; height: 96px; border-radius: 50%; margin: 0 auto 1rem; display: grid; place-items: center; font-size: 2.4rem; font-weight: 800; background: #ffffff22; }
.call-ov.ringing .call-av { animation: callpulse 1.4s infinite; }
@keyframes callpulse { 0% { box-shadow: 0 0 0 0 #ffffff55; } 100% { box-shadow: 0 0 0 26px #ffffff00; } }
.call-card h3 { margin: 0 0 .3rem; font-size: 1.3rem; word-break: break-word; }
.call-card p { margin: 0 0 1.6rem; opacity: .8; font-variant-numeric: tabular-nums; min-height: 1.4em; }
.call-btns { display: flex; justify-content: center; gap: 1.4rem; }
.call-b { width: 62px; height: 62px; border-radius: 50%; border: 0; cursor: pointer; font-size: 1.5rem; color: #fff; display: grid; place-items: center; }
.call-b.end { background: #dc2626; }
.call-b.accept { background: #16a34a; animation: callpulse 1.4s infinite; }
.call-b.mute { background: #ffffff26; }
.call-b.mute.on { background: #fff; color: #111; }
.announce { background: var(--accent); color: #fff; text-align: center; padding: .55rem 1rem; font-size: .9rem; font-weight: 600; white-space: pre-wrap; }
.chat-app .announce { font-size: .82rem; padding: .45rem .8rem; }
.logo img, .phone-head img.av { object-fit: cover; }

/* ===== Media in chat (photos, video, documents, voice notes) — customer chat + admin ===== */
.msg.has-media { padding: .25rem .25rem .3rem; }
.msg.has-media .txt { display: block; padding: .3rem .5rem 0; }
.msg.has-media time, .msg.has-media .mt { padding-right: .4rem; }
.msg .by + .md-img, .msg .by + .vn, .msg .by + .md-doc, .msg .by + .md-vid { margin-top: .15rem; }
.msg.has-media .by { padding: .2rem .5rem 0; }
.md-img { display: block; border-radius: 12px; overflow: hidden; line-height: 0; cursor: zoom-in; }
.md-img img { display: block; width: 100%; max-width: 300px; max-height: 340px; min-width: 160px; min-height: 90px; object-fit: cover; background: #0000000d; }
.md-vid { display: block; width: 300px; max-width: 100%; max-height: 340px; border-radius: 12px; background: #000; }
.md-doc { display: flex; align-items: center; gap: .6rem; padding: .6rem .7rem; border-radius: 12px; background: #0000000c; text-decoration: none; min-width: 220px; max-width: 300px; white-space: normal; }
.msg.me .md-doc { background: #0000000f; }
.md-doc-ico { width: 38px; height: 44px; border-radius: 6px; background: #e5484d; color: #fff; font-size: .62rem; font-weight: 800; display: grid; place-items: center; flex: none; }
.md-doc-name { flex: 1; min-width: 0; line-height: 1.25; }
.md-doc-name b { display: block; font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.md-doc-name small { font-size: .72rem; opacity: .7; }
.md-doc-dl { width: 30px; height: 30px; border-radius: 50%; border: 1.5px solid currentColor; display: grid; place-items: center; opacity: .55; font-size: .8rem; flex: none; }
.vn { display: flex; align-items: center; gap: .55rem; width: 250px; max-width: 100%; padding: .35rem .5rem .1rem .3rem; white-space: normal; }
.vn-play { width: 40px; height: 40px; border-radius: 50%; border: 0; background: none; color: #54656f; display: grid; place-items: center; cursor: pointer; flex: none; padding: 0; }
.msg.me .vn-play { color: inherit; }
.vn-track { flex: 1; min-width: 0; display: grid; gap: .3rem; }
.vn-bar { height: 4px; border-radius: 4px; background: #00000022; position: relative; cursor: pointer; }
.vn-bar i { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: 4px; background: #00a884; }
.vn-bar::after { content: ""; position: absolute; top: 50%; left: 0; width: 11px; height: 11px; border-radius: 50%; background: #00a884; transform: translate(-3px, -50%); }
.vn.on .vn-bar::after { display: none; }
.vn-t { font-size: .7rem; opacity: .7; font-variant-numeric: tabular-nums; }
.vn-mic { width: 34px; height: 34px; border-radius: 50%; background: #00a884; color: #fff; display: grid; place-items: center; flex: none; }
.vn-mic svg { width: 17px; height: 17px; }
.msg.me .vn-mic { background: #0000001a; color: inherit; }

/* composer with attach / camera / mic */
.md-composer { align-items: center; position: relative; }
.md-pill { flex: 1; min-width: 0; display: flex; align-items: flex-end; background: #fff; border: 1.5px solid var(--line); border-radius: 24px; padding-right: .2rem; }
.md-pill:focus-within { border-color: var(--accent); }
.md-pill textarea { border: 0 !important; background: transparent !important; flex: 1; min-width: 0; box-shadow: none !important; }
.md-ic { width: 40px; height: 44px; border: 0; background: none; color: #54656f; display: grid; place-items: center; cursor: pointer; flex: none; border-radius: 50%; padding: 0; }
.md-ic:hover { color: var(--ink); }
.md-composer.recording > :not(.md-rec) { display: none !important; }
.md-rec { flex: 1; display: flex; align-items: center; gap: .6rem; }
.md-rec .md-ic { color: #e5484d; }
.md-rec-dot { width: 11px; height: 11px; border-radius: 50%; background: #e5484d; animation: recblink 1s infinite; }
@keyframes recblink { 50% { opacity: .2; } }
.md-rec-t { font-variant-numeric: tabular-nums; font-weight: 600; }
.md-rec-hint { flex: 1; color: var(--muted); font-size: .85rem; }

/* preview before sending, and full-screen photo */
.md-prev, .md-lightbox { position: fixed; inset: 0; z-index: 90; background: #0b141a; color: #e9edef; display: flex; flex-direction: column; }
.md-prev-top { display: flex; align-items: center; gap: .8rem; padding: .8rem 1rem; font-weight: 600; }
.md-prev-top span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.md-x, .md-lb-bar button { width: 40px; height: 40px; border: 0; border-radius: 50%; background: #ffffff1a; color: #fff; font-size: 1.1rem; cursor: pointer; flex: none; }
.md-prev-body { flex: 1; min-height: 0; display: grid; place-items: center; padding: 1rem; }
.md-prev-body img, .md-prev-body video { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; }
.md-prev-doc { display: grid; justify-items: center; gap: .5rem; font-size: 4rem; text-align: center; }
.md-prev-doc b { font-size: 1rem; word-break: break-all; }
.md-prev-doc small { font-size: .85rem; opacity: .7; }
.md-prev-foot { display: flex; gap: .6rem; padding: .8rem 1rem calc(.8rem + env(safe-area-inset-bottom)); background: #111b21; }
.md-cap { flex: 1; min-width: 0; border: 0; border-radius: 24px; padding: .8rem 1.1rem; background: #2a3942; color: #fff; outline: none; }
.md-send { width: 50px; height: 50px; border-radius: 50%; border: 0; background: #00a884; color: #fff; display: grid; place-items: center; cursor: pointer; flex: none; }
.md-lightbox { align-items: center; justify-content: center; background: #000e; }
.md-lightbox img { max-width: 96vw; max-height: 86dvh; object-fit: contain; }
.md-lb-bar { position: absolute; top: .8rem; right: .8rem; display: flex; gap: .5rem; align-items: center; }
.md-lb-bar a { color: #fff; text-decoration: none; font-weight: 600; padding: .55rem .9rem; border-radius: 999px; background: #ffffff1a; }

/* ===== WhatsApp-style customer chat ===== */
.wa-chat { --wa-out: #d9fdd3; --wa-bg: #efeae2; background: var(--wa-bg); border: 0; max-width: 900px; box-shadow: 0 0 0 1px #0000000d; }
.wa-chat .chat-head { background: var(--accent); color: #fff; border: 0; padding: .55rem .6rem; gap: .35rem; padding-top: max(.55rem, env(safe-area-inset-top)); }
.wa-chat .chat-head .av { width: 40px; height: 40px; background: #ffffff33; flex: none; margin-right: .3rem; }
.wa-chat .chat-head b { font-size: 1.02rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wa-chat .chat-head small { color: #ffffffd0; font-size: .76rem; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wa-chat .chat-head small.online::before { background: #6ee7b7; }
.wa-chat .icon-btn { color: #fff; width: 40px; height: 40px; flex: none; }
.wa-chat .icon-btn:hover { background: #ffffff22; color: #fff; }
.wa-chat .wa-push { background: #fff8e1; border-color: #f5e3a3; }
.wa-chat .messages {
  padding: .8rem clamp(.6rem, 5vw, 4rem); gap: 2px; background-color: var(--wa-bg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120' fill='none' stroke='%23000' stroke-opacity='.045' stroke-width='1.6' stroke-linecap='round'%3E%3Ccircle cx='18' cy='20' r='6'/%3E%3Cpath d='M70 14l8 8m0-8l-8 8M40 60h14M47 53v14M95 55c4-6 12-6 14 0s-6 10-14 0zM15 95l10-10 10 10M78 92a8 8 0 1 0 16 0 8 8 0 1 0-16 0M58 102l6-12 6 12z'/%3E%3C/svg%3E");
  background-size: 240px 240px;
}
.wa-chat .msg { font-size: .94rem; max-width: min(80%, 540px); padding: .38rem .55rem .3rem .6rem; border-radius: 9px; box-shadow: 0 1px .5px #0b141a22; margin-top: 2px; position: relative; animation: none; }
.wa-chat .msg.them { background: #fff; border-top-left-radius: 0; margin-left: 8px; }
.wa-chat .msg.me { background: var(--wa-out); color: #111b21; border-top-right-radius: 0; margin-right: 8px; }
.wa-chat .msg.them::before, .wa-chat .msg.me::before { content: ""; position: absolute; top: 0; width: 9px; height: 13px; }
.wa-chat .msg.them::before { left: -8px; background: #fff; clip-path: polygon(0 0, 100% 0, 100% 100%); }
.wa-chat .msg.me::before { right: -8px; background: var(--wa-out); clip-path: polygon(0 0, 100% 0, 0 100%); }
.wa-chat .msg.them + .msg.them, .wa-chat .msg.me + .msg.me { border-radius: 9px; }
.wa-chat .msg.them + .msg.them::before, .wa-chat .msg.me + .msg.me::before { display: none; }
.wa-chat .msg.them:not(.them + .them), .wa-chat .msg.me:not(.me + .me) { margin-top: 8px; }
.wa-chat .msg.system { background: #ffeecd; color: #54656f; font-size: .78rem; border-radius: 8px; margin: 6px 0; box-shadow: 0 1px .5px #0b141a14; text-align: center; max-width: 90%; }
.wa-chat .msg.system::before { display: none; }
.wa-chat .msg.system .mt { display: none; }
.wa-chat .msg .mt { float: right; display: inline-flex; align-items: center; gap: 3px; margin: .45rem 0 -.25rem .7rem; font-size: .68rem; color: #667781; line-height: 1; white-space: nowrap; }
.wa-chat .msg .mt time { display: inline; margin: 0; opacity: 1; text-align: right; }
.wa-chat .msg.has-media .mt { float: none; display: flex; justify-content: flex-end; margin: .3rem 0 0; }
.wa-chat .msg.has-media:not(:has(.txt)) .mt { margin-top: -.15rem; }
.wa-chat .tick { color: #8696a0; font-size: .74rem; letter-spacing: -3px; padding-right: 3px; }
.wa-chat .msg.read .tick { color: #53bdeb; }
.wa-chat .msg.pending { opacity: .75; }
.wa-chat .day-sep { background: #fff; color: #54656f; font-weight: 600; font-size: .74rem; text-transform: uppercase; box-shadow: 0 1px .5px #0b141a1a; border-radius: 8px; padding: .35rem .75rem; margin: .6rem 0 .3rem; }
.wa-chat .composer { background: #f0f2f5; border: 0; padding: .45rem .5rem; padding-bottom: max(.45rem, env(safe-area-inset-bottom)); gap: .4rem; }
.wa-chat .md-pill { border: 0; border-radius: 26px; box-shadow: 0 1px .5px #0b141a14; }
.wa-chat .composer textarea { padding: .72rem .4rem .72rem 1rem; font-size: .96rem; }
.wa-chat .send { width: 48px; height: 48px; background: #00a884; }
.wa-chat .announce { background: #fff8e1; color: #54656f; font-weight: 500; border-bottom: 1px solid #f0e2b6; }
.wa-chat .vn-bar i, .wa-chat .vn-bar::after { background: #00a884; }
.wa-chat .msg.me .vn-play { color: #54656f; }
.wa-chat .center-screen { background: var(--wa-bg); }
@media (max-width: 600px) { .wa-chat .chat-head .icon-btn { width: 36px; } .wa-chat .msg { max-width: 86%; } }

/* Emoji picker (chat composers) */
.md-emo-btn.on { color: var(--accent); }
.md-emo { position: absolute; left: .4rem; right: .4rem; bottom: calc(100% + .3rem); max-width: 380px; max-height: 280px; overflow-y: auto; background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 10px 30px #0b141a26; padding: .4rem .5rem .6rem; z-index: 40; }
.md-emo[hidden] { display: none; }
.md-emo-h { font-size: .72rem; font-weight: 700; color: var(--muted); padding: .45rem .2rem .2rem; text-transform: uppercase; letter-spacing: .03em; }
.md-emo-g { display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); }
.md-emo-g button { border: 0; background: none; font-size: 1.45rem; line-height: 1; height: 40px; border-radius: 8px; cursor: pointer; padding: 0; }
.md-emo-g button:hover { background: #0000000d; }
.vn.loading .vn-play { opacity: .5; animation: recblink 1s infinite; }
.vn-t a { color: inherit; font-weight: 700; }

/* Live "typing…" and online / last seen */
.tdots { display: inline-flex; gap: 4px; align-items: center; padding: .35rem .2rem; }
.tdots i { width: 7px; height: 7px; border-radius: 50%; background: #8696a0; animation: tdot 1.2s infinite ease-in-out; }
.tdots i:nth-child(2) { animation-delay: .15s; }
.tdots i:nth-child(3) { animation-delay: .3s; }
@keyframes tdot { 0%, 60%, 100% { transform: translateY(0); opacity: .45; } 30% { transform: translateY(-4px); opacity: 1; } }
.msg.typing-bubble { padding: .3rem .7rem !important; min-width: 0; width: auto; align-self: flex-start; }
.msg.typing-bubble[hidden] { display: none; }
.wa-chat .chat-head small.typing { font-style: italic; color: #fff; }
.wa-chat .chat-head small.typing::before { display: none; }

/* ===== Mobile phone polish (customer pages + shared) ===== */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { overflow-x: hidden; }
button, a, .btn, .icon-btn, .conv, summary { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
img, video { max-width: 100%; }
.topbar { padding-top: max(1rem, env(safe-area-inset-top)); gap: .8rem; }
.topbar .logo span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .logo { min-width: 0; }
.topbar nav { flex: none; }
@media (pointer: coarse) {
  /* bigger touch targets */
  .btn.small { min-height: 40px; }
  .icon-btn { min-width: 40px; min-height: 40px; }
}
@media (max-width: 600px) {
  /* 16px stops iPhone Safari from zooming in when a field is tapped */
  .input, textarea, select, .composer textarea, .wa-chat .composer textarea, .md-cap { font-size: 16px !important; }
  .topbar { padding-inline: 1rem; }
  .topbar nav { gap: .9rem !important; font-size: .92rem; }
  .logo { font-size: 1rem; }
  .logo img { width: 30px; height: 30px; }
  .hero { padding: .25rem 1rem 2.2rem; gap: 1.5rem; }
  .hero h1 { font-size: clamp(1.9rem, 8.6vw, 2.4rem); margin: .6rem 0 .7rem; }
  .hero p.lead { font-size: 1rem; margin-bottom: 1.2rem; }
  .start-card { padding: 1.1rem; border-radius: 18px; max-width: none; }
  .start-card .btn { padding: 1rem; font-size: 1rem; }
  .push-card { max-width: none; }
  .badges { gap: .45rem; }
  .badge { font-size: .78rem; padding: .4rem .7rem; }
  .wa-row .btn { flex: 1 1 calc(50% - .3rem); min-width: 0; padding: .8rem .9rem; }
  .wa-row .btn.wa { flex-basis: 100%; }
  .features { padding: 0 1rem 2.5rem; gap: .7rem; }
  .feature { padding: 1rem 1.1rem; display: grid; grid-template-columns: auto 1fr; column-gap: .8rem; }
  .feature .ico { grid-row: span 2; }
  .feature h3 { margin: 0 0 .2rem; }
  footer.site { padding-bottom: max(2rem, env(safe-area-inset-bottom)); }
  .install-banner { padding: .55rem .8rem; padding-top: max(.55rem, env(safe-area-inset-top)); }
  .announce { font-size: .84rem; padding: .5rem .8rem; }
  .push-strip { font-size: .82rem; padding: .45rem .7rem; gap: .5rem; }
  /* chat */
  .chat-app { border-inline: 0; }
  .center-screen { padding: 1rem; align-items: start; padding-top: 12vh; }
  .wa-chat .messages { padding: .6rem .55rem; }
  .wa-chat .chat-head .av { width: 36px; height: 36px; margin-right: .1rem; }
  .wa-chat .chat-head b { font-size: .98rem; }
  .md-ic { width: 36px; }
  .md-img img { max-width: min(300px, 68vw); min-width: 140px; }
  .md-vid { width: min(300px, 68vw); }
  .md-doc { min-width: 0; max-width: min(300px, 70vw); }
  .vn { width: min(250px, 66vw); }
  .md-emo { max-width: none; max-height: 45dvh; }
  .md-lb-bar { top: max(.8rem, env(safe-area-inset-top)); }
  .md-prev-top { padding-top: max(.8rem, env(safe-area-inset-top)); }
  /* notifications page */
  .notif-list { padding: 0 .9rem 2.5rem; }
  .notif-list h1 { font-size: 1.5rem; }
  .notif { padding: .9rem 1rem; }
  .notif .meta { flex-wrap: wrap; gap: .4rem; }
  /* dialogs slide up from the bottom like a phone sheet */
  .modal-bg { place-items: end stretch; padding: 0; }
  .modal { width: 100%; border-radius: 20px 20px 0 0; padding: 1.2rem 1rem calc(1rem + env(safe-area-inset-bottom)); max-height: 92dvh; animation: sheet .2s ease-out; }
  .modal h2 { font-size: 1.2rem; }
  .modal .actions { position: sticky; bottom: 0; background: var(--card); padding: .6rem 0 .2rem; }
  .modal .actions .btn { flex: 1; padding: .85rem; }
  .login-card { padding: 1.5rem 1.2rem; }
  .call-btns { gap: 1.1rem; }
}
@media (max-width: 360px) {
  .topbar nav { gap: .7rem !important; font-size: .86rem; }
  .wa-chat .chat-head .icon-btn { width: 32px; min-width: 32px; }
}
@keyframes sheet { from { transform: translateY(40px); opacity: .6; } to { transform: none; opacity: 1; } }

/* Star rating card shown to the customer after a chat is resolved */
.rate-card { align-self: center; width: min(340px, 94%); background: #fff; border-radius: 14px; padding: 1rem 1rem .9rem; margin: .6rem 0; text-align: center; box-shadow: 0 2px 10px #0b141a1f; display: grid; gap: .35rem; animation: pop .25s; }
.rate-card[hidden] { display: none; }
.rate-q { font-size: .98rem; }
.rate-stars { display: flex; justify-content: center; gap: .15rem; }
.rate-stars button { border: 0; background: none; font-size: 2.1rem; line-height: 1; color: #d1d5db; cursor: pointer; padding: .1rem .2rem; transition: transform .1s, color .1s; }
.rate-stars button.on { color: #f5b301; }
.rate-stars button:active { transform: scale(1.2); }
.rate-lbl { color: var(--muted); font-size: .8rem; min-height: 1.1em; }
.rate-more { display: grid; gap: .5rem; margin-top: .2rem; }
.rate-more textarea { width: 100%; border: 1.5px solid var(--line); border-radius: 10px; padding: .55rem .7rem; resize: none; outline: none; }
.rate-more textarea:focus { border-color: var(--accent); }
.rate-acts { display: flex; gap: .5rem; }
.rate-acts .btn { flex: 1; }
/* tags (shared by admin) */
.ctag { --tc: #6b7280; display: inline-flex; align-items: center; gap: .25rem; font-size: .7rem; font-weight: 700; padding: .12rem .5rem; border-radius: 999px; background: color-mix(in srgb, var(--tc) 14%, #fff); color: color-mix(in srgb, var(--tc) 85%, #000); white-space: nowrap; border: 1px solid color-mix(in srgb, var(--tc) 28%, #fff); }
.ctag[data-c="green"] { --tc: #16a34a; } .ctag[data-c="blue"] { --tc: #2563eb; } .ctag[data-c="amber"] { --tc: #d97706; } .ctag[data-c="red"] { --tc: #dc2626; }
.ctag[data-c="purple"] { --tc: #7c3aed; } .ctag[data-c="pink"] { --tc: #db2777; } .ctag[data-c="teal"] { --tc: #0d9488; } .ctag[data-c="gray"] { --tc: #6b7280; }
.notif-img { display: block; width: calc(100% + 2.4rem); max-height: 260px; object-fit: cover; margin: -1rem -1.2rem .8rem; border-radius: 16px 16px 0 0; }
@media (max-width: 600px) { .notif-img { width: calc(100% + 2rem); margin: -.9rem -1rem .7rem; } }

/* Install as app */
.badge-btn { cursor: pointer; font: inherit; font-size: .82rem; font-weight: 700; color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.badge-btn:hover { background: color-mix(in srgb, var(--accent) 8%, #fff); }
.feature .install-btn { margin-top: .8rem; }
.install-foot { display: flex; flex-direction: column; align-items: center; gap: .45rem; padding: .5rem 1rem 1.6rem; text-align: center; }
.install-foot small { color: var(--muted); font-size: .8rem; }
.install-help { position: fixed; inset: 0; z-index: 9999; background: #0009; display: grid; place-items: end center; padding: 1rem; }
.install-help .ih-card { background: #fff; color: #111; width: min(420px, 100%); border-radius: 18px; padding: 1.4rem 1.3rem 1.1rem; box-shadow: 0 20px 50px #0005; text-align: left; }
.install-help img { width: 56px; height: 56px; border-radius: 14px; display: block; margin-bottom: .6rem; }
.install-help h3 { margin: 0 0 .3rem; }
.install-help p { margin: 0 0 .6rem; color: #555; font-size: .9rem; }
.install-help ol { margin: 0 0 1rem; padding-left: 1.2rem; display: grid; gap: .45rem; font-size: .95rem; }
.install-help .btn { width: 100%; }
@media (min-width: 700px) { .install-help { place-items: center; } }

/* FAQ quick questions in the customer chat */
.faq-bar { background: #f0f2f5; padding: .45rem .5rem 0; display: flex; flex-direction: column; gap: .35rem; }
.faq-bar .faq-intro { display: flex; align-items: center; justify-content: space-between; font-size: .78rem; font-weight: 700; color: #54656f; padding: 0 .3rem; }
.faq-bar .faq-intro button { background: none; border: 0; color: inherit; font: inherit; cursor: pointer; padding: .1rem .3rem; }
.faq-chips { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: .15rem; scrollbar-width: none; }
.faq-chips::-webkit-scrollbar { display: none; }
.faq-chip { flex: none; border: 1px solid color-mix(in srgb, var(--accent) 45%, #d1d7db); color: var(--accent); background: #fff; border-radius: 999px; padding: .42rem .8rem; font: inherit; font-size: .84rem; font-weight: 600; cursor: pointer; white-space: nowrap; }
.faq-chip.agent { color: #111b21; border-color: #d1d7db; }
.faq-chip:disabled { opacity: .5; }
.faq-toggle { align-self: flex-start; border: 0; background: #fff; border-radius: 999px; padding: .3rem .7rem; font: inherit; font-size: .78rem; font-weight: 700; color: var(--accent); cursor: pointer; box-shadow: 0 1px 1px #0000001a; }

/* ---------- language picker, translated mark, offline queue ---------- */
.lang-btn { font-size: 1.15rem; }
.lang-sheet { position: fixed; inset: 0; background: #0007; z-index: 80; display: flex; align-items: flex-end; justify-content: center; }
.lang-sheet[hidden] { display: none; }
.ls-card { background: #fff; width: min(520px, 100%); max-height: 80vh; border-radius: 18px 18px 0 0; display: flex; flex-direction: column; padding-bottom: env(safe-area-inset-bottom); }
@media (min-width: 640px) { .lang-sheet { align-items: center; } .ls-card { border-radius: 18px; } }
.ls-head { display: flex; align-items: center; justify-content: space-between; padding: .8rem 1rem; border-bottom: 1px solid var(--line); }
.ls-head .icon-btn { color: var(--muted); }
.ls-list { overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .4rem; padding: .8rem; }
.ls-list button { border: 1.5px solid var(--line); background: #fff; border-radius: 12px; padding: .55rem .6rem; text-align: left; cursor: pointer; display: grid; gap: .1rem; }
.ls-list button b { font-size: .98rem; }
.ls-list button small { color: var(--muted); font-size: .72rem; }
.ls-list button.on { border-color: var(--accent); background: #f0fdfa; }
.tr-mark { font-size: .7rem; margin-right: .25rem; opacity: .7; }
.offline-bar { text-align: center; font-size: .8rem; padding: .4rem .8rem; }
.offline-bar.off { background: #fef3c7; color: #92400e; }
.offline-bar.back { background: #dcfce7; color: #166534; }
.msg.queued { opacity: .8; }
.msg.failed { background: #fee2e2 !important; color: #991b1b !important; }
