/* ============================================================
   Customer chat — WhatsApp-accurate UI, mobile first, 20 themes
   (theme colors arrive as CSS variables on <html>)
   ============================================================ */
:root {
  --accent: #00a884; --accent-deep: #008069; --accent-soft: #005c4b; --green: #25d366;
  --bg-chat: #0b141a; --bg-panel: #111b21; --bg-bar: #1f2c33; --bg-elevated: #233138; --bg-sunken: #182229;
  --bubble-in: #202c33; --bubble-out: #005c4b; --bubble-in-text: #e9edef; --bubble-out-text: #e9edef;
  --header-bg: #1f2c33; --header-text: #e9edef; --header-icon: #aebac1; --header-sub: #8696a0;
  --text: #e9edef; --text-dim: #8696a0; --text-faint: #667781; --line: #222d34; --tick-read: #53bdeb;
  --pattern-color: #4c5961; --pattern-opacity: 0.06;
  --shadow: 0 1px 0.5px rgba(0,0,0,.35); --shadow-md: 0 2px 12px rgba(0,0,0,.35); --shadow-lg: 0 12px 44px rgba(0,0,0,.5);
  --header-h: 60px; --radius: 8px; --font-size: 15px; --app-h: 100dvh;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
}
html[data-mode="light"] { color-scheme: light; --shadow: 0 1px 0.5px rgba(11,20,26,.13); --shadow-md: 0 2px 10px rgba(11,20,26,.14); --shadow-lg: 0 12px 44px rgba(11,20,26,.24); }
html[data-mode="dark"] { color-scheme: dark; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; width: 100%; overscroll-behavior: none; overflow: hidden; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Roboto, "Noto Sans", "Noto Color Emoji", sans-serif; font-size: var(--font-size); line-height: 1.4; color: var(--text); background: var(--bg-chat); -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; border: none; background: none; cursor: pointer; padding: 0; }
input, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

.app { display: flex; height: var(--app-h); overflow: hidden; justify-content: center; background: var(--bg-sunken); }
.conversation { flex: 1; display: flex; flex-direction: column; min-width: 0; position: relative; background: var(--bg-chat); width: 100%; max-width: 100%; }
@media (min-width: 900px) {
  .app { padding: 18px; background: linear-gradient(180deg, var(--header-bg) 0 128px, var(--bg-sunken) 128px); }
  .conversation { max-width: 1120px; border-radius: 6px; overflow: hidden; box-shadow: var(--shadow-lg); }
}

/* ---------------- header ---------------- */
.conv-header { position: relative; z-index: 30; display: flex; align-items: center; gap: 10px; padding: calc(8px + var(--safe-t)) 8px 8px 12px; min-height: calc(var(--header-h) + var(--safe-t)); background: var(--header-bg); color: var(--header-text); box-shadow: var(--shadow); }
.avatar { position: relative; width: 40px; height: 40px; border-radius: 50%; background: var(--accent-soft); color: var(--text); display: flex; align-items: center; justify-content: center; font-weight: 600; overflow: hidden; flex: none; }
.avatar img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.avatar span { font-size: 17px; opacity: .9; }
.avatar:has(img) span { visibility: hidden; }
.conv-heading { flex: 1; min-width: 0; cursor: default; }
.conv-title { font-size: 16.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 4px; }
.verified { width: 17px; height: 17px; flex: none; }
.conv-status { font-size: 12.5px; color: var(--header-sub); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.conv-status.online { color: var(--header-sub); }
.conv-status.typing { color: #25d366; }
.hdr-btn { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--header-icon); flex: none; transition: background .15s; }
.hdr-btn svg { width: 24px; height: 24px; }
.hdr-btn:active { background: rgba(255,255,255,.12); }
.whatsapp-header-btn svg { width: 27px; height: 27px; }
.back-btn { margin-left: -6px; margin-right: -8px; }

.menu { position: absolute; right: 10px; top: calc(100% - 6px); min-width: 230px; background: var(--bg-elevated); border-radius: 6px; box-shadow: var(--shadow-lg); padding: 8px 0; transform-origin: top right; transform: scale(.85); opacity: 0; pointer-events: none; transition: transform .14s, opacity .14s; z-index: 60; color: var(--text); }
.menu.open { transform: scale(1); opacity: 1; pointer-events: auto; }
.menu-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 20px; text-align: left; font-size: 14.5px; color: var(--text); white-space: nowrap; }
.menu-item .mi-emoji { width: 22px; text-align: center; font-size: 16px; }
.menu-item:active { background: rgba(127,127,127,.15); }
.menu-item.danger { color: #ff6b6b; }

.conn-bar { background: #ffcc00; color: #1f1f1f; font-size: 13px; text-align: center; padding: 6px; font-weight: 500; }
.message-search { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--bg-bar); border-bottom: 1px solid var(--line); }
.message-search svg { width: 20px; height: 20px; color: var(--text-dim); flex: none; }
.message-search input { flex: 1; background: var(--bg-sunken); border: none; border-radius: 8px; padding: 8px 12px; outline: none; }
.message-search button { font-size: 22px; color: var(--text-dim); width: 32px; }

.name-strip { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--bg-bar); border-bottom: 1px solid var(--line); font-size: 14px; }
.name-strip-label { color: var(--text-dim); white-space: nowrap; }
.name-strip input { flex: 1; min-width: 0; background: var(--bg-sunken); border: 1px solid transparent; border-radius: 8px; padding: 7px 10px; outline: none; }
.name-strip input:focus { border-color: var(--accent); }
.name-strip button { background: var(--accent); color: #fff; border-radius: 8px; padding: 7px 14px; font-weight: 600; }

/* ---------------- messages area ---------------- */
.conv-body { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 8px 4% 10px; position: relative; -webkit-overflow-scrolling: touch; scroll-behavior: smooth; display: flex; flex-direction: column; }
.conv-body::before { content: ""; position: fixed; inset: 0; pointer-events: none; background-color: var(--pattern-color); -webkit-mask: url("/chat/whatsapp-bg.svg") repeat; mask: url("/chat/whatsapp-bg.svg") repeat; -webkit-mask-size: 260px; mask-size: 260px; opacity: var(--pattern-opacity); z-index: 0; }
html[data-wallpaper="none"] .conv-body::before { display: none; }
html[data-wallpaper="custom"] .conv-body::before { -webkit-mask: none; mask: none; background: var(--wallpaper-url) center/cover no-repeat; opacity: 1; }
@media (min-width: 900px) { .conv-body::before { position: absolute; } }
.conv-body > * { position: relative; z-index: 1; }
.conv-body::-webkit-scrollbar { width: 6px; }
.conv-body::-webkit-scrollbar-thumb { background: rgba(127,127,127,.35); border-radius: 3px; }

.day-divider, .enc-notice { align-self: center; background: var(--bg-elevated); color: var(--text-dim); font-size: 12.5px; padding: 5px 12px; border-radius: 8px; margin: 8px 0 10px; box-shadow: var(--shadow); text-transform: uppercase; letter-spacing: .2px; }
.enc-notice { text-transform: none; background: #fff5c4; color: #54471d; text-align: center; max-width: 88%; line-height: 1.35; font-size: 12.5px; }
html[data-mode="dark"] .enc-notice { background: #1d2a30; color: #d1a83a; }

.msg { position: relative; max-width: 78%; padding: 6px 8px 7px 9px; border-radius: var(--radius); box-shadow: var(--shadow); margin: 2px 0; font-size: var(--font-size); line-height: 1.38; word-wrap: break-word; overflow-wrap: anywhere; animation: pop .14s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.98); } to { opacity: 1; transform: none; } }
.msg.agent { align-self: flex-start; background: var(--bubble-in); color: var(--bubble-in-text); }
.msg.visitor { align-self: flex-end; background: var(--bubble-out); color: var(--bubble-out-text); }
.msg.agent.tail { border-top-left-radius: 0; margin-top: 8px; }
.msg.visitor.tail { border-top-right-radius: 0; margin-top: 8px; }
.msg.tail::before { content: ""; position: absolute; top: 0; width: 8px; height: 13px; }
.msg.agent.tail::before { left: -8px; background: var(--bubble-in); clip-path: polygon(100% 0, 0 0, 100% 100%); }
.msg.visitor.tail::before { right: -8px; background: var(--bubble-out); clip-path: polygon(0 0, 100% 0, 0 100%); }
.msg.pending { opacity: .75; }
.msg-text { white-space: pre-wrap; padding-right: 4px; }
.msg-text a { color: #53bdeb; text-decoration: underline; }
html[data-mode="light"] .msg-text a { color: #027eb5; }
.msg.visitor .msg-text::after, .msg.agent .msg-text::after { content: ""; display: inline-block; width: 62px; height: 1px; }
.msg.visitor .msg-text::after { width: 78px; }
.msg-meta { position: absolute; right: 8px; bottom: 4px; display: flex; align-items: center; gap: 3px; font-size: 11px; color: var(--text-dim); line-height: 1; }
.msg.visitor .msg-meta { color: rgba(255,255,255,.65); }
html[data-mode="light"] .msg.visitor .msg-meta { color: rgba(17,27,33,.55); }
.msg-meta .ticks { width: 16px; height: 11px; }
.msg-meta .ticks.read { color: var(--tick-read); }
.msg.no-text .msg-meta { position: static; justify-content: flex-end; margin-top: 3px; }
.msg-agent-name { font-size: 12px; font-weight: 600; color: var(--accent); margin-bottom: 2px; }
.msg.emoji-only { background: none !important; box-shadow: none; padding: 2px 4px 14px; }
.msg.emoji-only::before { display: none; }
.msg.emoji-only .msg-text { font-size: 44px; line-height: 1.15; }
.msg.emoji-only .msg-meta { color: var(--text-dim) !important; }
.msg.system { align-self: center; background: var(--bg-elevated); color: var(--text-dim); font-size: 12.5px; padding: 5px 12px; max-width: 90%; text-align: center; margin: 6px 0; }
.msg.search-match { outline: 2px solid #ffcc00; }
.msg-attachment { display: block; border-radius: 6px; overflow: hidden; margin: -2px -4px 4px -5px; max-width: 320px; }
.msg-attachment img { display: block; width: 100%; max-height: 360px; object-fit: cover; cursor: zoom-in; background: rgba(0,0,0,.1); }
.msg-attachment video { display: block; width: 100%; max-height: 320px; background: #000; }
.msg-attachment audio { width: 250px; max-width: 100%; display: block; }
.msg-voice { display: flex; align-items: center; gap: 8px; min-width: 220px; padding: 4px 0 4px; }
.msg-voice button { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--text-dim); flex: none; }
.msg-voice button svg { width: 24px; height: 24px; }
.msg-voice .bars { flex: 1; height: 26px; display: flex; align-items: center; gap: 2px; }
.msg-voice .bars i { flex: 1; background: currentColor; opacity: .35; border-radius: 2px; min-width: 2px; }
.msg-voice .bars i.on { opacity: .95; color: var(--tick-read); }
.msg-voice .dur { font-size: 11.5px; color: var(--text-dim); min-width: 32px; }
.msg-voice .mic { width: 34px; height: 34px; border-radius: 50%; overflow: hidden; flex: none; background: var(--accent-soft); }
.msg-voice .mic img { width: 100%; height: 100%; object-fit: cover; }
.msg-file { display: flex; align-items: center; gap: 10px; padding: 10px 10px; background: rgba(0,0,0,.12); border-radius: 6px; margin: -2px -4px 4px -5px; color: inherit; text-decoration: none; min-width: 210px; }
html[data-mode="light"] .msg-file { background: rgba(11,20,26,.06); }
.msg-file-icon svg { width: 30px; height: 30px; color: #7c8b95; }
.msg-file-name { font-size: 14px; font-weight: 500; word-break: break-all; }
.msg-file-size { font-size: 12px; color: var(--text-dim); }
.msg.has-cta { padding-bottom: 6px; }
.msg.has-cta .msg-meta { position: static; justify-content: flex-end; margin: 2px 0 6px; }
.msg-cta { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 4px -8px -7px -9px; padding: 11px; border-top: 1px solid rgba(127,127,127,.25); color: #53bdeb; font-weight: 500; text-decoration: none; font-size: 14.5px; }
html[data-mode="light"] .msg-cta { color: #027eb5; }
.msg-cta svg { width: 18px; height: 18px; }
.typing-bubble { align-self: flex-start; background: var(--bubble-in); border-radius: var(--radius); border-top-left-radius: 0; padding: 12px 14px; margin: 8px 0 2px; display: flex; gap: 4px; box-shadow: var(--shadow); }
.typing-bubble i { width: 7px; height: 7px; border-radius: 50%; background: var(--text-dim); animation: bounce 1.2s infinite; }
.typing-bubble i:nth-child(2) { animation-delay: .15s; } .typing-bubble i:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-5px); opacity: 1; } }

.empty-state { margin: auto; text-align: center; padding: 30px 18px; color: var(--text-dim); max-width: 340px; }
.empty-badge { width: 74px; height: 74px; border-radius: 50%; background: var(--bg-elevated); display: flex; align-items: center; justify-content: center; margin: 0 auto 14px; box-shadow: var(--shadow-md); }
.empty-badge svg { width: 36px; height: 36px; color: var(--accent); }
.empty-title { font-size: 18px; font-weight: 600; color: var(--text); margin: 0 0 6px; }
.empty-sub { margin: 0; font-size: 14px; line-height: 1.5; }

.scroll-down { position: absolute; right: 14px; bottom: 132px; width: 42px; height: 42px; border-radius: 50%; background: var(--bg-elevated); box-shadow: var(--shadow-md); display: flex; align-items: center; justify-content: center; color: var(--text-dim); z-index: 5; }
.scroll-down svg { width: 22px; height: 22px; }
.sd-badge { position: absolute; top: -6px; right: -4px; background: var(--green); color: #fff; font-size: 11px; font-weight: 700; min-width: 20px; height: 20px; border-radius: 10px; display: flex; align-items: center; justify-content: center; padding: 0 5px; }
.upload-progress { position: absolute; left: 50%; transform: translateX(-50%); bottom: 130px; background: var(--bg-elevated); padding: 8px 14px; border-radius: 20px; font-size: 13px; box-shadow: var(--shadow-md); z-index: 5; }

/* ---------------- quick actions ---------------- */
.quick-actions { display: flex; gap: 8px; padding: 8px 10px 4px; overflow-x: auto; scrollbar-width: none; background: transparent; flex: none; }
.quick-actions::-webkit-scrollbar { display: none; }
.quick-actions.qa-hidden { display: none; }
.qa-chip { flex: none; display: flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 20px; background: var(--bg-elevated); color: var(--text); font-size: 13.5px; font-weight: 500; box-shadow: var(--shadow); border: 1px solid var(--line); white-space: nowrap; }
.qa-chip:active { transform: scale(.96); }
.qa-chip.qa-primary { background: linear-gradient(135deg, var(--accent), var(--accent-deep)); color: #fff; border-color: transparent; }
.qa-emoji { font-size: 15px; }

/* ---------------- composer ---------------- */
.composer { flex: none; padding: 6px 8px calc(8px + var(--safe-b)); background: transparent; position: relative; z-index: 3; }
.composer-row { display: flex; align-items: flex-end; gap: 6px; }
.composer-pill { flex: 1; display: flex; align-items: flex-end; background: var(--bg-bar); border-radius: 24px; padding: 4px 6px 4px 4px; min-height: 46px; box-shadow: var(--shadow); }
html[data-mode="light"] .composer-pill { background: #fff; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--text-dim); flex: none; }
.icon-btn svg { width: 25px; height: 25px; }
.icon-btn.active { color: var(--accent); }
.camera-btn { margin-left: -6px; }
#msgInput { flex: 1; min-width: 0; resize: none; border: none; outline: none; background: transparent; padding: 10px 4px; max-height: 132px; line-height: 1.35; font-size: 16px; color: var(--text); }
#msgInput::placeholder { color: var(--text-faint); }
.round-btn { width: 46px; height: 46px; border-radius: 50%; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; flex: none; box-shadow: var(--shadow-md); transition: transform .12s; }
.round-btn svg { width: 24px; height: 24px; }
.round-btn:active { transform: scale(.92); }
#sendBtn svg { margin-left: 2px; }
.recording { display: flex; align-items: center; gap: 10px; background: var(--bg-bar); border-radius: 24px; padding: 4px 4px 4px 8px; min-height: 46px; }
.rec-cancel { width: 40px; height: 40px; color: var(--text-dim); display: flex; align-items: center; justify-content: center; }
.rec-cancel svg { width: 22px; height: 22px; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: #ff3b30; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .2; } }
.rec-time { font-variant-numeric: tabular-nums; font-weight: 600; }
.rec-hint { flex: 1; color: var(--text-dim); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.emoji-tray { background: var(--bg-bar); border-radius: 12px; margin-bottom: 6px; box-shadow: var(--shadow-md); overflow: hidden; }
.emoji-tabs { display: flex; overflow-x: auto; border-bottom: 1px solid var(--line); scrollbar-width: none; }
.emoji-tabs::-webkit-scrollbar { display: none; }
.emoji-tab { flex: none; padding: 8px 12px; font-size: 18px; opacity: .55; border-bottom: 2px solid transparent; }
.emoji-tab.active { opacity: 1; border-bottom-color: var(--accent); }
.emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); max-height: 210px; overflow-y: auto; padding: 6px; }
.emoji-grid button { font-size: 24px; height: 40px; border-radius: 6px; }
.emoji-grid button:active { background: rgba(127,127,127,.2); }

/* ---------------- sheets & panels ---------------- */
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 70; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; background: var(--bg-elevated); border-radius: 18px 18px 0 0; padding: 8px 16px calc(20px + var(--safe-b)); transform: translateY(110%); transition: transform .22s cubic-bezier(.2,.8,.2,1); z-index: 80; box-shadow: var(--shadow-lg); max-width: 520px; margin: 0 auto; }
.sheet.open { transform: none; }
.sheet-grab { width: 40px; height: 4px; border-radius: 2px; background: rgba(127,127,127,.4); margin: 4px auto 16px; }
.sheet-title { margin: 0 0 12px; font-weight: 600; font-size: 16px; }
.sheet-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.sheet-tile { display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-dim); }
.tile-icon { width: 54px; height: 54px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; }
.tile-icon svg { width: 26px; height: 26px; }
.ti-media { background: #bf59cf; } .ti-camera { background: #d3396d; } .ti-doc { background: #5157ae; } .ti-audio { background: #ec6d2b; }
.install-help { font-size: 14px; color: var(--text-dim); line-height: 1.5; }
.install-help ol { padding-left: 20px; margin: 6px 0; }
.install-done { width: 100%; margin-top: 12px; background: var(--accent); color: #fff; padding: 12px; border-radius: 10px; font-weight: 600; }

.panel { position: fixed; inset: 0; background: var(--bg-panel); z-index: 90; transform: translateX(100%); transition: transform .22s; display: flex; flex-direction: column; max-width: 520px; margin-left: auto; box-shadow: var(--shadow-lg); }
.panel.open { transform: none; }
.panel-header { display: flex; align-items: center; gap: 8px; padding: calc(8px + var(--safe-t)) 8px 8px; background: var(--header-bg); color: var(--header-text); min-height: calc(var(--header-h) + var(--safe-t)); }
.panel-title { flex: 1; font-size: 17px; font-weight: 600; }
.panel-link { color: var(--header-sub); font-size: 13.5px; padding: 6px 10px; }
.push-row { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.push-row-text { flex: 1; }
.push-row-title { font-weight: 500; }
.push-row-sub { font-size: 13px; color: var(--text-dim); margin-top: 2px; }
.switch { width: 46px; height: 26px; border-radius: 13px; background: rgba(127,127,127,.4); position: relative; flex: none; transition: background .2s; }
.switch[aria-checked="true"] { background: var(--accent); }
.switch .knob { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch[aria-checked="true"] .knob { transform: translateX(20px); }
.notif-list { flex: 1; overflow-y: auto; }
.notif-item { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.notif-item.unread { background: rgba(0,168,132,.07); }
.notif-av { width: 42px; height: 42px; border-radius: 50%; overflow: hidden; flex: none; background: var(--accent-soft); }
.notif-av img { width: 100%; height: 100%; object-fit: cover; }
.notif-body { flex: 1; min-width: 0; }
.notif-top { display: flex; justify-content: space-between; gap: 8px; }
.notif-title { font-weight: 600; font-size: 14.5px; }
.notif-time { font-size: 12px; color: var(--text-dim); }
.notif-text { font-size: 13.5px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notif-empty { text-align: center; color: var(--text-dim); padding: 50px 20px; font-size: 14px; }
.notif-empty svg { width: 44px; height: 44px; margin-bottom: 10px; opacity: .6; }

.notif-prompt { position: fixed; left: 12px; right: 12px; bottom: calc(90px + var(--safe-b)); background: var(--bg-elevated); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 14px; z-index: 65; max-width: 420px; margin: 0 auto; animation: rise .25s ease-out; }
@keyframes rise { from { transform: translateY(20px); opacity: 0; } }
.np-body { display: flex; gap: 12px; align-items: flex-start; }
.np-icon { width: 40px; height: 40px; border-radius: 50%; background: var(--accent-soft); display: flex; align-items: center; justify-content: center; flex: none; color: var(--accent); }
.np-icon svg { width: 22px; height: 22px; }
.np-text { flex: 1; }
.np-title { font-weight: 600; }
.np-sub { font-size: 13px; color: var(--text-dim); margin-top: 2px; }
.np-close { font-size: 22px; color: var(--text-dim); width: 28px; height: 28px; margin: -4px -4px 0 0; }
.np-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.np-later, .np-allow { padding: 9px 16px; border-radius: 20px; font-weight: 600; font-size: 14px; }
.np-later { color: var(--text-dim); }
.np-allow { background: var(--accent); color: #fff; }

/* ---------------- call overlay ---------------- */
.call-overlay { position: fixed; inset: 0; z-index: 100; background: radial-gradient(circle at 50% 20%, #223b45, #0b141a 70%); display: flex; align-items: stretch; justify-content: center; color: #e9edef; }
.call-card { flex: 1; max-width: 480px; display: flex; flex-direction: column; padding: calc(16px + var(--safe-t)) 20px calc(28px + var(--safe-b)); }
.call-top { display: flex; align-items: center; justify-content: space-between; }
.call-top-btn { width: 36px; height: 36px; font-size: 26px; color: #aebac1; display: flex; align-items: center; justify-content: center; }
.call-secure { font-size: 12.5px; color: #aebac1; }
.call-center { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; }
.call-avatar { width: 120px; height: 120px; border-radius: 50%; overflow: hidden; background: var(--accent-soft); box-shadow: 0 0 0 0 rgba(37,211,102,.5); }
.call-avatar img { width: 100%; height: 100%; object-fit: cover; }
.call-overlay.ringing .call-avatar { animation: ring 1.6s infinite; }
@keyframes ring { 0% { box-shadow: 0 0 0 0 rgba(37,211,102,.55); } 100% { box-shadow: 0 0 0 26px rgba(37,211,102,0); } }
.call-title { font-size: 24px; font-weight: 600; margin-top: 10px; }
.call-state { color: #aebac1; font-size: 15px; }
.call-number { color: #8696a0; font-size: 14px; font-variant-numeric: tabular-nums; }
.call-actions { display: flex; justify-content: center; gap: 26px; }
.call-action-circle { width: 62px; height: 62px; border-radius: 50%; background: rgba(255,255,255,.14); display: flex; align-items: center; justify-content: center; color: #fff; }
.call-action-circle svg { width: 28px; height: 28px; }
.call-action-circle.end { background: #f2404b; }
.call-action-circle.accept { background: #25d366; animation: ring 1.4s infinite; }
.call-action-circle.off { background: #fff; color: #0b141a; }
.call-foot { text-align: center; color: #8696a0; font-size: 12.5px; margin-top: 18px; }

.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.94); z-index: 110; display: flex; align-items: center; justify-content: center; }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; }
.lightbox-close { position: absolute; top: calc(10px + var(--safe-t)); right: 12px; color: #fff; font-size: 34px; width: 44px; height: 44px; }
.toast { position: fixed; left: 50%; bottom: calc(100px + var(--safe-b)); transform: translateX(-50%); background: #1f2c33; color: #e9edef; padding: 10px 18px; border-radius: 20px; font-size: 14px; z-index: 120; box-shadow: var(--shadow-lg); max-width: 88%; text-align: center; animation: rise .2s; }

/* ---------- stickers ---------- */
.msg.sticker-msg { background: none !important; box-shadow: none !important; padding: 0 !important; max-width: 60%; }
.msg.sticker-msg::before { display: none !important; }
.msg-sticker img { width: 150px; height: 150px; max-width: 42vw; max-height: 42vw; object-fit: contain; display: block; cursor: zoom-in; filter: drop-shadow(0 2px 6px rgba(0,0,0,.18)); animation: stickpop .28s cubic-bezier(.2,1.4,.4,1); }
@keyframes stickpop { from { transform: scale(.6); opacity: 0; } }
.msg.sticker-msg .msg-meta { position: static; justify-content: flex-end; margin-top: 2px; color: var(--text-dim) !important; }
.tray-modes { display: flex; gap: 6px; padding: 6px 8px; border-top: 1px solid var(--line); background: var(--bg-sunken); }
.tray-modes button { flex: 1; padding: 7px 10px; border-radius: 999px; font-size: 13px; font-weight: 500; color: var(--text-dim); }
.tray-modes button.on { background: var(--accent); color: #fff; }
.emoji-grid.sticker-grid { grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); max-height: 250px; padding: 8px; gap: 4px; }
.sticker-cell { height: 80px; border-radius: 12px; display: flex; align-items: center; justify-content: center; padding: 6px; }
.sticker-cell:active { background: rgba(127,127,127,.2); transform: scale(.94); }
.sticker-cell img { width: 100%; height: 100%; object-fit: contain; }
.emoji-tab.sticker-tab { padding: 6px 10px; display: flex; align-items: center; justify-content: center; }
.emoji-tab.sticker-tab img { width: 26px; height: 26px; object-fit: contain; }
