/* =====================================================================
   MosesZT Chat - WhatsApp-style UI (light + dark), mobile-first
   ===================================================================== */
:root {
    --brand: #00a884;
    --brand-dark: #008069;
    --brand-deep: #005c4b;
    --brand-soft: #d9fdd3;
    --accent: #25d366;
    --bg: #f0f2f5;
    --panel: #ffffff;
    --panel-2: #f7f8fa;
    --header: #ffffff;
    --text: #111b21;
    --text-2: #54656f;
    --muted: #8696a0;
    --line: #e9edef;
    --hover: #f5f6f6;
    --active: #f0f2f5;
    --chat-bg: #efeae2;
    --bubble-in: #ffffff;
    --bubble-out: #d9fdd3;
    --bubble-text: #111b21;
    --tick: #8696a0;
    --tick-read: #53bdeb;
    --danger: #ea0038;
    --warn: #f59e0b;
    --info: #3b82f6;
    --ring-new: #25d366;
    --ring-seen: #bfc6ca;
    --shadow-1: 0 1px 2px rgba(11, 20, 26, .08);
    --shadow-2: 0 6px 24px rgba(11, 20, 26, .14);
    --shadow-3: 0 18px 50px rgba(11, 20, 26, .22);
    --radius: 14px;
    --app-h: 100vh;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --emoji-font: "Noto Color Emoji", "Apple Color Emoji", "Segoe UI Emoji", sans-serif;
    --font: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", "Noto Sans", Arial, "Noto Color Emoji", sans-serif;
    --msg-size: 14.6px;
    color-scheme: light;
}
html.dark-theme {
    --brand: #00a884;
    --brand-dark: #00a884;
    --brand-soft: #005c4b;
    --bg: #0b141a;
    --panel: #111b21;
    --panel-2: #182229;
    --header: #202c33;
    --text: #e9edef;
    --text-2: #aebac1;
    --muted: #8696a0;
    --line: #222d34;
    --hover: #202c33;
    --active: #2a3942;
    --chat-bg: #0b141a;
    --bubble-in: #202c33;
    --bubble-out: #005c4b;
    --bubble-text: #e9edef;
    --tick: #8696a0;
    --ring-seen: #3b4a54;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-2: 0 6px 24px rgba(0, 0, 0, .45);
    --shadow-3: 0 18px 50px rgba(0, 0, 0, .55);
    color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; overscroll-behavior: none; }
body { font-family: var(--font); background: var(--bg); color: var(--text); font-size: 15px; -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; padding: 0; }
a { color: var(--brand-dark); }
img { max-width: 100%; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.pad { padding: 12px 16px; margin: 0; }
.row-gap { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.print-only { display: none; }

/* ---------- icons ---------- */
.ic { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.icon-svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: var(--text-2); transition: background .15s, color .15s; position: relative; flex-shrink: 0; }
.icon-btn:hover { background: var(--hover); }
.icon-btn:active { background: var(--active); }
.icon-btn.sm { width: 32px; height: 32px; }
.icon-btn.sm .ic { width: 18px; height: 18px; }
.icon-btn.active { color: var(--brand); }
.icon-btn.light { color: #fff; }
.icon-btn.light:hover { background: rgba(255,255,255,.12); }

/* ---------- buttons / inputs ---------- */
.btn-primary { background: var(--brand-dark); color: #fff; border: none; padding: 11px 18px; border-radius: 999px; font-weight: 600; font-size: 14.5px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; transition: filter .15s, transform .1s; }
.btn-primary:hover { filter: brightness(1.07); }
.btn-primary:active { transform: scale(.98); }
.btn-primary:disabled { opacity: .6; }
.btn-secondary { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); padding: 10px 16px; border-radius: 999px; font-weight: 500; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn-secondary:hover { background: var(--hover); }
.btn-primary.sm, .btn-secondary.sm { padding: 7px 14px; font-size: 13px; }
.btn-primary.sm .ic, .btn-secondary.sm .ic { width: 16px; height: 16px; }
.btn-block { background: #fde8ea; color: var(--danger); border: none; padding: 8px 14px; border-radius: 999px; font-weight: 600; }
.btn-approve { background: #d9fdd3; color: #1e7e34; border: none; padding: 8px 14px; border-radius: 999px; font-weight: 600; }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=search], input[type=datetime-local], textarea, select {
    width: 100%; padding: 11px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); color: var(--text); outline: none; font-size: 15px; transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus, select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(0,168,132,.15); }
textarea { resize: vertical; min-height: 70px; }
.select-sm { width: auto; max-width: 150px; padding: 6px 10px; font-size: 13.5px; border-radius: 10px; }
.field-label { display: block; font-size: 12.5px; color: var(--brand-dark); font-weight: 600; margin: 12px 0 4px; text-align: left; }

/* toggle switch */
.switch { appearance: none; -webkit-appearance: none; width: 42px; height: 24px; border-radius: 999px; background: #c4cdd2; position: relative; cursor: pointer; transition: background .2s; flex-shrink: 0; margin: 0; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .2s; }
.switch:checked { background: var(--brand); }
.switch:checked::after { transform: translateX(18px); }
html.dark-theme .switch { background: #3b4a54; }
html.dark-theme .switch:checked { background: var(--brand); }

/* spinner */
.spin { display: inline-block; width: 18px; height: 18px; border: 2.4px solid rgba(134,150,160,.35); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: middle; }
.spin.center { display: block; margin: 30px auto; width: 28px; height: 28px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* =====================================================================
   AUTH PAGES
   ===================================================================== */
body:has(.auth-wrapper) { overflow: auto; }
.auth-wrapper { min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; background: radial-gradient(1200px 600px at 10% -10%, #25d36633, transparent), linear-gradient(160deg, #008069 0%, #005c4b 55%, #0b141a 100%); }
.auth-box { background: var(--panel); padding: 34px 28px 26px; border-radius: 22px; width: 100%; max-width: 380px; text-align: center; box-shadow: var(--shadow-3); animation: popIn .35s ease; }
.auth-logo { width: 72px; height: 72px; margin: 0 auto 12px; border-radius: 22px; background: linear-gradient(135deg, #25d366, #008069); display: flex; align-items: center; justify-content: center; font-size: 34px; box-shadow: 0 10px 24px rgba(0,128,105,.35); color: #fff; }
.auth-box h2 { margin: 0 0 4px; font-size: 22px; }
.auth-sub { color: var(--muted); margin: 0 0 20px; font-size: 14px; }
.auth-box form { display: flex; flex-direction: column; gap: 12px; text-align: left; }
.auth-box .btn-primary { margin-top: 6px; padding: 13px; font-size: 15.5px; }
.auth-error { background: #fde8ea; color: #b4002d; padding: 10px 12px; border-radius: 12px; font-size: 13.5px; margin-bottom: 14px; text-align: left; }
.auth-success { background: #d9fdd3; color: #136c2e; padding: 10px 12px; border-radius: 12px; font-size: 13.5px; margin-bottom: 14px; text-align: left; }
.auth-switch { font-size: 14px; color: var(--muted); margin-top: 18px; }
.auth-note { font-size: 12px; color: var(--muted); margin-top: 14px; display: flex; gap: 6px; align-items: center; justify-content: center; }
.auth-note .ic { width: 14px; height: 14px; }
.pw-wrap { position: relative; }
.pw-wrap button { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); color: var(--muted); }

/* =====================================================================
   APP LAYOUT
   ===================================================================== */
.app { position: fixed; inset: 0; height: var(--app-h); display: flex; background: var(--bg); overflow: hidden; }
@supports (height: 100dvh) { .app { height: min(var(--app-h), 100dvh); } }

/* ---------- desktop rail ---------- */
.rail { width: 64px; background: var(--panel-2); border-right: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; padding: 12px 0; gap: 6px; flex-shrink: 0; z-index: 3; }
.rail-logo { width: 42px; height: 42px; border-radius: 13px; background: linear-gradient(135deg, #25d366, #008069); color: #fff; display: flex; align-items: center; justify-content: center; margin-bottom: 10px; box-shadow: 0 6px 16px rgba(0,128,105,.3); }
.rail-logo .ic { width: 30px; height: 30px; stroke-width: 2.4; color: #fff; }
.rail-btn { width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--text-2); position: relative; transition: background .15s; }
.rail-btn:hover { background: var(--hover); }
.rail-btn.active { background: var(--active); color: var(--text); }
.rail-btn.active::before { content: ""; position: absolute; left: -10px; top: 12px; bottom: 12px; width: 3px; border-radius: 0 3px 3px 0; background: var(--brand); }
.rail-spacer { flex: 1; }
.rail-badge { position: absolute; top: 2px; right: 0; min-width: 18px; height: 18px; border-radius: 9px; background: var(--brand); color: #fff; font-size: 10.5px; font-weight: 700; display: none; align-items: center; justify-content: center; padding: 0 5px; }
.rail-badge.on { display: flex; }
.nav-dot { position: absolute; top: 6px; right: 6px; width: 9px; height: 9px; border-radius: 50%; background: var(--brand); display: none; border: 2px solid var(--panel-2); }
.nav-dot.on { display: block; }

/* ---------- sidebar ---------- */
.sidebar { width: 410px; min-width: 330px; max-width: 42vw; background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; position: relative; z-index: 2; }
.side-header { display: flex; align-items: center; gap: 10px; padding: calc(10px + var(--safe-top)) 10px 6px 16px; background: var(--panel); }
.side-header .me { display: none; cursor: pointer; }
.section-title { font-size: 22px; font-weight: 700; margin: 0; flex: 1; letter-spacing: -.2px; }
.header-actions { display: flex; align-items: center; gap: 2px; position: relative; }
.badge-dot { position: absolute; top: 8px; right: 8px; width: 9px; height: 9px; border-radius: 50%; background: var(--danger); border: 2px solid var(--panel); }

.search-box { display: flex; align-items: center; gap: 10px; margin: 4px 12px 8px; padding: 0 12px; background: var(--panel-2); border-radius: 12px; height: 40px; color: var(--muted); border: 1px solid transparent; }
html.dark-theme .search-box { background: var(--header); }
.search-box:focus-within { border-color: var(--brand); background: var(--panel); }
.search-box .ic { width: 18px; height: 18px; }
.search-box input { border: none; background: transparent; padding: 0; height: 100%; box-shadow: none !important; font-size: 14.5px; }
.search-box input::-webkit-search-cancel-button { display: none; }
.search-box.in-sheet { margin: 4px 0 10px; }

.filter-chips { display: flex; gap: 8px; padding: 2px 12px 8px; overflow-x: auto; scrollbar-width: none; }
.filter-chips::-webkit-scrollbar { display: none; }
.chip { padding: 6px 14px; border-radius: 999px; background: var(--panel-2); color: var(--text-2); font-size: 13.5px; font-weight: 500; white-space: nowrap; border: 1px solid var(--line); display: inline-flex; gap: 5px; align-items: center; transition: all .15s; }
html.dark-theme .chip { background: var(--header); border-color: transparent; }
.chip.active { background: #e7fce3; color: #008069; border-color: transparent; }
html.dark-theme .chip.active { background: #0a332c; color: #00a884; }
.chip span:empty { display: none; }
.chip span { font-size: 11px; background: var(--brand); color: #fff; border-radius: 9px; padding: 0 6px; }

.notif-banner { display: flex; align-items: center; gap: 10px; margin: 4px 12px 8px; padding: 10px 12px; border-radius: 14px; background: linear-gradient(135deg, #e7fce3, #d1f4ff); color: #0b3b33; }
html.dark-theme .notif-banner { background: linear-gradient(135deg, #0a332c, #0b2a3a); color: #e9edef; }
.notif-banner > .ic { color: var(--brand-dark); }
.notif-banner div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.notif-banner b { font-size: 13.5px; }
.notif-banner span { font-size: 12px; opacity: .8; }

.panels { flex: 1; position: relative; overflow: hidden; }
.panel { position: absolute; inset: 0; overflow-y: auto; overflow-x: hidden; padding-bottom: 90px; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.slide-in-right { animation: slideR .22s ease; }
.slide-in-left { animation: slideL .22s ease; }
@keyframes slideR { from { transform: translateX(18%); opacity: .3; } to { transform: none; opacity: 1; } }
@keyframes slideL { from { transform: translateX(-18%); opacity: .3; } to { transform: none; opacity: 1; } }
.pull-indicator { position: absolute; left: 50%; top: 6px; z-index: 9; width: 38px; height: 38px; border-radius: 50%; background: var(--panel); box-shadow: var(--shadow-2); display: flex; align-items: center; justify-content: center; color: var(--brand); pointer-events: none; }

/* ---------- chat list ---------- */
.chat-item { display: flex; align-items: center; gap: 13px; padding: 9px 14px; cursor: pointer; position: relative; transition: background .12s; user-select: none; -webkit-user-select: none; }
.chat-item:hover { background: var(--hover); }
.chat-item.active { background: var(--active); }
.chat-item-info { flex: 1; min-width: 0; padding: 4px 0; border-bottom: 1px solid var(--line); }
.chat-item:last-child .chat-item-info { border-bottom-color: transparent; }
.chat-item-top, .chat-item-bottom { display: flex; align-items: center; gap: 8px; }
.chat-item-name { flex: 1; font-size: 16px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.chat-item-time { font-size: 12px; color: var(--muted); white-space: nowrap; }
.chat-item.unread .chat-item-time { color: var(--accent); font-weight: 600; }
.chat-item-bottom { margin-top: 2px; }
.chat-item-last { flex: 1; font-size: 13.8px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 3px; min-height: 20px; }
.chat-item-last .tick { width: 17px; height: 17px; color: var(--tick); flex-shrink: 0; }
.chat-item-last .tick.read { color: var(--tick-read); }
.chat-item-meta { display: flex; align-items: center; gap: 6px; }
.chat-item-meta .muted-ic { width: 16px; height: 16px; color: var(--muted); }
.typing-text { color: var(--accent); font-weight: 500; font-style: italic; }
.draft-text { color: var(--danger); font-weight: 600; }
.sender-prefix { font-weight: 500; color: var(--text-2); }
.unread-badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--accent); color: #fff; font-size: 11.5px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
html.dark-theme .unread-badge { color: #111b21; }
.unread-badge.muted { background: var(--muted); }
.list-section-title { padding: 14px 18px 6px; font-size: 13px; font-weight: 600; color: var(--brand-dark); text-transform: none; letter-spacing: .2px; }
.empty-list { padding: 50px 30px; text-align: center; color: var(--muted); font-size: 14.5px; line-height: 1.5; }
.empty-list .ic { width: 52px; height: 52px; display: block; margin: 0 auto 12px; color: var(--ring-seen); stroke-width: 1.4; }
.offline-note { display: flex; gap: 8px; align-items: center; justify-content: center; font-size: 12.5px; color: #8a6d00; background: #fff6d6; padding: 7px; }
html.dark-theme .offline-note { background: #3a3000; color: #ffd75e; }
.offline-note .ic { width: 15px; height: 15px; }
.picker-action { display: flex; align-items: center; gap: 13px; padding: 10px 14px; width: 100%; text-align: left; font-size: 15.5px; font-weight: 500; }
.picker-action:hover { background: var(--hover); }
.row-action { color: var(--brand-dark); }
.admin-pill { font-size: 11px; color: var(--brand-dark); background: #e7fce3; border-radius: 6px; padding: 2px 7px; font-weight: 600; }
html.dark-theme .admin-pill { background: #0a332c; color: var(--brand); }

/* skeleton */
.chat-item.skeleton .avatar { background: var(--line); animation: pulse 1.2s infinite; }
.chat-item.skeleton i { display: block; height: 11px; border-radius: 6px; background: var(--line); margin: 6px 0; animation: pulse 1.2s infinite; }
.chat-item.skeleton i:first-child { width: 45%; }
.chat-item.skeleton i:last-child { width: 75%; }
@keyframes pulse { 50% { opacity: .45; } }

/* ---------- avatars ---------- */
.avatar-wrap { position: relative; flex-shrink: 0; display: inline-flex; }
.avatar { width: 49px; height: 49px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 17px; color: #fff; background: #8696a0; overflow: hidden; flex-shrink: 0; position: relative; user-select: none; letter-spacing: .3px; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar .ic { width: 55%; height: 55%; stroke-width: 1.6; }
.avatar.xs { width: 26px; height: 26px; font-size: 11px; }
.avatar.sm { width: 38px; height: 38px; font-size: 14px; }
.avatar.lg { width: 64px; height: 64px; font-size: 22px; }
.avatar.xl { width: 120px; height: 120px; font-size: 40px; }
.avatar[data-hue="1"] { background: linear-gradient(135deg, #34d399, #059669); }
.avatar[data-hue="2"] { background: linear-gradient(135deg, #60a5fa, #2563eb); }
.avatar[data-hue="3"] { background: linear-gradient(135deg, #f472b6, #db2777); }
.avatar[data-hue="4"] { background: linear-gradient(135deg, #fbbf24, #d97706); }
.avatar[data-hue="5"] { background: linear-gradient(135deg, #a78bfa, #7c3aed); }
.avatar[data-hue="6"] { background: linear-gradient(135deg, #22d3ee, #0891b2); }
.avatar[data-hue="7"] { background: linear-gradient(135deg, #fb7185, #e11d48); }
.avatar[data-hue="8"] { background: linear-gradient(135deg, #a3e635, #4d7c0f); }
.avatar.group-av { background: linear-gradient(135deg, #94a3b8, #64748b); }
html.dark-theme .avatar.group-av { background: linear-gradient(135deg, #475569, #334155); }
.online-dot { position: absolute; right: 1px; bottom: 1px; width: 13px; height: 13px; border-radius: 50%; background: var(--accent); border: 2.5px solid var(--panel); }
.avatar-add { position: absolute; right: -2px; bottom: -2px; width: 20px; height: 20px; border-radius: 50%; background: var(--brand); color: #fff; display: flex; align-items: center; justify-content: center; border: 2px solid var(--panel); }
.avatar-add .ic { width: 12px; height: 12px; stroke-width: 3; }
.story-ring { position: absolute; inset: -4px; width: calc(100% + 8px); height: calc(100% + 8px); pointer-events: none; }
.status-entry .avatar-wrap, #myStatusItem .avatar-wrap { margin: 3px; }

/* ---------- bottom nav (mobile) ---------- */
.bottom-nav { display: none; }
.fab { position: absolute; right: 18px; bottom: 22px; width: 56px; height: 56px; border-radius: 17px; background: var(--brand); color: #fff; display: flex; align-items: center; justify-content: center; box-shadow: 0 6px 18px rgba(0,128,105,.4); z-index: 5; transition: transform .15s; }
html.dark-theme .fab { color: #111b21; }
.fab:active { transform: scale(.93); }
.fab .ic { width: 25px; height: 25px; }
.fab.mini { width: 42px; height: 42px; border-radius: 13px; bottom: 88px; right: 25px; background: var(--panel); color: var(--text-2); box-shadow: var(--shadow-2); }
.fab.mini .ic { width: 20px; height: 20px; }

/* ---------- dropdown ---------- */
.dropdown { position: fixed; z-index: 200; background: var(--panel); border-radius: 14px; box-shadow: var(--shadow-3); padding: 6px 0; min-width: 220px; flex-direction: column; animation: popIn .14s ease; border: 1px solid var(--line); }
.dd-item { display: flex; align-items: center; gap: 14px; padding: 11px 18px; font-size: 14.5px; text-align: left; color: var(--text); text-decoration: none; width: 100%; }
.dd-item:hover { background: var(--hover); }
.dd-item .ic { width: 20px; height: 20px; color: var(--text-2); }
.dd-item.danger, .dd-item.danger .ic { color: var(--danger); }

/* =====================================================================
   CHAT AREA
   ===================================================================== */
.chat-area { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--chat-bg); position: relative; }
.empty-state { flex: 1; overflow-y: auto; background: var(--panel-2); }
html.dark-theme .empty-state { background: #0f1a20; }
.chat-window { flex: 1; display: flex; flex-direction: column; min-height: 0; position: relative; }
.chat-window.drop-hover::after { content: "Yahan chhoren - file bhej di jayegi"; position: absolute; inset: 10px; border: 3px dashed var(--brand); border-radius: 18px; display: flex; align-items: center; justify-content: center; background: rgba(0,168,132,.12); color: var(--brand-dark); font-weight: 600; z-index: 30; }

.chat-header { display: flex; align-items: center; gap: 6px; padding: calc(8px + var(--safe-top)) 8px 8px 8px; background: var(--header); border-bottom: 1px solid var(--line); z-index: 5; min-height: 60px; }
.back-btn { display: none; }
.chat-header-info { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; cursor: pointer; padding: 2px 6px; border-radius: 10px; }
.chat-header-info .avatar { width: 42px; height: 42px; font-size: 15px; }
.chat-header-text { min-width: 0; }
.chat-title { font-weight: 600; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-subtitle { font-size: 12.8px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 16px; }
.chat-header-actions { display: flex; align-items: center; gap: 2px; position: relative; }

.chat-search-bar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--header); border-bottom: 1px solid var(--line); color: var(--muted); }
.chat-search-bar input { border: none; background: transparent; box-shadow: none !important; padding: 6px 0; }
.chat-search-results { max-height: 45%; overflow-y: auto; background: var(--panel); border-bottom: 1px solid var(--line); z-index: 4; }
.search-result-item { padding: 10px 16px; border-bottom: 1px solid var(--line); cursor: pointer; font-size: 14px; }
.search-result-item:hover { background: var(--hover); }
.search-result-item small { color: var(--muted); display: block; margin-bottom: 2px; }
mark { background: #fff59d; color: inherit; border-radius: 3px; padding: 0 1px; }

/* wallpaper */
.messages-wrap { flex: 1; position: relative; min-height: 0; }
.messages-container {
    position: absolute; inset: 0; overflow-y: auto; overflow-x: hidden; padding: 12px 6% 16px; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
    background-color: var(--chat-bg);
    background-image:
        radial-gradient(circle at 20px 20px, rgba(0,0,0,.035) 2px, transparent 2.5px),
        radial-gradient(circle at 60px 50px, rgba(0,0,0,.03) 1.5px, transparent 2px),
        radial-gradient(circle at 40px 80px, rgba(0,128,105,.04) 3px, transparent 3.5px);
    background-size: 80px 100px;
}
html.dark-theme .messages-container { background-image: radial-gradient(circle at 20px 20px, rgba(255,255,255,.03) 2px, transparent 2.5px), radial-gradient(circle at 60px 50px, rgba(255,255,255,.025) 1.5px, transparent 2px); }
.app.wp-plain .messages-container { background-image: none; }
.app.wp-mint .messages-container { background-color: #dff5e9; }
.app.wp-sky .messages-container { background-color: #dcecf7; }
.app.wp-sand .messages-container { background-color: #f3e9d6; }
.app.wp-night .messages-container { background-color: #0f1d24; }
.app.font-small { --msg-size: 13.4px; }
.app.font-large { --msg-size: 16.6px; }

.day-sep { text-align: center; margin: 12px 0 8px; position: sticky; top: 4px; z-index: 2; }
.day-sep span { background: var(--panel); color: var(--text-2); font-size: 12.3px; padding: 5px 12px; border-radius: 8px; box-shadow: var(--shadow-1); display: inline-block; }
html.dark-theme .day-sep span { background: #182229; }
.unread-marker { text-align: center; margin: 10px -6%; background: rgba(255,255,255,.55); padding: 4px; }
html.dark-theme .unread-marker { background: rgba(0,0,0,.25); }
.unread-marker span { font-size: 12.5px; color: var(--brand-dark); font-weight: 600; background: var(--panel); padding: 4px 14px; border-radius: 999px; }
.system-message { text-align: center; margin: 10px auto; max-width: 85%; background: #fff5c4; color: #54656f; font-size: 12.5px; padding: 6px 12px; border-radius: 8px; display: flex; gap: 6px; align-items: center; justify-content: center; width: fit-content; box-shadow: var(--shadow-1); }
html.dark-theme .system-message { background: #182229; color: #ffd279; }
.system-message.enc { background: #ffeecd; }
html.dark-theme .system-message.enc { background: #182229; }
.system-message .ic { width: 14px; height: 14px; }
.older-loading { text-align: center; padding: 10px; }
.msg-loading { padding: 10px 0; }
.bubble-skel { height: 34px; width: 46%; border-radius: 10px; background: var(--bubble-in); opacity: .6; margin: 10px 0; animation: pulse 1.2s infinite; }
.bubble-skel:nth-child(even) { margin-left: auto; width: 38%; background: var(--bubble-out); }

/* bubbles */
.msg-row { display: flex; margin: 1px 0; position: relative; transition: transform .12s; }
.msg-row:not(.cont) { margin-top: 8px; }
.msg-row.sent { justify-content: flex-end; }
.msg-row .swipe-reply-ic { position: absolute; left: -36px; top: 50%; transform: translateY(-50%) scale(.6); opacity: 0; width: 30px; height: 30px; border-radius: 50%; background: var(--panel); display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow-1); color: var(--text-2); transition: all .15s; }
.msg-row .swipe-reply-ic .ic { width: 16px; height: 16px; }
.msg-row.swipe-ready .swipe-reply-ic { opacity: 1; transform: translateY(-50%) scale(1); }
.bubble { max-width: min(75%, 560px); padding: 6px 8px 7px 9px; border-radius: 9px; background: var(--bubble-in); color: var(--bubble-text); box-shadow: var(--shadow-1); position: relative; font-size: var(--msg-size); line-height: 1.38; word-wrap: break-word; overflow-wrap: anywhere; min-width: 80px; animation: bubbleIn .18s ease; }
@keyframes bubbleIn { from { opacity: 0; transform: translateY(6px) scale(.98); } }
.msg-row.sent .bubble { background: var(--bubble-out); }
.msg-row:not(.cont).received .bubble { border-top-left-radius: 0; }
.msg-row:not(.cont).sent .bubble { border-top-right-radius: 0; }
.msg-row:not(.cont).received .bubble::before, .msg-row:not(.cont).sent .bubble::before { content: ""; position: absolute; top: 0; width: 9px; height: 13px; }
.msg-row:not(.cont).received .bubble::before { left: -8px; background: linear-gradient(225deg, var(--bubble-in) 50%, transparent 50%); }
.msg-row:not(.cont).sent .bubble::before { right: -8px; background: linear-gradient(135deg, var(--bubble-out) 50%, transparent 50%); }
.msg-row.media .bubble { padding: 3px; }
.msg-row.flash .bubble { animation: flash 1.5s ease; }
@keyframes flash { 30% { box-shadow: 0 0 0 4px rgba(0,168,132,.45); } }
.msg-row.pending .bubble { opacity: .92; }
.msg-row.failed .bubble { box-shadow: 0 0 0 1.5px var(--danger); }
.sender-name { font-size: 12.8px; font-weight: 600; margin-bottom: 2px; color: #06cf9c; }
.sender-name[data-hue="1"] { color: #059669; } .sender-name[data-hue="2"] { color: #2563eb; } .sender-name[data-hue="3"] { color: #db2777; } .sender-name[data-hue="4"] { color: #d97706; }
.sender-name[data-hue="5"] { color: #7c3aed; } .sender-name[data-hue="6"] { color: #0891b2; } .sender-name[data-hue="7"] { color: #e11d48; } .sender-name[data-hue="8"] { color: #4d7c0f; }
html.dark-theme .sender-name { filter: brightness(1.35); }
.msg-row.media .sender-name, .msg-row.media .reply-quote { margin: 3px 6px; }
.msg-text { white-space: pre-wrap; padding-right: 4px; }
.msg-text::after { content: ""; display: inline-block; width: 64px; }
.msg-row.sent .msg-text::after { width: 82px; }
.msg-text.big-emoji { font-size: 40px; line-height: 1.15; }
.msg-text a { color: #027eb5; word-break: break-all; }
html.dark-theme .msg-text a { color: #53bdeb; }
.mention-tag { color: #027eb5; font-weight: 600; }
html.dark-theme .mention-tag { color: #53bdeb; }
.msg-meta { float: right; display: inline-flex; align-items: center; gap: 3px; margin: 6px 0 -4px 8px; font-size: 11px; color: var(--muted); position: relative; top: 2px; white-space: nowrap; }
html.dark-theme .msg-row.sent .msg-meta { color: #99beb7; }
.msg-meta.over-media { position: absolute; right: 8px; bottom: 7px; margin: 0; top: auto; float: none; color: #fff; background: linear-gradient(transparent, rgba(0,0,0,.4)); padding: 2px 6px; border-radius: 8px; text-shadow: 0 1px 2px rgba(0,0,0,.5); }
.edited-tag { font-style: italic; margin-right: 2px; }
.msg-ticks { display: inline-flex; color: var(--tick); }
.msg-ticks .ic { width: 16px; height: 16px; stroke-width: 2; }
.msg-ticks.read { color: var(--tick-read); }
.msg-ticks.failed { color: var(--danger); }
.over-media .msg-ticks { color: #fff; }
.over-media .msg-ticks.read { color: #8fe3ff; }
.msg-deleted { color: var(--muted); font-style: italic; display: flex; align-items: center; gap: 5px; font-size: 13.5px; padding-right: 60px; }
.msg-deleted .ic { width: 15px; height: 15px; }
.msg-menu-btn { position: absolute; top: 2px; right: 2px; width: 26px; height: 22px; border-radius: 0 8px 0 12px; display: none; align-items: center; justify-content: center; color: var(--muted); background: inherit; }
.msg-menu-btn .ic { width: 16px; height: 16px; }
@media (hover: hover) { .bubble:hover .msg-menu-btn { display: flex; } }

.reply-quote { background: rgba(0,0,0,.05); border-left: 4px solid #06cf9c; border-radius: 7px; padding: 5px 9px; margin-bottom: 4px; cursor: pointer; display: flex; flex-direction: column; font-size: 13px; max-height: 70px; overflow: hidden; }
html.dark-theme .reply-quote { background: rgba(0,0,0,.22); }
.reply-quote b { color: #06a080; font-size: 12.5px; }
.reply-quote span { color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.msg-media { position: relative; border-radius: 7px; overflow: hidden; line-height: 0; background: rgba(0,0,0,.05); }
.msg-image { max-width: min(320px, 68vw); max-height: 360px; min-width: 120px; min-height: 80px; object-fit: cover; display: block; cursor: pointer; }
.msg-image.broken { min-height: 120px; min-width: 200px; background: var(--line); }
.msg-video { max-width: min(320px, 70vw); max-height: 360px; display: block; background: #000; }
.upload-ring { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.35); }
.upload-ring span { width: 52px; height: 52px; border-radius: 50%; border: 3px solid rgba(255,255,255,.35); border-top-color: #fff; animation: spin 1s linear infinite; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 12px; line-height: 1; font-weight: 600; }
.voice-msg { display: flex; align-items: center; gap: 10px; min-width: 230px; max-width: 300px; padding: 2px 0 14px; }
.voice-play { width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--text-2); flex-shrink: 0; }
.voice-play .ic { width: 26px; height: 26px; }
.voice-track { flex: 1; position: relative; }
.voice-bar { position: relative; cursor: pointer; background: rgba(134,150,160,.45); height: 4px; border-radius: 4px; margin: 9px 0; }
.voice-bar i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--brand); border-radius: 4px; }
.voice-bar i::after { content: ""; position: absolute; right: -6px; top: -4px; width: 12px; height: 12px; border-radius: 50%; background: var(--brand); }
.voice-time { position: absolute; left: 0; bottom: -14px; font-size: 11px; color: var(--muted); }
.voice-msg .avatar-wrap .avatar { width: 40px; height: 40px; font-size: 14px; }
.file-bubble { display: flex; align-items: center; gap: 10px; background: rgba(0,0,0,.05); border-radius: 8px; padding: 10px; cursor: pointer; min-width: 220px; max-width: 320px; margin-bottom: 2px; }
html.dark-theme .file-bubble { background: rgba(0,0,0,.2); }
.file-badge { width: 38px; height: 46px; border-radius: 6px; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 6px; font-size: 10px; font-weight: 800; color: #fff; flex-shrink: 0; background: #8696a0; position: relative; }
.file-badge::before { content: ""; position: absolute; top: 0; right: 0; border-width: 0 10px 10px 0; border-style: solid; border-color: transparent rgba(255,255,255,.55) rgba(0,0,0,.15) transparent; }
.file-badge.f-pdf { background: #e5252a; } .file-badge.f-doc { background: #2b579a; } .file-badge.f-xls { background: #217346; } .file-badge.f-ppt { background: #d24726; } .file-badge.f-zip { background: #8e6b3a; }
.file-badge.big { width: 70px; height: 86px; font-size: 16px; margin: 0 auto 12px; }
.file-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.file-name { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-meta small { color: var(--muted); font-size: 11.5px; }
.file-dl { width: 22px; height: 22px; color: var(--muted); border: 1.5px solid var(--muted); border-radius: 50%; padding: 3px; }
.msg-reactions { position: absolute; bottom: -18px; display: flex; gap: 2px; z-index: 1; }
.msg-row.received .msg-reactions { left: 8px; }
.msg-row.sent .msg-reactions { right: 8px; }
.msg-row.has-reactions { margin-bottom: 18px; }
.reaction-pill { background: var(--panel); border-radius: 999px; padding: 1px 6px; font-size: 14px; box-shadow: var(--shadow-1); border: 1.5px solid var(--chat-bg); cursor: pointer; display: inline-flex; align-items: center; gap: 2px; line-height: 1.4; }
.reaction-pill small { font-size: 11px; color: var(--text-2); }
.reaction-pill.mine { background: #e7fce3; }
html.dark-theme .reaction-pill.mine { background: #0a332c; }
.edit-textarea { width: 100%; min-width: 220px; min-height: 60px; margin-bottom: 6px; font-size: var(--msg-size); }
.edit-actions { display: flex; gap: 6px; justify-content: flex-end; }
.typing-bubble { position: absolute; left: 6%; bottom: 8px; background: var(--bubble-in); border-radius: 14px; padding: 10px 14px; display: flex; gap: 4px; box-shadow: var(--shadow-1); z-index: 3; }
.typing-bubble i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: typing 1.2s infinite; }
.typing-bubble i:nth-child(2) { animation-delay: .15s; } .typing-bubble i:nth-child(3) { animation-delay: .3s; }
@keyframes typing { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-5px); opacity: 1; } }
.scroll-down-btn { position: absolute; right: 16px; bottom: 14px; width: 42px; height: 42px; border-radius: 50%; background: var(--panel); box-shadow: var(--shadow-2); display: flex; align-items: center; justify-content: center; color: var(--text-2); z-index: 4; }
.scroll-down-btn .unread-badge { position: absolute; top: -6px; right: -4px; }

/* reply bar / mentions / emoji */
.reply-preview-bar { display: flex; align-items: center; gap: 8px; background: var(--header); padding: 8px 10px 0 12px; }
.reply-preview-content { flex: 1; min-width: 0; background: var(--panel-2); border-left: 4px solid var(--brand); border-radius: 8px; padding: 7px 10px; display: flex; flex-direction: column; font-size: 13px; }
html.dark-theme .reply-preview-content { background: #111b21; }
.reply-preview-content b { color: var(--brand-dark); font-size: 12.8px; }
.reply-preview-content span { color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mention-autocomplete { background: var(--panel); border-top: 1px solid var(--line); max-height: 220px; overflow-y: auto; box-shadow: var(--shadow-2); }
.mention-autocomplete-item { display: flex; align-items: center; gap: 10px; padding: 8px 14px; cursor: pointer; font-size: 14.5px; }
.mention-autocomplete-item:hover { background: var(--hover); }

/* composer */
.composer { display: flex; align-items: flex-end; gap: 6px; padding: 6px 8px calc(6px + var(--safe-bottom)); background: var(--header); }
html:not(.dark-theme) .composer { background: #f0f2f5; }
.composer-box { flex: 1; display: flex; align-items: flex-end; background: var(--panel); border-radius: 24px; padding: 2px 4px; min-height: 46px; box-shadow: var(--shadow-1); }
html.dark-theme .composer-box { background: #2a3942; }
.composer-box .icon-btn { width: 40px; height: 42px; color: var(--muted); }
#textInput { flex: 1; border: none; background: transparent; resize: none; min-height: 42px; max-height: 140px; padding: 11px 4px; box-shadow: none !important; line-height: 1.35; font-size: 15.5px; overflow-y: auto; }
.send-btn { width: 46px; height: 46px; border-radius: 50%; background: var(--brand); color: #fff; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: transform .12s; box-shadow: var(--shadow-1); }
html.dark-theme .send-btn { color: #111b21; }
.send-btn:active { transform: scale(.92); }
.send-btn .ic { width: 22px; height: 22px; }
.recording-bar { display: flex; align-items: center; gap: 10px; padding: 8px 10px calc(8px + var(--safe-bottom)); background: var(--header); min-height: 62px; }
.recording-bar audio { flex: 1; height: 40px; min-width: 0; }
.rec-dot { width: 11px; height: 11px; border-radius: 50%; background: var(--danger); animation: pulse 1s infinite; }
#recTimer { font-variant-numeric: tabular-nums; font-size: 15px; min-width: 44px; }
.rec-wave { flex: 1; height: 4px; border-radius: 4px; background: repeating-linear-gradient(90deg, var(--muted) 0 3px, transparent 3px 7px); opacity: .5; animation: wave 1s linear infinite; }
@keyframes wave { to { background-position: 28px 0; } }
.chat-closed-note { text-align: center; padding: 16px; background: var(--header); color: var(--muted); font-size: 14px; }

/* =====================================================================
   SHEETS / MODALS
   ===================================================================== */
.modal-overlay, .sheet-overlay { position: fixed; inset: 0; background: rgba(11,20,26,.5); z-index: 120; display: none; align-items: center; justify-content: center; padding: 16px; backdrop-filter: blur(2px); }
.modal-overlay.opening, .sheet-overlay.opening { animation: fadeIn .18s ease; }
@keyframes fadeIn { from { opacity: 0; } }
.modal-box { background: var(--panel); border-radius: 20px; padding: 22px; width: 100%; max-width: 440px; max-height: calc(var(--app-h) - 40px); overflow-y: auto; box-shadow: var(--shadow-3); animation: popIn .2s ease; }
.modal-box.wide { max-width: 640px; }
@keyframes popIn { from { opacity: 0; transform: scale(.94) translateY(8px); } }
.modal-box h3 { margin: 0 0 14px; font-size: 18px; display: flex; align-items: center; gap: 8px; }
.modal-box h3 small { display: block; }
.modal-box > input, .modal-box > textarea, .modal-box > select { margin-bottom: 10px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.modal-actions.wrap { flex-wrap: wrap; }
.sheet-overlay { align-items: flex-end; padding: 0; }
.sheet { background: var(--panel); width: 100%; max-width: 560px; border-radius: 22px 22px 0 0; padding: 8px 0 calc(12px + var(--safe-bottom)); max-height: 85vh; display: flex; flex-direction: column; animation: sheetUp .24s cubic-bezier(.2,.9,.3,1.1); transition: transform .15s; }
.sheet.tall { height: 85vh; }
@keyframes sheetUp { from { transform: translateY(100%); } }
.sheet-handle { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 4px auto 10px; flex-shrink: 0; }
.sheet-head { display: flex; align-items: center; gap: 8px; padding: 4px 16px 8px; }
.sheet-head h3 { margin: 0; flex: 1; font-size: 18px; display: flex; gap: 8px; align-items: center; }
.sheet .chat-list, .sheet .sheet-list { overflow-y: auto; flex: 1; }
.sheet > .search-box { margin: 0 16px 6px; }
.sheet-title { padding: 6px 20px 10px; font-weight: 600; font-size: 15px; color: var(--text-2); }
.sheet-preview { margin: 0 16px 8px; padding: 10px 12px; border-radius: 12px; background: var(--panel-2); color: var(--text-2); font-size: 13.5px; max-height: 70px; overflow: hidden; }
.sheet-item { display: flex; align-items: center; gap: 18px; padding: 13px 22px; width: 100%; text-align: left; font-size: 15.5px; color: var(--text); }
.sheet-item:hover, .sheet-item:active { background: var(--hover); }
.sheet-item .ic { color: var(--text-2); }
.sheet-item.danger, .sheet-item.danger .ic { color: var(--danger); }
.quick-reactions { display: flex; justify-content: space-around; padding: 4px 14px 12px; border-bottom: 1px solid var(--line); margin-bottom: 4px; flex-wrap: wrap; gap: 4px; }
.qr-item { font-size: 30px; width: 46px; height: 46px; border-radius: 50%; transition: transform .12s; display: flex; align-items: center; justify-content: center; }
.qr-item:active { transform: scale(1.25); }
.qr-item.mine { background: var(--active); }
.qr-item.more { background: var(--panel-2); color: var(--text-2); }
.attach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 12px; padding: 10px 18px 20px; }
.attach-item { display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); }
.att-ic { width: 54px; height: 54px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: #fff; flex-shrink: 0; }
.picker-action .att-ic { width: 46px; height: 46px; }
.att-ic .ic { width: 24px; height: 24px; }
.a-doc { background: linear-gradient(135deg, #8b5cf6, #6d28d9); } .a-cam { background: linear-gradient(135deg, #f43f5e, #be123c); } .a-gal { background: linear-gradient(135deg, #22c55e, #008069); }
.a-vid { background: linear-gradient(135deg, #f59e0b, #d97706); } .a-drv { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }

.member-check-list { max-height: 300px; overflow-y: auto; margin: 4px -6px; }
.member-check-item { display: flex; align-items: center; gap: 12px; padding: 8px 6px; border-radius: 10px; cursor: pointer; }
.member-check-item:hover { background: var(--hover); }
.member-check-item span { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 15px; }
.member-check-item small { color: var(--muted); font-size: 12px; }
.member-check-item input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--brand); flex-shrink: 0; }

/* info sheet (right panel on desktop) */
.side-sheet { justify-content: flex-end; }
.info-sheet { background: var(--panel-2); overflow-y: auto; }
html.dark-theme .info-sheet { background: #0b141a; }
.info-sheet .sheet-head { background: var(--panel); position: sticky; top: 0; z-index: 2; padding: 10px 12px; }
.info-hero { background: var(--panel); text-align: center; padding: 16px 16px 18px; margin-bottom: 8px; }
.info-hero .avatar { margin: 0 auto 12px; }
.info-hero h2 { margin: 0; font-size: 22px; }
.info-hero p { margin: 4px 0 14px; }
.info-actions { display: flex; justify-content: center; gap: 12px; }
.info-act { width: 92px; padding: 10px 0; border: 1px solid var(--line); border-radius: 14px; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 13px; color: var(--brand-dark); }
.info-act:hover { background: var(--hover); }
.info-card { background: var(--panel); margin-bottom: 8px; padding: 6px 0; }
.info-card > small, .info-card > p { padding: 0 18px; }
.info-card > p { margin: 4px 0 8px; white-space: pre-wrap; }
#infoAboutCard { padding: 12px 0 6px; }
.info-card-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 18px; }
.info-card .member-check-list, .info-card #confirmAddMembersBtn { margin: 0 12px 10px; }
.group-edit-row { display: flex; gap: 14px; align-items: center; padding: 10px 18px; }
.setting-row { display: flex; align-items: center; gap: 16px; padding: 12px 18px; width: 100%; text-align: left; cursor: pointer; font-size: 15px; color: var(--text); min-height: 52px; }
.setting-row:hover { background: var(--hover); }
.setting-row > span { flex: 1; min-width: 0; }
.setting-row > .ic { color: var(--text-2); }
.setting-row .chev { width: 18px; height: 18px; color: var(--muted); }
.setting-row.danger, .setting-row.danger .ic { color: var(--danger); }
.setting-row.flash { animation: flashBg 1.4s ease; }
@keyframes flashBg { 30% { background: rgba(0,168,132,.18); } }

/* settings */
.full-mobile .modal-box.settings-box { padding: 0; max-width: 560px; height: min(760px, calc(var(--app-h) - 40px)); display: flex; flex-direction: column; overflow: hidden; background: var(--panel-2); }
html.dark-theme .settings-box { background: #0b141a !important; }
.settings-head { display: flex; align-items: center; gap: 8px; padding: calc(10px + var(--safe-top)) 10px 10px; background: var(--panel); border-bottom: 1px solid var(--line); }
.settings-head h3 { margin: 0; font-size: 19px; }
.settings-scroll { overflow-y: auto; flex: 1; padding-bottom: var(--safe-bottom); }
.settings-group-title { margin: 18px 18px 6px; font-size: 13.5px; color: var(--brand-dark); font-weight: 600; }
.profile-card { display: flex; align-items: center; gap: 16px; width: 100%; padding: 16px 18px; background: var(--panel); text-align: left; }
.profile-card div:not(.avatar) { flex: 1; display: flex; flex-direction: column; }
.profile-card b { font-size: 18px; }
.session-row { display: flex; align-items: center; gap: 14px; padding: 10px 18px; }
.session-row > div { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.session-row small { color: var(--muted); font-size: 12px; }
.session-ic { width: 40px; height: 40px; border-radius: 50%; background: var(--panel-2); display: flex; align-items: center; justify-content: center; color: var(--text-2); }
.this-device { color: var(--brand-dark); font-weight: 700; }

/* profile */
.profile-box { text-align: center; }
.profile-photo-wrap { position: relative; width: 120px; margin: 4px auto 10px; }
.avatar-cam { position: absolute; right: 2px; bottom: 2px; width: 40px; height: 40px; border-radius: 50%; background: var(--brand); color: #fff; display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow-2); border: 3px solid var(--panel); }
.avatar-cam .ic { width: 20px; height: 20px; }

/* image send */
.image-send-box { text-align: center; }
#imagePreviewCanvas { max-width: 100%; max-height: 50vh; border-radius: 12px; margin-bottom: 10px; background: #000; }
.status-compose-preview { border-radius: 16px; min-height: 260px; display: flex; align-items: center; justify-content: center; overflow: hidden; position: relative; background: #128c7e; transition: background .2s; }
.status-compose-preview textarea { background: transparent; border: none; color: #fff; text-align: center; font-size: 24px; font-weight: 500; min-height: 200px; resize: none; box-shadow: none !important; }
.status-compose-preview textarea::placeholder { color: rgba(255,255,255,.7); }
.status-compose-preview.has-photo { background: #000 !important; }
.status-compose-preview img { max-height: 340px; object-fit: contain; }

/* notices / lists inside modals */
.notice-list { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.notice-card { background: var(--panel-2); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
html.dark-theme .notice-card { background: #182229; }
.notice-card.row, .drive-file-item { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.notice-card h4 { margin: 0 0 6px; font-size: 15.5px; }
.notice-card h4 a { color: inherit; }
.notice-card p { margin: 0 0 6px; font-size: 14px; color: var(--text-2); line-height: 1.45; }
.notice-meta { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.notice-meta .ic { width: 13px; height: 13px; }
.drive-delete-btn, .delete-rate-btn, .delete-reel-btn { background: none; border: none; color: var(--danger); cursor: pointer; font-size: 13px; }
.seg-tabs { display: flex; background: var(--panel-2); border-radius: 12px; padding: 4px; gap: 4px; margin: 10px 0; }
.seg-tabs button { flex: 1; padding: 8px; border-radius: 9px; font-weight: 500; color: var(--text-2); font-size: 14px; }
.seg-tabs button.active { background: var(--panel); color: var(--text); box-shadow: var(--shadow-1); }
html.dark-theme .seg-tabs button.active { background: var(--header); }
.weather-widget { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.weather-card { border-radius: 16px; padding: 12px; background: linear-gradient(135deg, #3b82f6, #06b6d4); color: #fff; text-align: center; }
.weather-city { font-weight: 600; font-size: 14px; opacity: .9; }
.weather-icon { font-size: 30px; }
.weather-temp { font-size: 26px; font-weight: 700; }
.weather-cond { font-size: 12.5px; opacity: .9; }
.cricket-score-line { font-size: 13.5px; font-weight: 500; }
.reel-search-row { display: flex; gap: 8px; margin-bottom: 10px; }
.reels-feed-container { display: flex; flex-direction: column; gap: 14px; }
.reel-feed-item { background: var(--panel-2); border-radius: 16px; padding: 10px; position: relative; }
.reel-category-tag { display: inline-block; font-size: 11.5px; background: var(--brand); color: #fff; border-radius: 6px; padding: 2px 8px; margin-bottom: 8px; }
.yt-embed-wrap { position: relative; width: 100%; aspect-ratio: 9 / 16; max-height: 70vh; border-radius: 12px; overflow: hidden; background: #000; }
.yt-embed-wrap iframe { position: absolute; inset: 0; width: 100%; height: 100%; }
.reel-caption { font-size: 14px; margin: 8px 0 4px; }
.media-gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 6px; }
.gallery-tile { aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--panel-2); position: relative; display: flex; align-items: center; justify-content: center; }
.gallery-tile img, .gallery-tile video { width: 100%; height: 100%; object-fit: cover; }
.gallery-file { flex-direction: column; gap: 6px; padding: 8px; font-size: 12px; text-align: center; }
.gallery-file span:not(.file-badge) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.gallery-file small { color: var(--muted); }

/* =====================================================================
   FULL-SCREEN VIEWERS (status + media)
   ===================================================================== */
.status-viewer { position: fixed; inset: 0; z-index: 150; background: #000; display: none; flex-direction: column; color: #fff; }
.status-viewer-header { display: flex; align-items: center; gap: 10px; padding: calc(14px + var(--safe-top)) 10px 10px; z-index: 3; background: linear-gradient(rgba(0,0,0,.6), transparent); }
.status-viewer-header .icon-btn { color: #fff; }
.status-viewer-header .icon-btn:hover { background: rgba(255,255,255,.12); }
.sv-meta { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.sv-meta b { font-size: 15.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sv-meta span { font-size: 12.5px; opacity: .8; }
.status-viewer-body { flex: 1; display: flex; align-items: center; justify-content: center; overflow: hidden; position: relative; touch-action: none; transition: transform .15s; }
.status-viewer-body img { max-width: 100%; max-height: 100%; object-fit: contain; user-select: none; -webkit-user-drag: none; transform-origin: center; }
.status-text { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 30px; }
.status-text p { font-size: clamp(22px, 5vw, 34px); text-align: center; font-weight: 500; line-height: 1.35; white-space: pre-wrap; margin: 0; }
.story-progress { position: absolute; top: calc(6px + var(--safe-top)); left: 8px; right: 8px; display: flex; gap: 4px; z-index: 4; }
.sp-seg { flex: 1; height: 3px; border-radius: 2px; background: rgba(255,255,255,.35); overflow: hidden; }
.sp-seg i { display: block; height: 100%; background: #fff; width: 0; }
.story-tap { position: absolute; top: 80px; bottom: 120px; z-index: 2; }
.story-tap.left { left: 0; width: 30%; }
.story-tap.right { right: 0; width: 70%; }
.status-viewer-footer { padding: 8px 10px calc(12px + var(--safe-bottom)); z-index: 3; background: linear-gradient(transparent, rgba(0,0,0,.7)); }
.status-comments-list { max-height: 110px; overflow-y: auto; margin-bottom: 6px; }
.status-comment-item { font-size: 13.5px; padding: 3px 4px; }
.status-comment-input-row { display: flex; align-items: center; gap: 6px; }
.status-comment-input-row input { flex: 1; border-radius: 999px; background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.25); color: #fff; }
.status-comment-input-row input::placeholder { color: rgba(255,255,255,.7); }
.status-comment-input-row .icon-btn { color: #fff; width: auto; min-width: 40px; padding: 0 6px; gap: 3px; border-radius: 20px; font-size: 13px; }
.status-heart-btn.hearted { color: #ff3b5c; }
.status-heart-btn.hearted .ic { fill: #ff3b5c; }
.status-heart-btn.pop { animation: heartPop .4s ease; }
@keyframes heartPop { 50% { transform: scale(1.35); } }
.media-viewer .status-viewer-body { touch-action: none; }
.pdf-frame { width: 100%; height: 100%; border: none; background: #fff; }
.text-preview { white-space: pre-wrap; font-family: ui-monospace, Consolas, monospace; font-size: 13px; padding: 20px; width: 100%; height: 100%; overflow: auto; margin: 0; background: #111; color: #e9edef; }
.file-card-big { text-align: center; padding: 30px; max-width: 340px; }
.file-card-big p { opacity: .75; font-size: 14px; }

/* =====================================================================
   CALLS
   ===================================================================== */
.call-screen { position: fixed; inset: 0; z-index: 170; display: none; flex-direction: column; color: #fff; overflow: hidden; }
.call-bg { position: absolute; inset: 0; background: radial-gradient(900px 500px at 50% 10%, #1f6f5c, transparent), linear-gradient(170deg, #0b3b33 0%, #0b141a 70%); z-index: -1; }
.call-bg::after { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 50% 30%, rgba(37,211,102,.18), transparent 50%); animation: breathe 4s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: .4; } }
.call-top { text-align: center; padding: calc(70px + var(--safe-top)) 20px 20px; flex: 1; display: flex; flex-direction: column; align-items: center; }
.call-kind { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; opacity: .85; margin-bottom: 26px; }
.call-kind .ic { width: 16px; height: 16px; }
.call-avatar { width: 128px; height: 128px; font-size: 44px; box-shadow: 0 0 0 6px rgba(255,255,255,.08); }
.call-avatar.pulse { animation: ringPulse 1.6s ease-out infinite; }
@keyframes ringPulse { 0% { box-shadow: 0 0 0 0 rgba(37,211,102,.55); } 100% { box-shadow: 0 0 0 34px rgba(37,211,102,0); } }
.call-top h2 { margin: 22px 0 4px; font-size: 27px; font-weight: 500; display: flex; flex-direction: column; }
.call-top h2 small { font-size: 14px; opacity: .8; font-weight: 400; margin-top: 4px; }
.call-status { opacity: .8; margin: 0; }
.incoming-actions { display: flex; justify-content: space-around; padding: 20px 20px calc(50px + var(--safe-bottom)); }
.ia { display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: 13px; opacity: .95; }
.round-btn { width: 62px; height: 62px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; transition: transform .12s, background .15s; }
.round-btn:active { transform: scale(.9); }
.round-btn .ic { width: 27px; height: 27px; }
.round-btn.red { background: #ea0038; box-shadow: 0 8px 22px rgba(234,0,56,.4); }
.round-btn.green { background: #00a884; box-shadow: 0 8px 22px rgba(0,168,132,.45); animation: shake 1.4s ease-in-out infinite; }
@keyframes shake { 0%, 60%, 100% { transform: rotate(0); } 65% { transform: rotate(-14deg); } 75% { transform: rotate(14deg); } 85% { transform: rotate(-8deg); } }
.round-btn.ghost { background: rgba(255,255,255,.14); backdrop-filter: blur(6px); }
.round-btn.ghost:hover { background: rgba(255,255,255,.22); }
.round-btn.off { background: #fff; color: #111b21; }
.round-btn:disabled { opacity: .4; }
.call-head { display: flex; align-items: center; gap: 10px; padding: calc(12px + var(--safe-top)) 12px 12px; z-index: 3; background: linear-gradient(rgba(0,0,0,.45), transparent); }
.call-head-text { flex: 1; text-align: center; display: flex; flex-direction: column; }
.call-head-text b { font-size: 18px; font-weight: 600; }
.call-head-text span { font-size: 13.5px; opacity: .85; font-variant-numeric: tabular-nums; }
.call-lock { width: 40px; display: flex; justify-content: center; opacity: .6; }
.call-lock .ic { width: 16px; height: 16px; }
.call-video-area { flex: 1; position: relative; }
.call-avatar-poster { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.call-grid { position: absolute; inset: 0; display: grid; gap: 4px; }
.call-grid[data-count="1"] { grid-template-columns: 1fr; }
.call-grid[data-count="2"] { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; }
.call-grid[data-count="3"], .call-grid[data-count="4"] { grid-template-columns: 1fr 1fr; }
.call-grid[data-count="5"], .call-grid[data-count="6"] { grid-template-columns: 1fr 1fr; grid-template-rows: repeat(3, 1fr); }
.call-tile { position: relative; background: #111; overflow: hidden; }
.call-tile video { width: 100%; height: 100%; object-fit: cover; }
.tile-name { position: absolute; left: 10px; bottom: 10px; font-size: 13px; background: rgba(0,0,0,.45); padding: 3px 10px; border-radius: 10px; }
#localVideo { position: absolute; right: 14px; bottom: 14px; width: 112px; height: 160px; object-fit: cover; border-radius: 16px; box-shadow: var(--shadow-3); border: 2px solid rgba(255,255,255,.25); z-index: 4; transform: scaleX(-1); background: #222; touch-action: none; }
#localVideo.mirror { transform: scaleX(-1); }
.call-controls { display: flex; justify-content: center; gap: 14px; padding: 18px 16px calc(26px + var(--safe-bottom)); background: linear-gradient(transparent, rgba(0,0,0,.55)); z-index: 3; flex-wrap: wrap; }
.ongoing-call-bar { position: fixed; top: var(--safe-top); left: 0; right: 0; z-index: 160; background: var(--brand); color: #fff; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 8px 14px; font-size: 14px; font-weight: 500; box-shadow: var(--shadow-2); }
.ongoing-call-bar .ic { width: 18px; height: 18px; animation: pulse 1.4s infinite; }
.ongoing-call-bar b { font-variant-numeric: tabular-nums; }
.app.call-minimized { padding-top: 38px; }

/* =====================================================================
   BANNER / TOAST
   ===================================================================== */
.net-banner { position: fixed; top: var(--safe-top); left: 50%; transform: translate(-50%, -140%); visibility: hidden; z-index: 180; background: #54656f; color: #fff; font-size: 12.5px; padding: 5px 14px; border-radius: 0 0 12px 12px; display: flex; gap: 6px; align-items: center; box-shadow: var(--shadow-2); transition: transform .25s ease; max-width: 94vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.net-banner .ic { width: 14px; height: 14px; }
.net-banner.offline, .net-banner.connecting, .net-banner.back { transform: translate(-50%, 0); visibility: visible; }
.net-banner.offline { background: #54656f; }
.net-banner.connecting { background: #b7791f; }
.net-banner.back { background: var(--brand-dark); }
.net-banner .spin { width: 14px; height: 14px; border-color: rgba(255,255,255,.4); border-top-color: #fff; }
.toast-host { position: fixed; left: 50%; bottom: calc(96px + var(--safe-bottom)); transform: translateX(-50%); z-index: 300; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: max-content; max-width: 92vw; }
.toast-host.in-chat { bottom: calc(80px + var(--safe-bottom)); }
.toast { background: #2a3942; color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 14px; box-shadow: var(--shadow-2); pointer-events: auto; animation: toastIn .22s ease; max-width: 92vw; transition: opacity .3s, transform .3s; }
.toast.error { background: #b4002d; }
.toast.out { opacity: 0; transform: translateY(8px); }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } }

/* =====================================================================
   DASHBOARD
   ===================================================================== */
.dashboard { padding: 18px; max-width: 980px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.dash-hero { border-radius: 22px; padding: 20px; color: #fff; background: radial-gradient(500px 220px at 90% -20%, rgba(255,255,255,.22), transparent), linear-gradient(135deg, #00a884, #005c4b); box-shadow: 0 12px 30px rgba(0,92,75,.3); position: relative; overflow: hidden; }
.dash-hero::after { content: ""; position: absolute; right: -40px; bottom: -60px; width: 200px; height: 200px; border-radius: 50%; background: rgba(255,255,255,.08); }
.dash-hero-row { display: flex; align-items: center; gap: 14px; }
.dash-hero h2 { margin: 0; font-size: 21px; }
.dash-hero p { margin: 4px 0 0; opacity: .9; font-size: 14px; }
.dash-hero .avatar { box-shadow: 0 0 0 3px rgba(255,255,255,.35); }
.dash-hero-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 18px; position: relative; z-index: 1; }
.dash-hero-stats div { background: rgba(255,255,255,.14); border-radius: 14px; padding: 10px 6px; text-align: center; display: flex; flex-direction: column; backdrop-filter: blur(4px); }
.dash-hero-stats b { font-size: 21px; }
.dash-hero-stats span { font-size: 11.5px; opacity: .9; }
.quick-actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.qa-btn { background: var(--panel); border-radius: 16px; padding: 14px 6px; display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: 12.8px; font-weight: 500; box-shadow: var(--shadow-1); border: 1px solid var(--line); transition: transform .12s; }
.qa-btn:active { transform: scale(.96); }
.qa-ic { width: 44px; height: 44px; border-radius: 14px; background: #e7fce3; color: var(--brand-dark); display: flex; align-items: center; justify-content: center; }
html.dark-theme .qa-ic { background: #0a332c; color: var(--brand); }
.dash-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat-tile { background: var(--panel); border-radius: 18px; padding: 14px; cursor: pointer; border: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; transition: transform .12s, box-shadow .12s; box-shadow: var(--shadow-1); }
.stat-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }
.stat-tile b { font-size: 26px; line-height: 1.1; margin-top: 8px; }
.stat-tile span { font-size: 12.5px; color: var(--text-2); }
.st-icon { width: 38px; height: 38px; border-radius: 12px; display: flex; align-items: center; justify-content: center; color: #fff; }
.st-icon .ic { width: 20px; height: 20px; }
.t-green .st-icon { background: linear-gradient(135deg, #22c55e, #008069); }
.t-red .st-icon { background: linear-gradient(135deg, #fb7185, #e11d48); }
.t-blue .st-icon { background: linear-gradient(135deg, #60a5fa, #2563eb); }
.t-violet .st-icon { background: linear-gradient(135deg, #a78bfa, #7c3aed); }
.t-amber .st-icon { background: linear-gradient(135deg, #fbbf24, #d97706); }
.t-teal .st-icon { background: linear-gradient(135deg, #2dd4bf, #0f766e); }
.dash-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.dash-card { background: var(--panel); border-radius: 18px; padding: 14px 16px; border: 1px solid var(--line); box-shadow: var(--shadow-1); min-width: 0; }
.dash-card h4 { margin: 0 0 10px; font-size: 15px; display: flex; align-items: center; gap: 6px; justify-content: space-between; }
.dash-card h4 .ic { width: 18px; height: 18px; color: var(--warn); }
.link { color: var(--brand-dark); font-size: 13px; font-weight: 500; cursor: pointer; text-decoration: none; }
.mini-list { display: flex; flex-direction: column; }
.mini-row { display: flex; align-items: center; gap: 10px; padding: 7px 4px; border-radius: 10px; cursor: pointer; }
.mini-row:hover { background: var(--hover); }
.mr-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.mr-text b { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mr-text span { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-row time { font-size: 11.5px; color: var(--muted); }
.mini-row .avatar.sm { color: #fff; }
.activity-chart { display: flex; align-items: flex-end; gap: 8px; height: 130px; padding-top: 10px; }
.activity-chart .bar { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end; gap: 4px; }
.activity-chart .bar i { width: 100%; max-width: 30px; background: linear-gradient(180deg, #25d366, #008069); border-radius: 8px 8px 4px 4px; min-height: 4px; transition: height .4s; }
.activity-chart .bar b { font-size: 11px; color: var(--text-2); }
.activity-chart .bar span { font-size: 11px; color: var(--muted); }
.admin-strip { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { background: var(--panel-2); border: 1px solid var(--line); padding: 6px 12px; border-radius: 999px; font-size: 13px; display: inline-flex; gap: 6px; }
.call-row-icon { display: inline-flex; margin-right: 4px; }
.call-row-icon .ic { width: 16px; height: 16px; }
.call-row-icon.ok { color: var(--accent); }
.call-row-icon.missed { color: var(--danger); }
.call-row-text.missed { color: var(--danger); }

/* =====================================================================
   ADMIN PAGE
   ===================================================================== */
body:has(.admin-wrapper) { overflow: auto; }
.admin-wrapper { max-width: 1150px; margin: 0 auto; padding: 22px 16px 60px; }
.admin-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.admin-header h2 { margin: 0; font-size: 22px; }
.admin-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 18px; }
.stat-card { background: var(--panel); border-radius: 16px; padding: 14px 16px; border: 1px solid var(--line); font-size: 14px; color: var(--text-2); }
.stat-card strong { display: block; font-size: 26px; color: var(--text); }
.stat-card.pending strong { color: var(--warn); } .stat-card.active strong { color: var(--brand-dark); } .stat-card.blocked strong { color: var(--danger); }
.admin-table { width: 100%; border-collapse: collapse; background: var(--panel); border-radius: 16px; overflow: hidden; border: 1px solid var(--line); font-size: 14px; display: block; overflow-x: auto; }
.admin-table th, .admin-table td { padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.admin-table th { background: var(--panel-2); font-weight: 600; color: var(--text-2); font-size: 13px; }
.admin-table form { display: inline; }
.action-cell { display: flex; gap: 6px; flex-wrap: wrap; }
.badge { padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge.active { background: #d9fdd3; color: #136c2e; } .badge.pending { background: #fff3cd; color: #8a6d00; } .badge.blocked { background: #fde8ea; color: #b4002d; }
.notice-form { background: var(--panel); border-radius: 16px; padding: 16px; border: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; margin: 20px 0; }

/* =====================================================================
   RESPONSIVE: MOBILE
   ===================================================================== */
@media (min-width: 901px) {
    .side-sheet .sheet.info-sheet { position: fixed; top: 0; right: 0; bottom: 0; height: 100%; max-height: 100%; width: 400px; max-width: 100%; border-radius: 0; animation: slideInRight .22s ease; }
    @keyframes slideInRight { from { transform: translateX(100%); } }
    .side-sheet { background: rgba(11,20,26,.25); }
    .sheet-overlay:not(.side-sheet) { align-items: center; padding: 16px; }
    .sheet-overlay:not(.side-sheet) .sheet { border-radius: 20px; padding-bottom: 12px; animation: popIn .2s ease; }
    .sheet-overlay:not(.side-sheet) .sheet-handle { display: none; }
    .empty-state .dashboard { padding-top: 26px; }
}
@media (max-width: 1100px) and (min-width: 901px) { .sidebar { width: 360px; } }

@media (max-width: 900px) {
    .rail { display: none; }
    .sidebar { width: 100%; max-width: none; min-width: 0; border-right: none; }
    .side-header .me { display: block; }
    .hide-mobile { display: none !important; }
    .chat-area { position: fixed; inset: 0; height: var(--app-h); z-index: 20; transform: translateX(100%); transition: transform .26s cubic-bezier(.2,.8,.2,1); box-shadow: -8px 0 30px rgba(0,0,0,.2); visibility: hidden; }
    .app.chat-open .chat-area { transform: none; visibility: visible; }
    .app.chat-dragging .chat-area { transition: none; }
    .empty-state { display: none !important; }
    .back-btn { display: inline-flex; }
    .chat-header { padding-left: 2px; }
    .chat-header-info { padding-left: 0; }
    .messages-container { padding: 10px 10px 14px; }
    .unread-marker { margin: 10px -10px; }
    .typing-bubble { left: 12px; }
    .bubble { max-width: 84%; }
    .bottom-nav { display: flex; background: var(--panel); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + var(--safe-bottom)); flex-shrink: 0; z-index: 4; }
    .bottom-nav .tab-btn { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 12px; font-weight: 500; color: var(--text-2); padding: 2px 0; }
    .bn-ic { width: 60px; height: 32px; border-radius: 16px; display: flex; align-items: center; justify-content: center; position: relative; transition: background .2s; }
    .bottom-nav .tab-btn.active { color: var(--text); font-weight: 700; }
    .bottom-nav .tab-btn.active .bn-ic { background: #d8fdd2; color: #0b3b33; }
    html.dark-theme .bottom-nav .tab-btn.active .bn-ic { background: #103529; color: #d8fdd2; }
    .nav-badge { position: absolute; top: -3px; right: 6px; min-width: 18px; height: 18px; border-radius: 9px; background: var(--accent); color: #fff; font-size: 10.5px; font-weight: 700; display: none; align-items: center; justify-content: center; padding: 0 5px; border: 2px solid var(--panel); }
    html.dark-theme .nav-badge { color: #111b21; }
    .nav-badge.on { display: flex; }
    .bottom-nav .nav-dot { top: 3px; right: 14px; border-color: var(--panel); }
    .fab { bottom: calc(82px + var(--safe-bottom)); }
    .fab.mini { bottom: calc(148px + var(--safe-bottom)); }
    .panel { padding-bottom: 96px; }
    .toast-host { bottom: calc(150px + var(--safe-bottom)); }
    .modal-overlay.full-mobile { padding: 0; }
    .full-mobile .modal-box.settings-box { max-width: none; height: var(--app-h); border-radius: 0; max-height: none; animation: slideUpFull .25s ease; }
    @keyframes slideUpFull { from { transform: translateY(30px); opacity: .5; } }
    .side-sheet .sheet.info-sheet { height: var(--app-h); max-height: none; border-radius: 0; max-width: none; }
    .modal-box { border-radius: 20px; padding: 18px; }
    .dash-grid { grid-template-columns: repeat(2, 1fr); }
    .dash-cols { grid-template-columns: 1fr; }
    .dashboard { padding: 12px 12px 30px; }
    .msg-menu-btn { display: none !important; }
    .app.call-minimized .chat-area { top: 38px; }
}
@media (max-width: 420px) {
    .dash-hero-stats b { font-size: 18px; }
    .qa-btn { font-size: 11.5px; }
    .chat-header-actions .icon-btn { width: 38px; }
    #localVideo { width: 96px; height: 136px; }
}

/* scrollbars (desktop) */
@media (hover: hover) {
    ::-webkit-scrollbar { width: 8px; height: 8px; }
    ::-webkit-scrollbar-thumb { background: rgba(134,150,160,.35); border-radius: 4px; }
    ::-webkit-scrollbar-track { background: transparent; }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* print */
@media print {
    body, html { overflow: visible !important; height: auto; }
    body * { visibility: hidden; }
    .print-only, .print-only * { visibility: visible; }
    .print-only { display: block !important; position: absolute; left: 0; top: 0; width: 100%; padding: 20px; color: #000; }
    .app { position: static; }
}

/* =====================================================================
   EMOJI (Noto) + STICKERS
   ===================================================================== */
.em, .emoji-item, .emoji-tab, .qr-item, .reaction-pill, .big-emoji, .ep-mode .em { font-family: var(--emoji-font); font-style: normal; }
.reaction-pill small { font-family: var(--font); }
.em { line-height: 1; vertical-align: -0.12em; }
.msg-text .em { font-size: 1.12em; }
.emoji-picker { flex-direction: column; background: var(--panel); border-top: 1px solid var(--line); height: 340px; max-height: 46vh; }
.ep-top { padding: 8px 10px 4px; }
.ep-search { display: flex; align-items: center; gap: 8px; background: var(--panel-2); border-radius: 10px; padding: 0 10px; height: 36px; color: var(--muted); }
html.dark-theme .ep-search { background: var(--header); }
.ep-search .ic { width: 16px; height: 16px; }
.ep-search input { border: none; background: transparent; padding: 0; height: 100%; box-shadow: none !important; font-size: 14px; }
.ep-title { font-weight: 600; font-size: 13.5px; color: var(--text-2); padding: 6px 4px; }
.emoji-tabs { display: flex; gap: 2px; padding: 2px 8px 6px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; flex-shrink: 0; }
.emoji-tabs::-webkit-scrollbar { display: none; }
.emoji-tab { font-size: 20px; width: 40px; height: 34px; border-radius: 9px; opacity: .55; flex-shrink: 0; position: relative; }
.emoji-tab.active { opacity: 1; }
.emoji-tab.active::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: -6px; height: 3px; border-radius: 3px; background: var(--brand); }
.ep-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; }
.emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); padding: 6px; align-content: start; }
.emoji-item { font-size: 28px; height: 46px; border-radius: 10px; line-height: 1; transition: transform .1s; }
.emoji-item:hover { background: var(--active); }
.emoji-item:active { transform: scale(1.25); }
.emoji-item .em { vertical-align: 0; }
.panel-empty { text-align: center; padding: 14px; margin: 0; }
.ep-switch { display: flex; justify-content: center; gap: 6px; padding: 6px 8px calc(6px + var(--safe-bottom)); border-top: 1px solid var(--line); flex-shrink: 0; }
.ep-mode { display: inline-flex; align-items: center; gap: 6px; padding: 7px 16px; border-radius: 999px; font-size: 13.5px; font-weight: 500; color: var(--text-2); }
.ep-mode .ic { width: 18px; height: 18px; }
.ep-mode.active { background: #e7fce3; color: var(--brand-dark); }
html.dark-theme .ep-mode.active { background: #0a332c; color: var(--brand); }
.sticker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); gap: 6px; padding: 8px; }
.sticker-tile { aspect-ratio: 1; border-radius: 14px; display: flex; align-items: center; justify-content: center; padding: 6px; transition: transform .12s, background .12s; }
.sticker-tile:hover { background: var(--hover); }
.sticker-tile:active { transform: scale(.92); }
.sticker-tile img, .sticker-tile .sticker-img { width: 100%; height: 100%; object-fit: contain; }
.sticker-tile .sticker-fallback { font-size: 54px; }
.sticker-tile.add { flex-direction: column; gap: 4px; border: 2px dashed var(--line); color: var(--brand-dark); font-size: 11px; text-align: center; line-height: 1.2; }
.sticker-tile.add .ic { width: 26px; height: 26px; }
/* sticker message - bina bubble ke, WhatsApp jesa */
.msg-row.sticker .bubble { background: transparent !important; box-shadow: none; padding: 0; min-width: 0; }
.msg-row.sticker .bubble::before { display: none; }
.msg-row.sticker .msg-menu-btn { background: var(--panel); border-radius: 50%; }
.sticker-msg { width: 160px; height: 160px; display: flex; align-items: center; justify-content: center; }
.sticker-msg img { width: 100%; height: 100%; object-fit: contain; user-select: none; }
.sticker-msg .sticker-fallback { font-size: 110px; line-height: 1; }
.msg-row.sticker .msg-meta.over-media { right: 4px; bottom: 2px; background: rgba(0,0,0,.35); }
.msg-row.sticker .reply-quote { background: var(--bubble-in); }
@media (max-width: 420px) { .sticker-msg { width: 140px; height: 140px; } }

/* ---------- dashboard: weather + news ---------- */
.weather-mini { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.wm-card { border-radius: 16px; padding: 12px 14px; color: #fff; background: linear-gradient(135deg, #38bdf8, #2563eb); display: flex; flex-direction: column; gap: 2px; position: relative; overflow: hidden; min-height: 110px; }
.wm-card:nth-child(2) { background: linear-gradient(135deg, #f59e0b, #ea580c); }
.wm-card::after { content: ""; position: absolute; right: -24px; top: -24px; width: 90px; height: 90px; border-radius: 50%; background: rgba(255,255,255,.14); }
.wm-card.off { background: var(--panel-2); color: var(--muted); }
.wm-top { display: flex; justify-content: space-between; align-items: center; }
.wm-top b { font-size: 14px; }
.wm-icon { font-size: 30px; font-family: var(--emoji-font); z-index: 1; }
.wm-temp { font-size: 34px; font-weight: 700; line-height: 1.1; }
.wm-temp small { font-size: 16px; font-weight: 500; opacity: .85; margin-left: 2px; }
.wm-card > span { font-size: 12.5px; opacity: .92; }
.news-list { display: flex; flex-direction: column; max-height: 300px; overflow-y: auto; }
.news-row { display: flex; flex-direction: column; gap: 2px; padding: 8px 6px; border-radius: 10px; text-decoration: none; color: var(--text); border-bottom: 1px solid var(--line); }
.news-row:last-child { border-bottom: none; }
.news-row:hover { background: var(--hover); }
.news-row b { font-size: 14px; font-weight: 500; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.news-row small { font-size: 11.5px; color: var(--muted); }
.news-src { font-size: 10.5px; font-weight: 700; color: var(--brand-dark); text-transform: uppercase; letter-spacing: .4px; }
.sticker-box { position: relative; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.sticker-box .sticker-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; opacity: 0; transition: opacity .2s; }
.sticker-box .sticker-img.ok { opacity: 1; }
.sticker-box .sticker-img.ok ~ .sticker-fallback, .sticker-box:has(.sticker-img.ok) .sticker-fallback { visibility: hidden; }
