/* =====================================================================
   WhatsApp shared inbox — modelled on WhatsApp Web (light theme)
   ===================================================================== */

#whatsapp-chat {
    --wa-green: #00a884;
    --wa-green-dark: #008069;
    --wa-badge: #25d366;
    --wa-ink: #111b21;
    --wa-ink-2: #667781;
    --wa-icon: #54656f;
    --wa-line: #e9edef;
    --wa-panel: #f0f2f5;
    --wa-hover: #f5f6f6;
    --wa-active: #f0f2f5;
    --wa-out: #d9fdd3;
    --wa-in: #ffffff;
    --wa-chat-bg: #efeae2;
    --wa-blue-tick: #53bdeb;
    --wa-danger: #ea0038;
    --wa-shadow: 0 1px 0.5px rgba(11, 20, 26, 0.13);
    --wa-menu-shadow: 0 2px 5px 0 rgba(11, 20, 26, 0.26), 0 2px 10px 0 rgba(11, 20, 26, 0.16);
}

.wa-app {
    position: relative;
    height: calc(100dvh - var(--topbar-h) - 52px);
    min-height: 560px;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--wa-line);
    box-shadow: 0 6px 18px rgba(11, 20, 26, 0.06);
    font-family: "Segoe UI", "Helvetica Neue", Helvetica, "Lucida Grande", Arial, Ubuntu, Cantarell, "Fira Sans", sans-serif;
    color: var(--wa-ink);
    font-size: 14.2px;
}
.wa-app * { box-sizing: border-box; }
.wa-app button { font-family: inherit; }
.wa-app svg.wa-i { width: 24px; height: 24px; fill: currentColor; display: block; flex-shrink: 0; }

.wa-chat-container { display: flex; height: 100%; position: relative; }

/* ---------- generic ---------- */
.wa-icon-btn {
    width: 40px; height: 40px; border-radius: 50%;
    border: none; background: transparent; color: var(--wa-icon);
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer; flex-shrink: 0; transition: background .15s;
    padding: 0;
}
.wa-icon-btn:hover { background: rgba(11, 20, 26, 0.06); }
.wa-icon-btn.active { background: rgba(11, 20, 26, 0.1); }
.wa-head-actions { display: flex; align-items: center; gap: 4px; }

.wa-avatar {
    width: 49px; height: 49px; border-radius: 50%; flex-shrink: 0;
    background: #dfe5e7; color: #fff; overflow: hidden;
    display: flex; align-items: center; justify-content: center;
}
.wa-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.wa-avatar svg { width: 100%; height: 100%; display: block; }
.wa-avatar-40 { width: 40px; height: 40px; }
.wa-avatar-200 { width: 200px; height: 200px; }

/* ---------- sidebar ---------- */
.wa-sidebar {
    width: 30%; min-width: 340px; max-width: 460px;
    border-right: 1px solid var(--wa-line);
    display: flex; flex-direction: column; background: #fff;
    position: relative; overflow: hidden;
}
.wa-side-head {
    height: 64px; padding: 0 12px 0 20px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: space-between;
}
.wa-side-head h2 { font-size: 22px; font-weight: 700; color: var(--wa-ink); letter-spacing: -0.2px; }
.wa-conn {
    font-size: 11px; font-weight: 600; letter-spacing: .3px; text-transform: uppercase;
    padding: 4px 9px; border-radius: 12px; margin-right: 4px;
    background: #f0f2f5; color: var(--wa-ink-2);
}
.wa-conn.ready { background: #d9fdd3; color: var(--wa-green-dark); }
.wa-conn.linking { background: #fff3c4; color: #8a6100; }
.wa-conn.error { background: #ffe5ea; color: var(--wa-danger); }
.wa-conn-banner {
    margin: 0 12px 8px; padding: 12px 14px; border-radius: 8px;
    background: #fff3c4; color: #54656f; font-size: 13px; line-height: 1.4;
    display: flex; gap: 12px; align-items: center;
}
.wa-conn-banner b { color: var(--wa-ink); display: block; font-size: 14px; }

.wa-search { padding: 2px 12px 8px; flex-shrink: 0; }
.wa-search-box {
    display: flex; align-items: center; gap: 12px;
    background: var(--wa-panel); border-radius: 8px; height: 36px; padding: 0 12px;
    color: var(--wa-icon); transition: background .15s, box-shadow .15s;
}
.wa-search-box:focus-within { background: #fff; box-shadow: inset 0 0 0 2px var(--wa-green); }
.wa-search-box:focus-within .wa-search-ico { color: var(--wa-green); }
.wa-search-ico svg.wa-i { width: 20px; height: 20px; }
.wa-search-box input {
    flex: 1; border: none !important; background: transparent !important; outline: none;
    font-size: 14px; padding: 0 !important; height: 100%; color: var(--wa-ink);
    box-shadow: none !important; min-width: 0;
}
.wa-search-box input::placeholder { color: var(--wa-ink-2); }
.wa-search-clear { display: none; border: none; background: none; color: var(--wa-icon); cursor: pointer; padding: 0; }
.wa-search-clear svg.wa-i { width: 18px; height: 18px; }
.wa-search-box.has-value .wa-search-clear { display: inline-flex; }

.wa-chips { display: flex; gap: 8px; padding: 0 12px 8px; overflow-x: auto; flex-shrink: 0; scrollbar-width: none; }
.wa-chips::-webkit-scrollbar { display: none; }
.wa-chip {
    border: none; border-radius: 16px; padding: 6px 12px; cursor: pointer;
    background: var(--wa-panel); color: var(--wa-ink-2); font-size: 14px; white-space: nowrap;
    transition: background .15s;
}
.wa-chip:hover { background: #e9edef; }
.wa-chip.active { background: #d9fdd3; color: var(--wa-green-dark); font-weight: 500; }
.wa-chip .wa-chip-count { margin-left: 4px; font-size: 12px; }

.wa-chat-list { flex: 1; overflow-y: auto; overflow-x: hidden; }
.wa-chat-list::-webkit-scrollbar, .wa-messages::-webkit-scrollbar, .wa-drawer-body::-webkit-scrollbar, .wa-modal-body::-webkit-scrollbar { width: 6px; }
.wa-chat-list::-webkit-scrollbar-thumb, .wa-messages::-webkit-scrollbar-thumb, .wa-drawer-body::-webkit-scrollbar-thumb, .wa-modal-body::-webkit-scrollbar-thumb { background: rgba(11, 20, 26, 0.2); border-radius: 3px; }
.wa-list-empty { text-align: center; padding: 48px 24px; color: var(--wa-ink-2); font-size: 14px; line-height: 1.5; }
.wa-list-heading { padding: 18px 20px 10px 28px; color: var(--wa-green-dark); font-size: 15px; }

.wa-archived-row {
    display: flex; align-items: center; gap: 15px; height: 50px; padding: 0 16px 0 28px;
    cursor: pointer; color: var(--wa-ink);
}
.wa-archived-row:hover { background: var(--wa-hover); }
.wa-archived-row .wa-i { color: var(--wa-green); }
.wa-archived-row span.cnt { margin-left: auto; color: var(--wa-green); font-size: 12px; font-weight: 600; }

.wa-chat-item {
    display: flex; align-items: center; height: 72px; padding: 0 0 0 12px;
    cursor: pointer; position: relative; margin: 0 8px; border-radius: 8px;
}
.wa-chat-item:hover { background: var(--wa-hover); }
.wa-chat-item.active { background: var(--wa-active); }
.wa-chat-item .wa-avatar { margin-right: 13px; }
.wa-chat-info {
    flex: 1; min-width: 0; height: 100%; padding-right: 12px;
    display: flex; flex-direction: column; justify-content: center;
    border-bottom: 1px solid var(--wa-line);
}
.wa-chat-item:hover .wa-chat-info, .wa-chat-item.active .wa-chat-info { border-bottom-color: transparent; }
.wa-chat-top, .wa-chat-bottom { display: flex; align-items: center; gap: 6px; min-width: 0; }
.wa-chat-top { margin-bottom: 2px; }
.wa-chat-name { flex: 1; min-width: 0; font-size: 17px; color: var(--wa-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wa-chat-time { font-size: 12px; color: var(--wa-ink-2); flex-shrink: 0; }
.wa-chat-item.unread .wa-chat-time { color: var(--wa-badge); font-weight: 500; }
.wa-chat-msg {
    flex: 1; min-width: 0; font-size: 14px; color: var(--wa-ink-2);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    display: flex; align-items: center; gap: 3px;
}
.wa-chat-msg .wa-i { width: 16px; height: 16px; }
.wa-chat-msg .txt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wa-chat-msg .draft { color: var(--wa-green); }
.wa-chat-msg .typing { color: var(--wa-green); }
.wa-chat-flags { display: flex; align-items: center; gap: 4px; color: #8696a0; flex-shrink: 0; }
.wa-chat-flags .wa-i { width: 18px; height: 18px; }
.wa-unread {
    min-width: 20px; height: 20px; border-radius: 10px; padding: 0 6px;
    background: var(--wa-badge); color: #fff; font-size: 12px; font-weight: 600;
    display: inline-flex; align-items: center; justify-content: center;
}
.wa-unread.dot { min-width: 12px; width: 12px; height: 12px; padding: 0; }
.wa-unread.muted { background: #8696a0; }
.wa-chat-chev {
    width: 0; overflow: hidden; color: #8696a0; transition: width .12s; display: inline-flex;
    border: none; background: none; cursor: pointer; padding: 0;
}
.wa-chat-item:hover .wa-chat-chev, .wa-chat-chev.open { width: 22px; }
.wa-lead-tag {
    font-size: 10.5px; font-weight: 600; padding: 1px 7px; border-radius: 9px;
    background: #efecfd; color: #6c5dd3; flex-shrink: 0; max-width: 110px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* slide-in side panel */
.wa-side-panel {
    position: absolute; inset: 0; background: #fff; z-index: 5;
    display: flex; flex-direction: column;
    transform: translateX(-100%); transition: transform .22s cubic-bezier(.1, .82, .25, 1);
}
.wa-side-panel.open { transform: none; }
.wa-panel-head {
    height: 64px; display: flex; align-items: center; gap: 18px; padding: 0 16px; flex-shrink: 0;
}
.wa-panel-head h3 { font-size: 16px; font-weight: 500; color: var(--wa-ink); }
.wa-side-panel .wa-panel-head { height: 108px; align-items: flex-end; padding-bottom: 14px; background: var(--wa-green-dark); color: #fff; }
.wa-side-panel .wa-panel-head h3 { color: #fff; font-size: 19px; }
.wa-side-panel .wa-panel-head .wa-icon-btn { color: #fff; }
.wa-side-panel .wa-search { padding-top: 8px; }
.wa-new-action { display: flex; align-items: center; gap: 15px; height: 72px; padding: 0 16px 0 20px; cursor: pointer; }
.wa-new-action:hover { background: var(--wa-hover); }
.wa-new-action .wa-new-ic { width: 49px; height: 49px; border-radius: 50%; background: var(--wa-green); color: #fff; display: flex; align-items: center; justify-content: center; }
.wa-new-action span.lbl { font-size: 17px; }

/* ---------- conversation ---------- */
.wa-chat-area {
    flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative;
    background: var(--wa-chat-bg);
}
.wa-intro {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    text-align: center; padding: 28px; background: #f8f9fa; border-bottom: 6px solid #25d366;
    position: relative;
}
.wa-intro h1 { font-size: 32px; font-weight: 300; color: #41525d; margin: 28px 0 14px; letter-spacing: -0.3px; }
.wa-intro p { color: var(--wa-ink-2); font-size: 14px; line-height: 20px; max-width: 460px; }
.wa-intro-foot { position: absolute; bottom: 36px; color: #8696a0; font-size: 14px; display: flex; align-items: center; gap: 6px; }
.wa-intro-foot svg.wa-i { width: 14px; height: 14px; }

.wa-chat-head {
    height: 64px; flex-shrink: 0; display: flex; align-items: center; padding: 0 16px;
    background: var(--wa-panel); border-left: 1px solid transparent; gap: 4px; z-index: 3;
}
.wa-chat-head-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 15px; cursor: pointer; height: 100%; }
.wa-chat-head-text { min-width: 0; }
.wa-chat-head-name { font-size: 16px; color: var(--wa-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wa-chat-head-sub { font-size: 13px; color: var(--wa-ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.wa-chat-head-sub.typing { color: var(--wa-green); }
.wa-lead-chip {
    font-size: 12px; font-weight: 600; padding: 5px 10px; border-radius: 14px; margin-right: 6px;
    background: #efecfd; color: #6c5dd3; cursor: pointer; white-space: nowrap; max-width: 200px; overflow: hidden; text-overflow: ellipsis;
}
.wa-lead-chip.add { background: #fff; color: var(--wa-green-dark); box-shadow: inset 0 0 0 1px #d1d7db; }
.wa-mobile-back { display: none; }

.wa-messages-wrap { flex: 1; min-height: 0; position: relative; }
.wa-messages-wrap::before {
    content: ''; position: absolute; inset: 0; pointer-events: none; opacity: .045;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220' viewBox='0 0 220 220' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 30h26a6 6 0 0 1 6 6v14a6 6 0 0 1-6 6H32l-8 7v-7h-4a6 6 0 0 1-6-6V36a6 6 0 0 1 6-6z'/%3E%3Ccircle cx='96' cy='34' r='12'/%3E%3Cpath d='M91 32h.01M101 32h.01M90 39c3 3 9 3 12 0'/%3E%3Cpath d='M160 20l5 10 11 2-8 8 2 11-10-5-10 5 2-11-8-8 11-2z'/%3E%3Cpath d='M30 110c0-8 12-8 12 0 0-8 12-8 12 0 0 9-12 15-12 18-0-3-12-9-12-18z'/%3E%3Crect x='86' y='92' width='22' height='36' rx='4'/%3E%3Cpath d='M94 122h6'/%3E%3Cpath d='M150 100a14 14 0 1 0 28 0a14 14 0 1 0-28 0M164 86v28M150 100h28'/%3E%3Cpath d='M22 170l14-14 14 14-14 14z'/%3E%3Cpath d='M86 160h30v22H86zM86 160l15 12 15-12'/%3E%3Cpath d='M160 160v26M152 168l8-8 8 8M150 192h20'/%3E%3Ccircle cx='200' cy='60' r='4'/%3E%3Ccircle cx='60' cy='80' r='3'/%3E%3Ccircle cx='130' cy='200' r='3'/%3E%3Cpath d='M196 130c6 0 10 4 10 10s-4 10-10 10'/%3E%3C/svg%3E");
    background-size: 330px;
}
.wa-messages {
    position: absolute; inset: 0; overflow-y: auto; overflow-x: hidden;
    padding: 12px 6% 10px; display: flex; flex-direction: column;
}
.wa-msg-state { margin: auto; text-align: center; color: var(--wa-ink-2); font-size: 14px; background: rgba(255,255,255,.9); padding: 14px 20px; border-radius: 10px; box-shadow: var(--wa-shadow); }
.wa-msg-state .wa-spinner { margin: 0 auto 10px; }
.wa-spinner { width: 26px; height: 26px; border-radius: 50%; border: 3px solid #d1d7db; border-top-color: var(--wa-green); animation: waSpin .8s linear infinite; }
@keyframes waSpin { to { transform: rotate(360deg); } }

.wa-day { align-self: center; margin: 10px 0 8px; position: sticky; top: 4px; z-index: 2; }
.wa-day span {
    display: inline-block; background: #fff; color: var(--wa-ink-2); font-size: 12.5px; text-transform: uppercase;
    padding: 5px 12px 6px; border-radius: 7.5px; box-shadow: var(--wa-shadow);
}
.wa-sys { align-self: center; margin: 6px 0; max-width: 85%; text-align: center; }
.wa-sys span { display: inline-block; background: #fff; color: var(--wa-ink-2); font-size: 12.5px; padding: 6px 12px; border-radius: 7.5px; box-shadow: var(--wa-shadow); line-height: 1.4; }
.wa-sys.e2e span { background: #ffeecd; color: #54656f; }
.wa-sys.e2e svg.wa-i { width: 12px; height: 12px; display: inline-block; vertical-align: -1px; margin-right: 3px; }
.wa-unread-sep { align-self: stretch; text-align: center; margin: 8px -6.4% 8px; background: rgba(255, 255, 255, .25); padding: 4px 0; }
.wa-unread-sep span { background: #fff; color: var(--wa-ink-2); font-size: 12.5px; padding: 5px 12px; border-radius: 7.5px; box-shadow: var(--wa-shadow); display: inline-block; }

/* message rows */
.wa-row { display: flex; position: relative; margin-bottom: 2px; padding: 0 9px; }
.wa-row.out { justify-content: flex-end; }
.wa-row.first { margin-top: 10px; }
.wa-row.has-reactions { margin-bottom: 18px; }
.wa-row.flash .wa-bubble { animation: waFlash 1.6s ease; }
@keyframes waFlash { 0%, 60% { filter: brightness(.85); } 100% { filter: none; } }
.wa-row .wa-select-box { display: none; }
.wa-app.selecting .wa-row { cursor: pointer; padding-left: 44px; }
.wa-app.selecting .wa-row:hover { background: rgba(11, 20, 26, 0.04); }
.wa-app.selecting .wa-row .wa-select-box {
    display: block; position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
    width: 18px; height: 18px; border-radius: 3px; border: 2px solid #8696a0; background: #fff;
}
.wa-app.selecting .wa-row.selected { background: rgba(0, 168, 132, 0.12); }
.wa-app.selecting .wa-row.selected .wa-select-box { background: var(--wa-green); border-color: var(--wa-green); }
.wa-app.selecting .wa-row.selected .wa-select-box::after { content: ''; position: absolute; left: 4px; top: 0; width: 5px; height: 10px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.wa-app.selecting .wa-bubble { pointer-events: none; }

.wa-bubble {
    position: relative; max-width: 65%; min-width: 0;
    padding: 6px 7px 8px 9px; border-radius: 7.5px;
    background: var(--wa-in); color: var(--wa-ink); box-shadow: var(--wa-shadow);
    font-size: 14.2px; line-height: 19px; word-wrap: break-word; overflow-wrap: anywhere;
}
.wa-row.out .wa-bubble { background: var(--wa-out); }
.wa-row.first.in .wa-bubble { border-top-left-radius: 0; }
.wa-row.first.out .wa-bubble { border-top-right-radius: 0; }
.wa-row.first.in .wa-bubble::before, .wa-row.first.out .wa-bubble::before {
    content: ''; position: absolute; top: 0; width: 8px; height: 13px; background: inherit;
}
.wa-row.first.in .wa-bubble::before { left: -8px; clip-path: polygon(0 0, 100% 0, 100% 100%); }
.wa-row.first.out .wa-bubble::before { right: -8px; clip-path: polygon(0 0, 100% 0, 0 100%); }
.wa-bubble.media { padding: 3px; }
.wa-bubble.sticker { background: transparent !important; box-shadow: none; padding: 0; }
.wa-bubble.sticker::before { display: none; }

.wa-author { font-size: 12.8px; font-weight: 500; line-height: 22px; margin-bottom: -2px; display: flex; gap: 8px; align-items: baseline; }
.wa-author .num { color: var(--wa-ink-2); font-weight: 400; font-size: 12px; }
.wa-bubble.media .wa-author { padding: 3px 6px 0; }
.wa-fwd { font-size: 12.8px; color: var(--wa-ink-2); font-style: italic; display: flex; align-items: center; gap: 3px; margin-bottom: 2px; }
.wa-fwd svg.wa-i { width: 15px; height: 15px; }
.wa-text { white-space: pre-wrap; }
.wa-text.big-emoji { font-size: 40px; line-height: 48px; }
.wa-text a { color: #027eb5; text-decoration: none; }
.wa-text a:hover { text-decoration: underline; }
.wa-text code { font-family: Menlo, Consolas, monospace; font-size: 13px; background: rgba(11, 20, 26, .06); padding: 1px 4px; border-radius: 3px; }
.wa-text pre { font-family: Menlo, Consolas, monospace; font-size: 13px; white-space: pre-wrap; margin: 0; }
.wa-text mark { background: #fff3a3; border-radius: 2px; }
.wa-read-more { color: #027eb5; cursor: pointer; display: inline-block; margin-top: 2px; }
.wa-deleted { color: var(--wa-ink-2); font-style: italic; display: inline-flex; align-items: center; gap: 4px; }
.wa-deleted svg.wa-i { width: 16px; height: 16px; }
.wa-bubble.media .wa-text { padding: 4px 4px 0 6px; }

/* time + ticks */
.wa-meta {
    float: right; margin: 6px 0 -5px 10px; position: relative; top: 4px;
    display: inline-flex; align-items: center; gap: 3px; height: 15px;
    font-size: 11px; color: var(--wa-ink-2); white-space: nowrap;
}
.wa-meta .edited { font-style: normal; }
/* team member who sent it (internal only) */
.wa-meta .wa-sentby {
    font-weight: 600; color: var(--wa-ink-2); max-width: 110px;
    overflow: hidden; text-overflow: ellipsis; margin-right: 2px;
}
.wa-meta .wa-sentby::after { content: '·'; margin-left: 4px; font-weight: 400; }
.wa-meta.overlay .wa-sentby { color: #fff; }
.wa-meta svg.wa-i { width: 13px; height: 13px; }
.wa-meta .tick { width: 16px; height: 11px; color: #8696a0; }
.wa-meta .tick.read { color: var(--wa-blue-tick); }
.wa-meta .wa-star svg.wa-i { width: 11px; height: 11px; color: #8696a0; }
.wa-meta.overlay {
    position: absolute; right: 7px; bottom: 6px; float: none; margin: 0; top: auto;
    color: #fff; padding: 0 4px; border-radius: 9px;
    text-shadow: 0 1px 1px rgba(0,0,0,.4);
    background: linear-gradient(to bottom, transparent, rgba(0,0,0,.25));
}
.wa-meta.overlay .tick { color: #fff; }
.wa-meta.overlay .tick.read { color: var(--wa-blue-tick); }
.wa-meta.on-sticker { position: absolute; right: 0; bottom: -2px; background: #fff; color: var(--wa-ink-2); padding: 0 6px; border-radius: 8px; box-shadow: var(--wa-shadow); float: none; top: auto; margin: 0; }

/* hover controls */
.wa-bubble-chev {
    position: absolute; top: 2px; right: 2px; width: 30px; height: 24px; border: none; cursor: pointer;
    color: #8696a0; opacity: 0; transition: opacity .12s; padding: 0 0 0 8px; z-index: 1;
    display: flex; align-items: center; justify-content: center; border-top-right-radius: 7px;
    background: radial-gradient(at top right, var(--wa-in) 60%, transparent 80%);
}
.wa-row.out .wa-bubble-chev { background: radial-gradient(at top right, var(--wa-out) 60%, transparent 80%); }
.wa-bubble.media .wa-bubble-chev { color: #fff; background: radial-gradient(at top right, rgba(11,20,26,.5), transparent 70%); }
.wa-bubble:hover .wa-bubble-chev, .wa-bubble-chev.open { opacity: 1; }
.wa-react-trigger {
    align-self: center; width: 26px; height: 26px; border-radius: 50%; border: none; cursor: pointer;
    background: rgba(11, 20, 26, 0.3); color: #fff; margin: 0 8px; opacity: 0; transition: opacity .12s;
    display: flex; align-items: center; justify-content: center; padding: 0; flex-shrink: 0;
}
.wa-react-trigger svg.wa-i { width: 18px; height: 18px; }
.wa-row:hover .wa-react-trigger { opacity: 1; }
.wa-row.in .wa-react-trigger { order: 2; }
.wa-app.selecting .wa-react-trigger, .wa-app.selecting .wa-bubble-chev { display: none; }

/* reactions */
.wa-reactions {
    position: absolute; bottom: -16px; display: flex; gap: 2px; z-index: 1;
    background: #fff; border-radius: 12px; padding: 2px 6px; box-shadow: 0 1px 2px rgba(11,20,26,.2);
    font-size: 14px; line-height: 20px; cursor: pointer; align-items: center;
}
.wa-row.in .wa-reactions { left: 8px; }
.wa-row.out .wa-reactions { right: 8px; }
.wa-reactions .n { font-size: 12px; color: var(--wa-ink-2); margin-left: 2px; }

/* quoted message */
.wa-quote {
    display: flex; border-radius: 7.5px; overflow: hidden; background: rgba(11, 20, 26, 0.05);
    margin: 0 0 5px; cursor: pointer; min-height: 42px; position: relative;
}
.wa-row.out .wa-quote { background: rgba(37, 211, 102, 0.12); }
.wa-bubble.media .wa-quote { margin: 0 0 3px; }
.wa-quote::before { content: ''; width: 4px; background: var(--q-color, #06cf9c); flex-shrink: 0; }
.wa-quote-body { padding: 5px 10px 6px 8px; min-width: 0; flex: 1; }
.wa-quote-author { color: var(--q-color, #06cf9c); font-size: 12.8px; font-weight: 500; line-height: 20px; }
.wa-quote-text { color: var(--wa-ink-2); font-size: 13.2px; line-height: 18px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; white-space: pre-wrap; }
.wa-quote-text svg.wa-i { width: 15px; height: 15px; display: inline-block; vertical-align: -3px; margin-right: 2px; }
.wa-quote-thumb { width: 56px; flex-shrink: 0; background-size: cover; background-position: center; }

/* media */
.wa-media-img {
    position: relative; border-radius: 6px; overflow: hidden; cursor: pointer;
    width: 330px; max-width: 100%; min-height: 120px; background: #cfd4d6;
    display: flex; align-items: center; justify-content: center;
}
.wa-media-img img { width: 100%; max-height: 360px; object-fit: cover; display: block; }
.wa-media-img img.thumb { filter: blur(6px); transform: scale(1.05); }
.wa-media-img .wa-play {
    position: absolute; width: 50px; height: 50px; border-radius: 50%; background: rgba(11,20,26,.55); color: #fff;
    display: flex; align-items: center; justify-content: center;
}
.wa-media-img .wa-play svg.wa-i { width: 30px; height: 30px; }
.wa-media-img .wa-dur { position: absolute; left: 8px; bottom: 6px; color: #fff; font-size: 11px; display: flex; gap: 3px; align-items: center; text-shadow: 0 1px 1px rgba(0,0,0,.4); }
.wa-media-img .wa-dur svg.wa-i { width: 16px; height: 16px; }
.wa-media-img .wa-spinner { position: absolute; border-color: rgba(255,255,255,.4); border-top-color: #fff; }
.wa-sticker-img { width: 160px; height: 160px; object-fit: contain; display: block; cursor: pointer; }

.wa-doc {
    display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 6px;
    background: rgba(11, 20, 26, 0.04); cursor: pointer; width: 320px; max-width: 100%;
}
.wa-row.out .wa-doc { background: rgba(11, 20, 26, 0.04); }
.wa-doc-ic { width: 32px; height: 40px; border-radius: 3px; flex-shrink: 0; position: relative; color: #fff; font-size: 9px; font-weight: 700; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 5px; text-transform: uppercase; }
.wa-doc-ic::after { content: ''; position: absolute; top: 0; right: 0; border-style: solid; border-width: 0 9px 9px 0; border-color: transparent #fff transparent transparent; opacity: .6; }
.wa-doc-name { font-size: 14.2px; color: var(--wa-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wa-doc-sub { font-size: 12px; color: var(--wa-ink-2); margin-top: 2px; }
.wa-doc-dl { margin-left: auto; width: 34px; height: 34px; border-radius: 50%; border: 1px solid #8696a0; color: #8696a0; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.wa-doc-dl svg.wa-i { width: 20px; height: 20px; }

.wa-audio { display: flex; align-items: center; gap: 10px; width: 300px; max-width: 100%; padding: 4px 2px 0; }
.wa-audio-av { position: relative; flex-shrink: 0; }
.wa-audio-av .wa-avatar { width: 52px; height: 52px; }
.wa-audio-av .wa-ptt-mic { position: absolute; bottom: -2px; right: -4px; color: #4fc3f7; }
.wa-row.out .wa-audio-av .wa-ptt-mic { color: var(--wa-green); }
.wa-audio-av .wa-ptt-mic svg.wa-i { width: 20px; height: 20px; }
.wa-audio-play { width: 34px; height: 34px; border: none; background: none; color: #8696a0; cursor: pointer; padding: 0; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.wa-audio-play svg.wa-i { width: 34px; height: 34px; }
.wa-audio-main { flex: 1; min-width: 0; }
.wa-wave { display: flex; align-items: center; gap: 2px; height: 26px; cursor: pointer; position: relative; }
.wa-wave i { flex: 1; background: #b4bec4; border-radius: 2px; min-height: 3px; }
.wa-wave i.on { background: #4fc3f7; }
.wa-row.out .wa-wave i.on { background: var(--wa-green); }
.wa-audio-time { font-size: 11px; color: var(--wa-ink-2); margin-top: 3px; }

.wa-location { width: 270px; max-width: 100%; cursor: pointer; }
.wa-location-map { height: 120px; border-radius: 6px; background: linear-gradient(135deg, #e3efe8 25%, #e6e2f7 25%, #e6e2f7 50%, #e3efe8 50%, #e3efe8 75%, #e6e2f7 75%); background-size: 28px 28px; display: flex; align-items: center; justify-content: center; color: #e53935; }
.wa-location-map svg.wa-i { width: 42px; height: 42px; }
.wa-location-name { padding: 6px 6px 0; font-size: 13.5px; }

.wa-vcard { display: flex; align-items: center; gap: 10px; padding: 6px 4px 8px; width: 260px; max-width: 100%; border-bottom: 1px solid rgba(11, 20, 26, 0.08); margin-bottom: 4px; }
.wa-vcard .wa-avatar { width: 42px; height: 42px; }
.wa-call { display: flex; align-items: center; gap: 10px; padding: 4px 6px 4px 2px; }
.wa-call-ic { width: 38px; height: 38px; border-radius: 50%; background: rgba(11, 20, 26, 0.06); display: flex; align-items: center; justify-content: center; color: var(--wa-danger); }
.wa-call-ic svg.wa-i { width: 20px; height: 20px; }

/* scroll down */
.wa-scroll-down {
    position: absolute; right: 18px; bottom: 16px; width: 42px; height: 42px; border-radius: 50%;
    border: none; background: #fff; color: var(--wa-icon); box-shadow: 0 1px 3px rgba(11,20,26,.3);
    display: none; align-items: center; justify-content: center; cursor: pointer; z-index: 3;
}
.wa-scroll-down.show { display: flex; }
.wa-scroll-badge { position: absolute; top: -8px; left: -6px; min-width: 20px; height: 20px; border-radius: 10px; background: var(--wa-badge); color: #fff; font-size: 11.5px; font-weight: 600; display: flex; align-items: center; justify-content: center; padding: 0 5px; }
.wa-drop-zone { position: absolute; inset: 0; background: rgba(240, 242, 245, 0.92); display: none; align-items: center; justify-content: center; z-index: 6; border: 3px dashed var(--wa-green); }
.wa-drop-zone div { font-size: 22px; color: var(--wa-ink-2); }
.wa-drop-zone.show { display: flex; }

/* select bar */
.wa-select-bar { height: 62px; flex-shrink: 0; background: var(--wa-panel); display: flex; align-items: center; gap: 16px; padding: 0 16px; }
.wa-select-bar span { flex: 1; font-size: 15px; }

/* composer */
.wa-composer-wrap { flex-shrink: 0; background: var(--wa-panel); position: relative; z-index: 3; }
.wa-reply-bar { display: flex; align-items: center; gap: 8px; padding: 8px 12px 0 66px; }
.wa-reply-bar .wa-quote { flex: 1; margin: 0; background: rgba(11, 20, 26, 0.05); cursor: default; }
.wa-reply-bar.editing .wa-quote::before { background: var(--wa-green); }
.wa-composer { display: flex; align-items: flex-end; gap: 8px; padding: 5px 16px 5px 10px; min-height: 62px; }
.wa-composer-tools { position: relative; display: flex; align-items: center; height: 52px; }
.wa-input-box {
    flex: 1; min-width: 0; background: #fff; border-radius: 8px; display: flex; align-items: flex-end;
    margin: 5px 0; padding: 0 4px; min-height: 42px;
}
.wa-input-box .wa-icon-btn { height: 42px; width: 38px; }
.wa-input-box .wa-icon-btn:hover { background: transparent; color: var(--wa-ink); }
.wa-input-box textarea {
    flex: 1; border: none !important; outline: none; resize: none; background: transparent !important;
    font-size: 15px; line-height: 20px; padding: 11px 8px 11px 2px !important; max-height: 140px; min-height: 42px;
    box-shadow: none !important; color: var(--wa-ink); font-family: inherit; border-radius: 0 !important;
}
.wa-input-box textarea::placeholder { color: var(--wa-ink-2); }
.wa-composer .wa-mic, .wa-composer .wa-send { margin-bottom: 6px; }
.wa-send {
    width: 42px; height: 42px; border-radius: 50%; border: none; cursor: pointer; flex-shrink: 0;
    background: var(--wa-green); color: #fff; display: inline-flex; align-items: center; justify-content: center; padding: 0 0 0 3px;
}
.wa-send:hover { background: var(--wa-green-dark); }
.wa-send-lg { width: 60px; height: 60px; }
.wa-send-lg svg.wa-i { width: 28px; height: 28px; }

.wa-attach-menu {
    position: absolute; bottom: 58px; left: 0; background: #fff; border-radius: 16px; padding: 10px 0;
    box-shadow: var(--wa-menu-shadow); min-width: 210px; display: none; z-index: 10;
    transform-origin: bottom left;
}
.wa-attach-menu.open { display: block; animation: waPop .16s ease-out; }
@keyframes waPop { from { opacity: 0; transform: scale(.9); } to { opacity: 1; transform: none; } }
.wa-attach-menu button {
    display: flex; align-items: center; gap: 14px; width: 100%; border: none; background: none;
    padding: 8px 20px; cursor: pointer; font-size: 15px; color: var(--wa-ink); text-align: left;
}
.wa-attach-menu button:hover { background: var(--wa-hover); }
.wa-am-ic { width: 32px; height: 32px; border-radius: 50%; color: #fff; display: flex; align-items: center; justify-content: center; }
.wa-am-ic svg.wa-i { width: 18px; height: 18px; }

.wa-record-bar { display: flex; align-items: center; justify-content: flex-end; gap: 14px; padding: 9px 16px; min-height: 62px; }
.wa-rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--wa-danger); animation: waBlink 1s infinite; }
@keyframes waBlink { 50% { opacity: .2; } }
#wa-rec-time { font-size: 17px; color: var(--wa-ink); min-width: 42px; }
.wa-rec-wave { display: flex; align-items: center; gap: 2px; height: 24px; width: 160px; }
.wa-rec-wave i { width: 3px; background: #8696a0; border-radius: 2px; }

.wa-emoji-panel {
    display: none; height: 300px; background: #fff; border-bottom: 1px solid var(--wa-line);
    flex-direction: column;
}
.wa-emoji-panel.open { display: flex; }
.wa-emoji-tabs { display: flex; border-bottom: 1px solid var(--wa-line); padding: 0 10px; flex-shrink: 0; }
.wa-emoji-tabs button { flex: 1; border: none; background: none; font-size: 20px; padding: 8px 0 6px; cursor: pointer; border-bottom: 3px solid transparent; opacity: .55; filter: grayscale(1); }
.wa-emoji-tabs button.active { border-bottom-color: var(--wa-green); opacity: 1; filter: none; }
.wa-emoji-grid { flex: 1; overflow-y: auto; padding: 8px 14px; display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); align-content: start; }
.wa-emoji-grid h4 { grid-column: 1 / -1; font-size: 13px; font-weight: 500; color: var(--wa-ink-2); padding: 8px 2px 6px; }
.wa-emoji-grid button { border: none; background: none; font-size: 26px; line-height: 38px; height: 40px; cursor: pointer; border-radius: 6px; padding: 0; }
.wa-emoji-grid button:hover { background: var(--wa-panel); }

/* media compose overlay */
.wa-media-compose {
    position: absolute; inset: 0; background: #e9edef; z-index: 8; display: flex; flex-direction: column;
}
.wa-mc-head { height: 60px; display: flex; align-items: center; gap: 14px; padding: 0 16px; background: var(--wa-panel); flex-shrink: 0; }
#wa-preview-name { font-size: 15px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wa-mc-size { font-size: 13px; color: var(--wa-ink-2); }
.wa-mc-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 24px; }
.wa-mc-stage img, .wa-mc-stage video { max-width: 100%; max-height: 100%; object-fit: contain; box-shadow: 0 2px 10px rgba(0,0,0,.12); background: #fff; }
.wa-mc-doc { background: #fff; border-radius: 10px; padding: 40px 60px; text-align: center; box-shadow: 0 2px 10px rgba(0,0,0,.08); }
.wa-mc-doc .wa-doc-ic { width: 70px; height: 88px; margin: 0 auto 16px; font-size: 16px; padding-bottom: 12px; }
.wa-mc-doc div.n { font-size: 16px; }
.wa-mc-doc div.s { color: var(--wa-ink-2); font-size: 13px; margin-top: 4px; }
.wa-mc-caption { padding: 0 15% 12px; flex-shrink: 0; }
.wa-mc-caption input { width: 100%; border: none !important; border-radius: 8px !important; height: 44px; padding: 0 14px !important; font-size: 15px; background: #fff !important; box-shadow: none !important; outline: none; }
.wa-mc-foot { display: flex; align-items: center; gap: 16px; padding: 12px 24px 18px; border-top: 1px solid #d1d7db; flex-shrink: 0; }
.wa-mc-strip { flex: 1; display: flex; gap: 8px; justify-content: center; overflow-x: auto; }
.wa-mc-strip .it { width: 52px; height: 52px; border-radius: 6px; overflow: hidden; border: 3px solid transparent; cursor: pointer; background: #fff; display: flex; align-items: center; justify-content: center; position: relative; flex-shrink: 0; }
.wa-mc-strip .it.active { border-color: var(--wa-green); }
.wa-mc-strip .it img { width: 100%; height: 100%; object-fit: cover; }
.wa-mc-strip .it .x { position: absolute; top: 0; right: 0; background: rgba(11,20,26,.55); color: #fff; border: none; width: 18px; height: 18px; font-size: 12px; line-height: 18px; cursor: pointer; padding: 0; border-bottom-left-radius: 4px; }
.wa-mc-strip .add { border: 1px solid #8696a0; color: var(--wa-icon); }

/* ---------- drawer ---------- */
.wa-drawer {
    width: 0; overflow: hidden; background: #fff; border-left: 1px solid var(--wa-line);
    display: flex; flex-direction: column; transition: width .2s ease; flex-shrink: 0;
}
.wa-drawer.open { width: 30%; min-width: 340px; max-width: 420px; }
.wa-drawer .wa-panel-head { background: var(--wa-panel); }
.wa-drawer-body { flex: 1; overflow-y: auto; background: var(--wa-panel); }
.wa-info-sec { background: #fff; padding: 16px 28px; margin-bottom: 10px; box-shadow: 0 1px 3px rgba(11,20,26,.06); }
.wa-info-hero { text-align: center; padding: 28px 28px 20px; }
.wa-info-hero .wa-avatar { margin: 0 auto 14px; cursor: pointer; }
.wa-info-hero h2 { font-size: 22px; font-weight: 400; color: var(--wa-ink); }
.wa-info-hero .sub { font-size: 16px; color: var(--wa-ink-2); margin-top: 4px; }
.wa-info-hero-actions { display: flex; justify-content: center; gap: 12px; margin-top: 18px; }
.wa-info-hero-actions button { border: 1px solid #e9edef; background: #fff; border-radius: 10px; width: 92px; padding: 12px 6px 8px; cursor: pointer; color: var(--wa-green-dark); font-size: 13px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.wa-info-hero-actions button:hover { background: var(--wa-hover); }
.wa-info-label { font-size: 14px; color: var(--wa-ink-2); margin-bottom: 8px; display: flex; justify-content: space-between; align-items: center; }
.wa-info-label a { color: var(--wa-ink-2); cursor: pointer; display: flex; align-items: center; }
.wa-info-val { font-size: 15px; color: var(--wa-ink); line-height: 1.45; white-space: pre-wrap; word-break: break-word; }
.wa-info-media { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.wa-info-media .m { aspect-ratio: 1; border-radius: 6px; background: #dfe5e7 center/cover; cursor: pointer; display: flex; align-items: center; justify-content: center; color: #fff; }
.wa-info-row { display: flex; align-items: center; gap: 22px; padding: 14px 0; cursor: pointer; font-size: 16px; color: var(--wa-ink); }
.wa-info-row .wa-i { color: #8696a0; }
.wa-info-row.danger, .wa-info-row.danger .wa-i { color: var(--wa-danger); }
.wa-info-row .end { margin-left: auto; color: var(--wa-ink-2); font-size: 14px; display: flex; align-items: center; }
.wa-switch { width: 34px; height: 14px; border-radius: 7px; background: #c4c9cc; position: relative; margin-left: auto; transition: background .15s; flex-shrink: 0; }
.wa-switch::after { content: ''; position: absolute; top: -3px; left: -2px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.35); transition: left .15s, background .15s; }
.wa-switch.on { background: #84d6c2; }
.wa-switch.on::after { left: 16px; background: var(--wa-green); }
.wa-member { display: flex; align-items: center; gap: 14px; padding: 9px 0; }
.wa-member .wa-avatar { width: 40px; height: 40px; }
.wa-member .n { font-size: 15.5px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wa-member .s { font-size: 13px; color: var(--wa-ink-2); }
.wa-member .adm { font-size: 11px; color: var(--wa-green-dark); background: #d9fdd3; border-radius: 4px; padding: 2px 6px; flex-shrink: 0; }
.wa-lead-card { border: 1px solid #d6e4f5; background: #f5f9fe; border-radius: 10px; padding: 14px; }
.wa-lead-card .t { font-weight: 600; font-size: 15px; color: #0c1a3a; }
.wa-lead-card .s { font-size: 13px; color: #4a5878; margin-top: 3px; }
.wa-lead-card .acts { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.wa-lead-card .acts button { border: 1px solid #dcd6f5; background: #fff; color: #6c5dd3; border-radius: 16px; padding: 5px 12px; font-size: 12.5px; cursor: pointer; font-weight: 600; }
.wa-tabs { display: flex; background: #fff; border-bottom: 1px solid var(--wa-line); position: sticky; top: 0; z-index: 1; }
.wa-tabs button { flex: 1; border: none; background: none; padding: 14px 0 12px; font-size: 14.5px; color: var(--wa-ink-2); cursor: pointer; border-bottom: 3px solid transparent; }
.wa-tabs button.active { color: var(--wa-green-dark); border-bottom-color: var(--wa-green); }
.wa-media-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 10px; background: #fff; }
.wa-media-grid .m { aspect-ratio: 1; background: #dfe5e7 center/cover; cursor: pointer; display: flex; align-items: center; justify-content: center; color: #fff; }
.wa-search-hit { background: #fff; padding: 12px 24px; border-bottom: 1px solid var(--wa-line); cursor: pointer; }
.wa-search-hit:hover { background: var(--wa-hover); }
.wa-search-hit .d { font-size: 12.5px; color: var(--wa-ink-2); margin-bottom: 3px; }
.wa-search-hit .t { font-size: 14.2px; color: var(--wa-ink-2); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.wa-search-hit .t mark { background: none; color: var(--wa-green-dark); font-weight: 600; }
.wa-star-item { background: #fff; padding: 12px 20px; border-bottom: 1px solid var(--wa-line); cursor: pointer; }
.wa-star-item:hover { background: var(--wa-hover); }
.wa-star-item .h { display: flex; justify-content: space-between; font-size: 13px; color: var(--wa-ink-2); margin-bottom: 6px; }
.wa-star-item .b { display: inline-block; background: var(--wa-out); border-radius: 7px; padding: 6px 9px; font-size: 14px; max-width: 100%; box-shadow: var(--wa-shadow); white-space: pre-wrap; word-break: break-word; }
.wa-star-item .b.in { background: #f0f2f5; }

/* ---------- menus & floating ---------- */
.wa-menu {
    position: fixed; z-index: 1000; background: #fff; border-radius: 3px; padding: 9px 0;
    box-shadow: var(--wa-menu-shadow); min-width: 200px; display: none;
    font-family: "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
}
.wa-menu.open { display: block; animation: waPop .12s ease-out; }
.wa-menu button {
    display: flex; align-items: center; gap: 12px; width: 100%; border: none; background: none;
    padding: 0 24px 0 20px; height: 40px; cursor: pointer; font-size: 14.5px; color: #3b4a54; text-align: left; white-space: nowrap;
}
.wa-menu button:hover { background: var(--wa-hover); }
.wa-menu button .wa-i { width: 20px; height: 20px; color: var(--wa-icon); }
.wa-menu button.danger { color: var(--wa-danger); }
.wa-menu hr { border: none; border-top: 1px solid var(--wa-line); margin: 6px 0; }

.wa-react-bar {
    position: fixed; z-index: 1001; background: #fff; border-radius: 26px; padding: 6px 8px;
    box-shadow: var(--wa-menu-shadow); display: none; gap: 2px;
}
.wa-react-bar.open { display: flex; animation: waPop .14s ease-out; }
.wa-react-bar button { border: none; background: none; font-size: 26px; width: 40px; height: 40px; border-radius: 50%; cursor: pointer; transition: transform .1s; padding: 0; }
.wa-react-bar button:hover { transform: scale(1.25); }
.wa-react-bar button.mine { background: #e9edef; }
.wa-react-bar button.more { font-size: 20px; color: var(--wa-icon); background: #f0f2f5; display: flex; align-items: center; justify-content: center; }
.wa-react-bar button.more:hover { transform: none; }

.wa-lightbox {
    position: absolute; inset: 0; z-index: 50; background: rgba(233, 237, 239, 0.97);
    display: none; flex-direction: column;
}
.wa-lightbox.open { display: flex; }
.wa-lb-head { height: 60px; display: flex; align-items: center; justify-content: space-between; padding: 0 16px; flex-shrink: 0; }
.wa-lb-meta { display: flex; align-items: center; gap: 12px; }
.wa-lb-meta .n { font-size: 15.5px; color: var(--wa-ink); }
.wa-lb-meta .t { font-size: 13px; color: var(--wa-ink-2); }
.wa-lb-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 10px 80px 30px; }
.wa-lb-stage img, .wa-lb-stage video { max-width: 100%; max-height: 100%; object-fit: contain; box-shadow: 0 4px 20px rgba(0,0,0,.15); }
.wa-lb-nav { position: absolute; top: 50%; width: 44px; height: 44px; border-radius: 50%; border: none; background: #fff; color: var(--wa-icon); box-shadow: 0 1px 3px rgba(0,0,0,.2); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.wa-lb-nav.prev { left: 20px; }
.wa-lb-nav.next { right: 20px; }

.wa-modal-backdrop { position: absolute; inset: 0; z-index: 60; background: rgba(255,255,255,.75); display: none; align-items: center; justify-content: center; }
.wa-modal-backdrop.open { display: flex; }
.wa-modal-card { width: 460px; max-width: calc(100% - 32px); height: 72%; max-height: 620px; background: #fff; box-shadow: 0 17px 50px rgba(11,20,26,.19), 0 12px 15px rgba(11,20,26,.24); display: flex; flex-direction: column; border-radius: 3px; overflow: hidden; }
.wa-modal-head { height: 60px; display: flex; align-items: center; gap: 18px; padding: 0 16px; background: var(--wa-green-dark); color: #fff; flex-shrink: 0; }
.wa-modal-head .wa-icon-btn { color: #fff; }
.wa-modal-head h3 { font-size: 18px; font-weight: 400; }
.wa-modal-card .wa-search { padding-top: 10px; }
.wa-modal-body { flex: 1; overflow-y: auto; }
.wa-pick { display: flex; align-items: center; gap: 14px; padding: 10px 20px; cursor: pointer; }
.wa-pick:hover { background: var(--wa-hover); }
.wa-pick .wa-avatar { width: 40px; height: 40px; }
.wa-pick .n { font-size: 16px; color: var(--wa-ink); }
.wa-pick .s { font-size: 13px; color: var(--wa-ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wa-pick .tx { flex: 1; min-width: 0; }
.wa-pick .cb { width: 18px; height: 18px; border: 2px solid #8696a0; border-radius: 3px; flex-shrink: 0; position: relative; }
.wa-pick.sel .cb { background: var(--wa-green); border-color: var(--wa-green); }
.wa-pick.sel .cb::after { content: ''; position: absolute; left: 4px; top: 0; width: 5px; height: 10px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.wa-tpl { padding: 14px 20px; border-bottom: 1px solid var(--wa-line); cursor: pointer; }
.wa-tpl:hover { background: var(--wa-hover); }
.wa-tpl .n { font-weight: 600; font-size: 14.5px; margin-bottom: 4px; }
.wa-tpl .b { font-size: 13.5px; color: var(--wa-ink-2); white-space: pre-wrap; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.wa-modal-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 20px; background: var(--wa-panel); flex-shrink: 0; }
.wa-modal-foot span { font-size: 14px; color: var(--wa-ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.wa-toast {
    position: absolute; left: 50%; bottom: 28px; transform: translate(-50%, 20px); z-index: 70;
    background: #3b4a54; color: #fff; padding: 12px 22px; border-radius: 6px; font-size: 14px;
    opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; max-width: 80%;
}
.wa-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- linking screen ---------- */
.wa-link-screen { position: absolute; inset: 0; z-index: 80; background: #fcf5eb; display: none; align-items: center; justify-content: center; padding: 24px; }
.wa-link-screen::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 30%; background: var(--wa-green); }
.wa-link-card { position: relative; background: #fff; border-radius: 3px; box-shadow: 0 17px 50px rgba(11,20,26,.19); padding: 56px 60px; display: flex; gap: 60px; align-items: center; max-width: 960px; width: 100%; }
.wa-link-text { flex: 1; }
.wa-link-text h2 { font-size: 28px; font-weight: 300; color: #41525d; margin-bottom: 36px; }
.wa-link-text ol { padding-left: 22px; color: #3b4a54; font-size: 17px; line-height: 28px; }
.wa-link-text li { margin-bottom: 14px; padding-left: 6px; }
.wa-link-qr { text-align: center; }
.wa-link-qr img { width: 264px; height: 264px; display: block; }
.wa-link-wait { font-size: 13px; color: var(--wa-ink-2); margin-top: 10px; }

/* ---------- responsive ---------- */
@media (max-width: 1280px) {
    .wa-drawer.open { position: absolute; right: 0; top: 0; bottom: 0; z-index: 20; box-shadow: -4px 0 20px rgba(11,20,26,.12); width: 380px; }
}
@media (max-width: 1024px) {
    .wa-app { height: calc(100dvh - var(--topbar-h) - 36px); border-radius: 10px; }
    .wa-sidebar { width: 100%; max-width: none; min-width: 0; border-right: none; }
    .wa-chat-area { position: absolute; inset: 0; z-index: 10; display: none; }
    .wa-chat-area.mobile-active { display: flex; }
    .wa-sidebar.mobile-hidden { display: none; }
    .wa-mobile-back { display: inline-flex; }
    .wa-messages { padding: 10px 2% 8px; }
    .wa-bubble { max-width: 85%; }
    .wa-drawer.open { width: 100%; max-width: none; min-width: 0; }
    .wa-link-card { flex-direction: column; gap: 28px; padding: 32px 24px; }
    .wa-link-qr img { width: 220px; height: 220px; }
    .wa-reply-bar { padding-left: 12px; }
    .wa-lead-chip { display: none !important; }
    .wa-lb-stage { padding: 10px 10px 30px; }
}
@media (max-width: 560px) {
    .wa-chat-name { font-size: 16px; }
    .wa-chat-head .wa-head-actions [data-ico="bolt"] { display: none; }
    .wa-chat-head-main { gap: 10px; }
    .wa-chip { font-size: 13px; padding: 5px 10px; }
    .wa-mc-caption { padding: 0 12px 12px; }
}
.wa-meta.static { float: none; top: 0; margin: 0; }

/* ---------- Status (stories) ---------- */
.wa-status-btn { position: relative; }
.wa-status-dot { display: none; position: absolute; top: 8px; right: 8px; width: 9px; height: 9px; border-radius: 50%; background: var(--wa-badge); border: 2px solid #fff; }
.wa-status-row { display: flex; align-items: center; gap: 14px; padding: 10px 16px 10px 20px; cursor: pointer; position: relative; }
.wa-status-row:hover { background: var(--wa-hover); }
.wa-status-av { position: relative; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.wa-status-av .wa-ring { position: absolute; inset: 0; }
.wa-status-av .wa-avatar { width: calc(100% - 8px); height: calc(100% - 8px); }
.wa-status-add { position: absolute; left: 56px; top: 44px; width: 22px; height: 22px; border-radius: 50%; border: 2px solid #fff; background: var(--wa-green); color: #fff; display: flex; align-items: center; justify-content: center; padding: 0; cursor: pointer; }
.wa-status-add svg.wa-i { width: 16px; height: 16px; }
.wa-status-txt { min-width: 0; flex: 1; }
.wa-status-txt .n { font-size: 16.5px; color: var(--wa-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wa-status-txt .s { font-size: 13.5px; color: var(--wa-ink-2); margin-top: 2px; }

.wa-sv, .wa-sc { position: absolute; inset: 0; z-index: 55; background: #0b141a; display: none; flex-direction: column; color: #e9edef; }
.wa-sv.open, .wa-sc.open { display: flex; }
.wa-sv .wa-icon-btn, .wa-sc .wa-icon-btn { color: #e9edef; }
.wa-sv .wa-icon-btn:hover, .wa-sc .wa-icon-btn:hover { background: rgba(255, 255, 255, 0.1); }
.wa-sv-bars { display: flex; gap: 4px; padding: 10px 16px 0; max-width: 620px; width: 100%; margin: 0 auto; flex-shrink: 0; }
.wa-sv-bars span { flex: 1; height: 3px; border-radius: 2px; background: rgba(255, 255, 255, 0.3); overflow: hidden; }
.wa-sv-bars i { display: block; height: 100%; background: #fff; width: 0; }
.wa-sv-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px; max-width: 620px; width: 100%; margin: 0 auto; flex-shrink: 0; }
.wa-sv-who { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.wa-sv-who .n { font-size: 15.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wa-sv-who .t { font-size: 12.5px; color: rgba(233, 237, 239, 0.7); }
.wa-sv-stage {
    flex: 1; min-height: 0; width: 100%; max-width: 620px; margin: 0 auto; border-radius: 10px; overflow: hidden;
    display: flex; align-items: center; justify-content: center; position: relative; user-select: none; touch-action: manipulation; cursor: pointer;
}
.wa-sv-stage img, .wa-sv-stage video { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.wa-sv-stage img.blur { filter: blur(10px); width: 100%; height: 100%; object-fit: cover; }
.wa-sv-text { color: #fff; text-align: center; padding: 30px; line-height: 1.35; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 100%; overflow: auto; }
.wa-sv-text a { color: #fff; text-decoration: underline; }
.wa-sv-caption { max-width: 620px; width: 100%; margin: 0 auto; text-align: center; padding: 10px 20px 0; font-size: 15px; line-height: 1.4; white-space: pre-wrap; flex-shrink: 0; }
.wa-sv-caption:empty { display: none; }
.wa-sv-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 46px; height: 46px; border-radius: 50%; border: none; background: rgba(255, 255, 255, 0.12); color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; z-index: 2; }
.wa-sv-nav:hover { background: rgba(255, 255, 255, 0.22); }
.wa-sv-nav.prev { left: 24px; }
.wa-sv-nav.next { right: 24px; }
.wa-sv-reply { display: flex; gap: 10px; align-items: center; max-width: 620px; width: 100%; margin: 0 auto; padding: 12px 16px calc(14px + env(safe-area-inset-bottom)); flex-shrink: 0; }
.wa-sv-reply input { flex: 1; height: 44px; border-radius: 22px !important; border: none !important; background: #2a3942 !important; color: #e9edef !important; padding: 0 18px !important; outline: none; box-shadow: none !important; font-size: 15px; }
.wa-sv-reply input::placeholder { color: #8696a0; }

.wa-sc-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 20px; position: relative; transition: background .2s; }
.wa-sc-stage textarea {
    width: 100%; max-width: 640px; min-height: 40%; background: transparent !important; border: none !important; outline: none; resize: none;
    color: #fff; text-align: center; font-size: 34px; line-height: 1.3; box-shadow: none !important; padding: 0 !important;
}
.wa-sc-stage textarea::placeholder { color: rgba(255, 255, 255, 0.6); }
.wa-sc-stage img, .wa-sc-stage video { max-width: 100%; max-height: 100%; object-fit: contain; }
.wa-sc-swatch { display: block; width: 22px; height: 22px; border-radius: 50%; border: 2px solid #fff; }
.wa-sc-caption { padding: 0 15% 12px; }
.wa-sc-caption input { width: 100%; height: 44px; border: none !important; border-radius: 8px !important; background: #2a3942 !important; color: #e9edef !important; padding: 0 14px !important; outline: none; box-shadow: none !important; }
.wa-sc-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 24px calc(16px + env(safe-area-inset-bottom)); background: rgba(0, 0, 0, 0.25); flex-shrink: 0; }
.wa-sc-note { font-size: 13px; color: rgba(233, 237, 239, 0.75); }

@media (max-width: 760px) {
    .wa-sv-nav { display: none; }
    .wa-sv-stage { border-radius: 0; }
    .wa-sc-stage textarea { font-size: 26px; }
    .wa-sc-caption { padding: 0 12px 12px; }
}
