/* ═══════════════════════════════════════════════════════════
   AETHERCHAT v2 — Dark theme, WhatsApp-class UX
═══════════════════════════════════════════════════════════ */

:root {
    --bg:           #111B21;
    --surface:      #1F2C34;
    --surface2:     #182229;
    --surface3:     #2A3942;
    --green:        #00A884;
    --green2:       #25D366;
    --green3:       #075E54;
    --bubble-out:   #005C4B;
    --bubble-in:    #202C33;
    --text1:        #E9EDEF;
    --text2:        #8696A0;
    --text3:        #667781;
    --tick-blue:    #53BDEB;
    --red:          #FF3B30;
    --link:         #53BDEB;
    --ease:         cubic-bezier(0.4, 0, 0.2, 1);
    --fast:         0.18s;
    --med:          0.28s;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body {
    width: 100%; height: 100%;
    background: var(--bg);
    color: var(--text1);
    font-family: 'Roboto', -apple-system, 'Segoe UI', Helvetica, sans-serif;
    font-size: 15px;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}
button { background: none; border: none; cursor: pointer; color: inherit; font: inherit; }
input, textarea { font: inherit; background: none; border: none; outline: none; color: var(--text1); }
input, textarea, [contenteditable] { user-select: text; }
.hidden { display: none !important; }
a { color: var(--link); text-decoration: none; }
img { max-width: 100%; }

/* ── Onboarding ── */
.ob-screen { position: fixed; inset: 0; z-index: 200; background: var(--bg); display: flex; align-items: flex-start; justify-content: center; overflow-y: auto; }
.ob-inner  { width: 100%; max-width: 440px; padding: 0 0 60px; }
.ob-hero   { text-align: center; padding: 72px 24px 32px; }
.ob-logo {
    width: 96px; height: 96px; border-radius: 50%; background: var(--green);
    display: flex; align-items: center; justify-content: center;
    font-size: 44px; color: #fff; margin: 0 auto 22px;
    box-shadow: 0 8px 32px rgba(0,168,132,0.3);
    overflow: hidden;
}
.ob-logo img { width: 100%; height: 100%; object-fit: cover; }
.ob-logo.green-soft { background: linear-gradient(135deg, #075E54, #00A884); }
.ob-logo.has-image  { font-size: 0; }
.ob-hero h1 { font-size: 26px; font-weight: 700; color: var(--text1); margin-bottom: 8px; }
.ob-hero p  { font-size: 14px; color: var(--text2); line-height: 1.6; }
.ob-terms   { font-size: 12.5px; color: var(--text3); margin-top: 12px; }
.ob-link    { color: var(--green); }
.ob-form    { padding: 0 24px; }

.g-btn-wrap { display: flex; justify-content: center; padding: 24px 0; }
.config-warn { background: rgba(255,59,48,0.15); border: 1px solid var(--red); color: var(--red); padding: 12px 16px; border-radius: 12px; font-size: 13px; text-align: center; }
.config-warn code { background: rgba(255,255,255,0.08); padding: 2px 6px; border-radius: 4px; }

.ob-field-group { margin-bottom: 22px; }
.ob-field-group label { display: block; font-size: 12px; font-weight: 600; color: var(--green); margin-bottom: 6px; letter-spacing: 0.4px; }
.ob-field-group input { width: 100%; border-bottom: 1.5px solid var(--green); padding: 10px 2px; font-size: 16px; color: var(--text1); transition: border-color var(--fast); }
.ob-field-group input::placeholder { color: var(--text3); }
.ob-field-group input:focus { border-bottom-color: var(--green2); }
.ob-field-group small { font-size: 12px; color: var(--text3); margin-top: 5px; display: block; }
.ob-field-group small.bad { color: var(--red); }
.ob-field-group small.ok  { color: var(--green); }

.handle-row { display: flex; align-items: center; gap: 4px; border-bottom: 1.5px solid var(--green); padding: 8px 2px; }
.handle-at  { color: var(--text2); font-size: 18px; }
.handle-row input { flex: 1; border: none; padding: 0; font-size: 16px; }
.handle-status { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; font-size: 13px; flex-shrink: 0; }
.handle-status.ok  { background: rgba(0,168,132,0.2); color: var(--green); }
.handle-status.bad { background: rgba(255,59,48,0.2); color: var(--red); }
.handle-status.wait{ color: var(--text2); }

.ob-next-btn {
    width: 100%; padding: 15px;
    background: var(--green); color: #fff;
    border-radius: 50px; font-size: 16px; font-weight: 700;
    box-shadow: 0 4px 16px rgba(0,168,132,0.3);
    transition: all var(--fast);
}
.ob-next-btn:hover  { background: var(--green2); }
.ob-next-btn:active { transform: scale(0.98); }
.ob-next-btn:disabled { background: var(--surface3); color: var(--text3); cursor: not-allowed; box-shadow: none; }
.ob-txt-btn { font-size: 13px; color: var(--green); }

/* ── App shell ── */
.app-shell { position: fixed; inset: 0; display: flex; flex-direction: column; background: var(--bg); overflow: hidden; }
.screen   { position: absolute; top: 0; left: 0; right: 0; bottom: 60px; display: flex; flex-direction: column; background: var(--bg); overflow: hidden; }
.screen.active { z-index: 5; }
.screen.hidden { display: none !important; }
.screen.slide-right { bottom: 0; z-index: 20; }

/* ── Header ── */
.wa-header { background: var(--surface); padding: 0 6px 0 16px; display: flex; align-items: center; height: 56px; flex-shrink: 0; position: relative; }
.wa-header-title { flex: 1; font-size: 20px; font-weight: 700; color: var(--text1); }
.wa-header-actions { display: flex; align-items: center; }
.hdr-btn, .hdr-back-btn { width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 19px; color: var(--text2); transition: background var(--fast); }
.hdr-btn:hover, .hdr-back-btn:hover { background: rgba(255,255,255,0.06); }
.hdr-btn.green-text { color: var(--green); font-size: 18px; }

/* ── Filter chips ── */
.filter-chips { display: flex; gap: 8px; padding: 10px 12px; overflow-x: auto; flex-shrink: 0; background: var(--bg); }
.filter-chips::-webkit-scrollbar { display: none; }
.chip { padding: 5px 14px; border-radius: 20px; white-space: nowrap; font-size: 13px; font-weight: 500; background: var(--bg); color: var(--text2); border: 1px solid var(--surface3); transition: all var(--fast); }
.chip.active { background: rgba(0,168,132,0.15); color: var(--green); border-color: var(--green); }

/* ── Chats list ── */
.chats-list { flex: 1; overflow-y: auto; }
.chats-list::-webkit-scrollbar { width: 2px; }
.chats-list::-webkit-scrollbar-thumb { background: var(--surface3); }

.chat-item { display: flex; align-items: center; padding: 12px 16px; gap: 14px; cursor: pointer; border-bottom: 1px solid rgba(42,57,66,0.5); transition: background var(--fast); position: relative; }
.chat-item:hover { background: rgba(255,255,255,0.025); }
.chat-item.active-item { background: rgba(0,168,132,0.06); }

.ci-av { width: 50px; height: 50px; border-radius: 50%; background: var(--surface); flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 600; color: #fff; position: relative; overflow: visible; }
.ci-av img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.ci-av-online-dot { position: absolute; bottom: 1px; right: 1px; width: 12px; height: 12px; border-radius: 50%; background: var(--green); border: 2px solid var(--bg); }

.ci-body { flex: 1; overflow: hidden; }
.ci-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 3px; }
.ci-name { font-size: 16.5px; font-weight: 400; color: var(--text1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: calc(100% - 70px); }
.ci-time { font-size: 12px; color: var(--text3); flex-shrink: 0; margin-left: 4px; }
.ci-time.unread { color: var(--green); }
.ci-bottom { display: flex; align-items: center; justify-content: space-between; }
.ci-preview { font-size: 14px; color: var(--text3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.ci-right { display: flex; align-items: center; gap: 6px; flex-shrink: 0; margin-left: 6px; }
.ci-badge { background: var(--green); color: #111; font-size: 11.5px; font-weight: 700; min-width: 20px; height: 20px; border-radius: 10px; display: flex; align-items: center; justify-content: center; padding: 0 5px; }
.ci-badge.muted { background: var(--text3); }
.ci-pin, .ci-muted-icon { font-size: 13px; color: var(--text3); }

.empty-state { text-align: center; padding: 48px 24px; color: var(--text3); }
.empty-state i { font-size: 42px; margin-bottom: 16px; display: block; opacity: 0.4; }
.empty-state p { font-size: 14px; line-height: 1.6; }

.fab { position: absolute; right: 16px; bottom: 16px; width: 58px; height: 58px; border-radius: 50%; background: var(--green); color: #fff; font-size: 22px; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 20px rgba(0,168,132,0.45); z-index: 10; transition: all var(--fast) var(--ease); }
.fab:hover { background: var(--green2); transform: scale(1.05); }
.fab:active { transform: scale(0.97); }

.ctx-menu { position: absolute; top: 56px; right: 4px; background: var(--surface); border-radius: 6px; box-shadow: 0 4px 20px rgba(0,0,0,0.5); z-index: 100; min-width: 200px; overflow: hidden; animation: menuIn var(--fast) var(--ease); }
@keyframes menuIn { from { opacity: 0; transform: scale(0.92) translateY(-8px); } to { opacity: 1; transform: scale(1) translateY(0); } }
.ctx-item { display: flex; align-items: center; gap: 12px; padding: 13px 20px; font-size: 14.5px; color: var(--text1); width: 100%; text-align: left; transition: background var(--fast); }
.ctx-item i { font-size: 16px; color: var(--text2); width: 18px; }
.ctx-item:hover { background: rgba(255,255,255,0.06); }

/* ── Updates / Status ── */
.updates-body { flex: 1; overflow-y: auto; }
.section-header { padding: 14px 16px 6px; font-size: 14px; color: var(--text3); font-weight: 500; }
.section-header.muted-hdr { color: var(--text3); padding-top: 18px; }
.my-status-row { display: flex; align-items: center; padding: 10px 16px; gap: 14px; cursor: pointer; }
.my-status-av-wrap { position: relative; }
.my-status-av { width: 52px; height: 52px; border-radius: 50%; background: var(--surface3); display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 600; color: #fff; }
.status-add-btn { position: absolute; bottom: -2px; right: -2px; width: 22px; height: 22px; border-radius: 50%; background: var(--green); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 16px; border: 2px solid var(--bg); }
.my-status-info strong { display: block; color: var(--text1); font-size: 16px; font-weight: 500; }
.my-status-info span { font-size: 13px; color: var(--text3); }
.status-list { padding: 0 0 24px; }
.status-item { display: flex; align-items: center; padding: 10px 16px; gap: 14px; cursor: pointer; }
.status-item .my-status-av { width: 46px; height: 46px; font-size: 18px; border: 2.5px solid var(--green); padding: 1px; box-sizing: content-box; }

.status-viewer { position: fixed; inset: 0; z-index: 9999; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 48px; cursor: pointer; }
.sv-text { font-size: 28px; color: #fff; text-align: center; max-width: 600px; }
.sv-meta { position: absolute; top: 24px; left: 24px; color: rgba(255,255,255,0.85); font-size: 14px; }

/* ── Settings ── */
.settings-hdr { background: var(--green3); }
.settings-hdr .hdr-back-btn { color: var(--text1); }
.settings-profile-hero { padding: 32px 16px; display: flex; align-items: center; gap: 16px; background: var(--surface); border-bottom: 1px solid var(--surface3); }
.settings-av { width: 76px; height: 76px; border-radius: 50%; background: var(--surface3); display: flex; align-items: center; justify-content: center; font-size: 30px; font-weight: 600; color: #fff; flex-shrink: 0; overflow: hidden; }
.settings-av img { width: 100%; height: 100%; object-fit: cover; }
.settings-profile-text { flex: 1; }
.settings-profile-text h2 { color: var(--text1); font-size: 19px; font-weight: 500; margin-bottom: 4px; }
.settings-profile-text p { font-size: 13px; color: var(--text2); }
.settings-profile-text .settings-bio-text { color: var(--text3); margin-top: 6px; }
.settings-edit-btn { width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--green); font-size: 17px; }
.settings-list { flex: 1; overflow-y: auto; padding: 8px 0 24px; }
.settings-item { display: flex; align-items: center; padding: 12px 16px; gap: 16px; cursor: pointer; transition: background var(--fast); }
.settings-item:hover { background: rgba(255,255,255,0.03); }
.sitem-icon { width: 42px; height: 42px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 17px; flex-shrink: 0; color: #fff; }
.sitem-icon.teal  { background: rgba(0,168,132,0.18); color: var(--green); }
.sitem-icon.green { background: var(--green); }
.sitem-icon.grey  { background: var(--surface3); color: var(--text2); }
.sitem-info span { display: block; color: var(--text1); font-size: 16px; font-weight: 400; }
.sitem-info small { color: var(--text3); font-size: 12.5px; }

/* ── Chat view ── */
.chat-view { position: absolute; inset: 0; display: flex; flex-direction: column; background: var(--bg); z-index: 50; transform: translateX(100%); transition: transform var(--med) var(--ease); }
.chat-view.open { transform: translateX(0); }

.cv-header { background: var(--surface); height: 58px; display: flex; align-items: center; padding: 0 6px 0 0; flex-shrink: 0; gap: 4px; z-index: 10; }
.cv-back { width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 19px; color: var(--text1); flex-shrink: 0; transition: background var(--fast); }
.cv-back:hover { background: rgba(255,255,255,0.06); }
.cv-avatar-wrap { position: relative; flex-shrink: 0; }
.cv-av { width: 42px; height: 42px; border-radius: 50%; background: var(--surface3); display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 600; color: #fff; cursor: pointer; overflow: hidden; }
.cv-av img { width: 100%; height: 100%; object-fit: cover; }
.cv-online-dot { position: absolute; bottom: 0; right: 0; width: 11px; height: 11px; border-radius: 50%; background: var(--green); border: 2px solid var(--surface); }
.cv-contact { flex: 1; overflow: hidden; cursor: pointer; padding-left: 8px; }
.cv-name { display: block; font-size: 16px; font-weight: 500; color: var(--text1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cv-status { font-size: 12.5px; color: var(--text2); }
.cv-status.online { color: var(--green); }
.cv-acts { display: flex; flex-shrink: 0; }
.cv-act { width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 18px; color: var(--text2); transition: background var(--fast); }
.cv-act:hover { background: rgba(255,255,255,0.06); }

.cv-messages { flex: 1; overflow-y: auto; padding: 8px 8px 4px; display: flex; flex-direction: column; gap: 2px; background-color: var(--bg); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='400' height='400' opacity='0.03'%3E%3Ctext x='20' y='40' font-size='20' fill='%2300A884'%3E%E2%99%A5 %E2%98%BA %E2%98%85%3C/text%3E%3Ctext x='80' y='220' font-size='14' fill='%2300A884'%3E%E2%98%85 %E2%9C%A6%3C/text%3E%3C/svg%3E"); }
.cv-messages::-webkit-scrollbar { width: 2px; }
.cv-messages::-webkit-scrollbar-thumb { background: var(--surface3); }

.encrypt-notice { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 8px auto; background: rgba(17,27,33,0.85); border: 1px solid rgba(42,57,66,0.8); color: var(--text3); font-size: 12px; padding: 7px 14px; border-radius: 8px; max-width: 90%; text-align: center; line-height: 1.5; }
.encrypt-notice i { font-size: 11px; flex-shrink: 0; }

.chat-date-sep { text-align: center; margin: 8px 0; }
.chat-date-sep span { display: inline-block; background: rgba(17,27,33,0.85); border: 1px solid var(--surface3); color: var(--text3); font-size: 12px; padding: 4px 12px; border-radius: 8px; }

/* Bubbles */
.msg-row { display: flex; align-items: flex-end; margin: 1px 0; }
.msg-row.out { justify-content: flex-end; padding-right: 2px; }
.msg-row.in  { justify-content: flex-start; padding-left: 2px; }
.msg-bubble { max-width: 72%; position: relative; word-break: break-word; }
.msg-row.out .msg-bubble::after { content: ''; position: absolute; top: 0; right: -7px; width: 0; height: 0; border-left: 8px solid var(--bubble-out); border-top: 8px solid transparent; }
.msg-row.in  .msg-bubble::after { content: ''; position: absolute; top: 0; left: -7px; width: 0; height: 0; border-right: 8px solid var(--bubble-in); border-top: 8px solid transparent; }
.msg-row.out.no-tail .msg-bubble::after, .msg-row.in.no-tail .msg-bubble::after { display: none; }
.msg-bubble-inner { padding: 7px 10px 20px; border-radius: 8px; position: relative; min-width: 80px; }
.msg-row.out .msg-bubble-inner { background: var(--bubble-out); border-top-right-radius: 2px; }
.msg-row.in  .msg-bubble-inner { background: var(--bubble-in); border-top-left-radius: 2px; }

.msg-sender { font-size: 12.5px; font-weight: 600; color: var(--green); margin-bottom: 2px; display: block; }
.msg-text { font-size: 15px; color: var(--text1); line-height: 1.45; white-space: pre-wrap; }

.msg-meta { position: absolute; bottom: 4px; right: 8px; display: flex; align-items: center; gap: 3px; pointer-events: none; }
.msg-time { font-size: 11px; color: rgba(233,238,239,0.55); }
.msg-row.in .msg-time { color: var(--text3); }
.msg-ticks { font-size: 12px; }
.msg-ticks.sent      { color: rgba(233,238,239,0.55); }
.msg-ticks.delivered { color: rgba(233,238,239,0.55); }
.msg-ticks.read      { color: var(--tick-blue); }

.msg-reply-quote { background: rgba(0,0,0,0.2); border-left: 3px solid var(--green); border-radius: 4px; padding: 5px 8px; margin-bottom: 4px; font-size: 12.5px; overflow: hidden; }
.msg-reply-quote .rq-sender { color: var(--green); font-weight: 600; font-size: 12px; margin-bottom: 2px; display: block; }
.msg-reply-quote .rq-text   { color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }

.msg-reactions { display: flex; gap: 3px; flex-wrap: wrap; margin-top: 2px; justify-content: flex-end; }
.msg-row.in .msg-reactions { justify-content: flex-start; }
.react-chip { background: var(--surface); border: 1px solid var(--surface3); border-radius: 12px; padding: 2px 6px; font-size: 13px; display: flex; align-items: center; gap: 3px; cursor: pointer; }
.react-chip span { font-size: 11px; color: var(--text2); }

.msg-image { max-width: 240px; width: 100%; border-radius: 6px; display: block; cursor: pointer; margin-bottom: 2px; }
.msg-doc { display: flex; align-items: center; gap: 10px; background: rgba(0,0,0,0.15); border-radius: 8px; padding: 10px; margin-bottom: 2px; cursor: pointer; min-width: 200px; color: inherit; text-decoration: none; }
.msg-doc-icon { font-size: 30px; color: var(--green); flex-shrink: 0; }
.msg-doc-info span { display: block; font-size: 13.5px; font-weight: 500; color: var(--text1); max-width: 160px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-doc-info small { font-size: 11.5px; color: var(--text2); }
.msg-location { display: block; border-radius: 8px; overflow: hidden; margin-bottom: 2px; cursor: pointer; min-width: 200px; color: inherit; }
.msg-location-map { background: linear-gradient(135deg, #1a3a2a, #0d2b1f); height: 100px; display: flex; align-items: center; justify-content: center; }
.msg-location-pin { font-size: 32px; }
.msg-location-label { padding: 6px 10px; background: rgba(0,0,0,0.2); font-size: 12.5px; color: var(--text2); }

audio { max-width: 240px; }

.image-viewer { position: fixed; inset: 0; background: #000; z-index: 9999; display: flex; align-items: center; justify-content: center; cursor: zoom-out; }
.image-viewer img { max-width: 100%; max-height: 100%; object-fit: contain; }

/* Reply bar */
.reply-bar { background: var(--surface2); border-top: 1px solid var(--surface3); display: flex; align-items: center; padding: 8px 12px; gap: 10px; flex-shrink: 0; }
.reply-content { flex: 1; display: flex; gap: 8px; background: rgba(0,0,0,0.2); border-radius: 8px; padding: 6px 8px; overflow: hidden; }
.reply-stripe { width: 3px; border-radius: 2px; background: var(--green); flex-shrink: 0; }
.reply-inner { flex: 1; overflow: hidden; }
.reply-sender { font-size: 12.5px; font-weight: 600; color: var(--green); display: block; margin-bottom: 2px; }
.reply-text   { font-size: 13px; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.reply-close { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 16px; color: var(--text3); flex-shrink: 0; }

/* Typing indicator */
.typing-indicator { display: flex; align-items: center; gap: 8px; padding: 4px 16px; background: var(--surface); color: var(--text2); font-size: 13px; }
.typing-dots { display: flex; gap: 3px; }
.typing-dots span { width: 6px; height: 6px; border-radius: 50%; background: var(--text2); animation: typing-bounce 1s infinite; }
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing-bounce { 0%,60%,100% { transform: scale(0.8); opacity: 0.5; } 30% { transform: scale(1); opacity: 1; } }

/* Input bar */
.cv-input-bar { background: var(--surface2); padding: 8px 8px; display: flex; align-items: flex-end; gap: 8px; flex-shrink: 0; }
.cv-input-pill { flex: 1; background: var(--surface); border-radius: 26px; display: flex; align-items: flex-end; min-height: 46px; padding: 4px 4px; }
.cv-pill-btn { width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 21px; color: var(--text3); flex-shrink: 0; transition: color var(--fast); }
.cv-pill-btn:hover { color: var(--text2); }
.cv-input-wrap { flex: 1; padding: 5px 4px; max-height: 120px; overflow-y: auto; }
.cv-input-wrap::-webkit-scrollbar { width: 2px; }
.cv-input-wrap input { width: 100%; font-size: 15.5px; caret-color: var(--green); resize: none; line-height: 1.5; }
.cv-input-wrap input::placeholder { color: var(--text3); }

.recording-row { display: flex; align-items: center; gap: 8px; padding: 5px 0; height: 30px; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--red); animation: blink 1s ease-in-out infinite; }
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0.3} }
.rec-txt { font-size: 14px; color: var(--text2); }

.cv-mic-send { width: 50px; height: 50px; border-radius: 50%; flex-shrink: 0; background: var(--green); color: #fff; font-size: 20px; display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 12px rgba(0,168,132,0.4); transition: all var(--fast) var(--ease); }
.cv-mic-send:hover  { background: var(--green2); transform: scale(1.04); }
.cv-mic-send.recording { background: var(--red); }

/* Attach tray */
.attach-tray { background: var(--surface2); border-top: 1px solid var(--surface3); padding: 16px 12px; flex-shrink: 0; animation: trayUp var(--fast) var(--ease); }
@keyframes trayUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.tray-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.tray-item { display: flex; flex-direction: column; align-items: center; gap: 7px; }
.tray-icon { width: 54px; height: 54px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 22px; color: #fff; transition: transform var(--fast); }
.tray-item:hover .tray-icon { transform: scale(1.08); }
.tray-item span { font-size: 12px; color: var(--text2); }

/* React panel & msg ctx */
.react-panel { position: fixed; z-index: 200; background: var(--surface); border-radius: 30px; padding: 6px 10px; box-shadow: 0 4px 20px rgba(0,0,0,0.5); animation: reactIn var(--fast) var(--ease); }
@keyframes reactIn { from { transform: scale(0.8); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.react-row { display: flex; gap: 4px; }
.react-btn { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 22px; transition: transform var(--fast); }
.react-btn:hover { transform: scale(1.25); }

.msg-ctx-menu { position: fixed; z-index: 300; background: var(--surface); border-radius: 8px; min-width: 180px; box-shadow: 0 6px 24px rgba(0,0,0,0.55); animation: menuIn var(--fast) var(--ease); overflow: hidden; }

/* Bottom nav */
.bot-nav { position: absolute; bottom: 0; left: 0; right: 0; height: 60px; background: var(--surface); border-top: 1px solid var(--surface3); display: flex; align-items: stretch; z-index: 40; }
.bnav { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; cursor: pointer; color: var(--text3); font-size: 11px; font-weight: 500; transition: color var(--fast); position: relative; }
.bnav.active { color: var(--green); }
.bnav-icon-w { position: relative; font-size: 21px; display: flex; align-items: center; justify-content: center; }
.bnav-badge { position: absolute; top: -5px; right: -9px; background: var(--green); color: #111; font-size: 10px; font-weight: 700; min-width: 17px; height: 17px; border-radius: 9px; display: flex; align-items: center; justify-content: center; padding: 0 3px; }

/* Calls */
.calls-list { flex: 1; overflow-y: auto; }
.calls-empty { padding-top: 32px; }
.call-link-row { display: flex; align-items: center; gap: 12px; padding: 14px 16px; cursor: pointer; }
.call-link-av { width: 46px; height: 46px; border-radius: 50%; background: var(--green); display: flex; align-items: center; justify-content: center; color: #fff; font-size: 18px; }

/* Modal */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.55); z-index: 500; display: flex; align-items: stretch; justify-content: center; }
.modal-card { background: var(--bg); width: 100%; max-width: 540px; display: flex; flex-direction: column; height: 100%; }
.modal-hdr { background: var(--surface); height: 56px; display: flex; align-items: center; padding: 0 8px; gap: 8px; }
.modal-title { flex: 1; font-size: 18px; font-weight: 500; color: var(--text1); }

.search-input-wrap { flex: 1; }
.search-input-wrap input { width: 100%; padding: 8px 12px; font-size: 16px; color: var(--text1); background: transparent; border-bottom: 1px solid var(--surface3); }
.search-results { flex: 1; overflow-y: auto; padding: 8px 0; }
.search-result { display: flex; align-items: center; padding: 10px 16px; gap: 14px; cursor: pointer; transition: background var(--fast); }
.search-result:hover { background: rgba(255,255,255,0.04); }
.sr-av { width: 46px; height: 46px; border-radius: 50%; overflow: hidden; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.sr-av span { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 19px; font-weight: 600; color: #fff; }
.sr-av img  { width: 100%; height: 100%; object-fit: cover; }
.sr-info { flex: 1; }
.sr-name { font-size: 16px; font-weight: 500; color: var(--text1); }
.sr-handle { font-size: 13px; color: var(--text3); }
.sr-btn { width: 38px; height: 38px; border-radius: 50%; background: rgba(0,168,132,0.15); color: var(--green); display: flex; align-items: center; justify-content: center; font-size: 15px; }
.sr-btn.sel { background: var(--green); color: #fff; }

.group-form { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.group-form input { padding: 10px 4px; font-size: 16px; border-bottom: 1px solid var(--surface3); }
.group-selected { display: flex; flex-wrap: wrap; gap: 6px; min-height: 4px; }
.group-chip { display: flex; align-items: center; gap: 6px; background: rgba(0,168,132,0.18); color: var(--green); padding: 5px 10px; border-radius: 16px; font-size: 13px; }
.group-chip button { color: inherit; }
.group-suggestions { flex: 1; overflow-y: auto; }

.status-composer .status-canvas { flex: 1; padding: 24px; display: flex; align-items: center; justify-content: center; background: #075E54; transition: background 0.2s; }
.status-composer textarea { width: 100%; height: 100%; max-width: 600px; background: transparent; font-size: 24px; color: #fff; text-align: center; line-height: 1.4; resize: none; }
.status-composer textarea::placeholder { color: rgba(255,255,255,0.55); }
.status-bg-row { display: flex; gap: 8px; padding: 12px 16px; background: var(--surface); justify-content: center; }
.status-bg { width: 32px; height: 32px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.15); cursor: pointer; }

/* Calling overlay */
.calling-overlay { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,0.95); }
.calling-bg { position: absolute; inset: 0; background: linear-gradient(135deg, #075E54, #00A884); opacity: 0.35; }
.calling-inner { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 32px; }
.calling-av { width: 130px; height: 130px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 52px; color: #fff; font-weight: 700; }
.calling-inner h2 { font-size: 24px; color: #fff; font-weight: 500; }
.calling-inner p { font-size: 15px; color: rgba(255,255,255,0.75); }
.call-videos { position: fixed; inset: 0; z-index: -1; }
.call-videos video { width: 100%; height: 100%; object-fit: cover; position: absolute; }
#local-video { width: 110px !important; height: 156px; right: 16px; bottom: 100px; border-radius: 10px; border: 2px solid rgba(255,255,255,0.3); object-fit: cover; }
.calling-btns { margin-top: 28px; }
.call-main-row { display: flex; gap: 32px; }
.call-btn { width: 64px; height: 64px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 22px; color: #fff; box-shadow: 0 4px 16px rgba(0,0,0,0.45); transition: transform var(--fast); }
.call-btn:active { transform: scale(0.93); }
.call-btn.accept { background: var(--green); }
.call-btn.mute   { background: var(--surface3); }
.call-btn.end    { background: var(--red); }

/* Toast */
.toast-container { position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%); z-index: 9999; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { background: var(--surface); color: var(--text1); padding: 11px 18px; border-radius: 24px; font-size: 14px; box-shadow: 0 4px 20px rgba(0,0,0,0.55); animation: toastIn var(--fast) var(--ease); }
.toast.fadeout { animation: toastOut var(--fast) var(--ease) forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(10px); } }

/* Desktop tweaks */
@media (min-width: 900px) {
    .app-shell { max-width: 1100px; margin: 0 auto; box-shadow: 0 0 60px rgba(0,0,0,0.4); }
    .ob-inner  { padding-top: 24px; }
}


/* Native Google button (Android shell) */
.native-g-btn {
    display: inline-flex; align-items: center; gap: 12px;
    background: #131314; color: #e3e3e3;
    padding: 12px 22px; border-radius: 999px;
    font-size: 15px; font-weight: 500;
    border: 1px solid #8e918f33;
    cursor: pointer; transition: background 0.18s;
}
.native-g-btn:hover { background: #1f1f1f; }
.native-g-btn:disabled { opacity: 0.6; cursor: wait; }
.native-g-btn .g-logo {
    width: 20px; height: 20px; display: inline-block;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'%3E%3Cpath fill='%23FFC107' d='M43.6 20.5H42V20H24v8h11.3c-1.6 4.6-6 8-11.3 8-6.6 0-12-5.4-12-12s5.4-12 12-12c3.1 0 5.8 1.2 7.9 3.1l5.7-5.7C34.5 6.4 29.5 4.4 24 4.4 12.7 4.4 3.6 13.6 3.6 24.9S12.7 45.4 24 45.4 44.4 36.2 44.4 24.9c0-1.5-.2-2.9-.4-4.4z'/%3E%3Cpath fill='%23FF3D00' d='M6.3 14.7l6.6 4.8C14.6 16.1 19 13 24 13c3.1 0 5.8 1.2 7.9 3.1l5.7-5.7C34 7.4 29 5.4 24 5.4c-7.5 0-13.9 4.4-17 10.7z'/%3E%3Cpath fill='%234CAF50' d='M24 45.4c5.5 0 10.4-2.1 14-5.5l-6.4-5.4c-2 1.4-4.6 2.3-7.6 2.3-5.3 0-9.7-3.4-11.3-8.1l-6.5 5C9.6 40.7 16.2 45.4 24 45.4z'/%3E%3Cpath fill='%231976D2' d='M43.6 20.5H42V20H24v8h11.3c-.7 2.1-2 3.9-3.7 5.3l6.4 5.4c-.4.4 6.7-4.9 6.7-14.2 0-1.5-.2-2.9-.4-4z'/%3E%3C/svg%3E") center/contain no-repeat;
}
