/* ===== زون كيو — Soft UI chat theme ===== */
@font-face { font-family: "ZQ"; src: url("../../fonts/font.ttf") format("truetype"); font-display: swap; }

:root {
  --primary: #6C5CE7;
  --primary-2: #7A67EE;
  --primary-soft: #EEEBFF;
  --bubble-out: #E7E2FF;
  --bubble-in: #FFFFFF;
  --bg: #F5F5F9;
  --surface: #FFFFFF;
  --text: #1E1B39;
  --muted: #8A88A3;
  --line: #ECEBF3;
  --danger: #EF4444;
  --success: #10B981;
  --warn: #F59E0B;
  --radius: 22px;
  --radius-sm: 14px;
  --shadow: 0 10px 30px rgba(76, 64, 160, .08), 0 2px 6px rgba(76, 64, 160, .04);
  --shadow-lg: 0 20px 50px rgba(76, 64, 160, .16);
  --font: "ZQ", "Segoe UI", Tahoma, system-ui, sans-serif;
}
[data-theme="dark"] {
  --bg: #12111C;
  --surface: #1C1B2B;
  --text: #EDEBFF;
  --muted: #9A98B8;
  --line: #2A2940;
  --primary-soft: #2B2850;
  --bubble-out: #3A3378;
  --bubble-in: #24233A;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
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; }
a { color: var(--primary); text-decoration: none; }
img { display: block; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- primitives ---------- */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; cursor: pointer; border-radius: 999px; padding: 12px 22px;
  background: linear-gradient(135deg, var(--primary-2), var(--primary)); color: #fff; font-weight: 700;
  box-shadow: 0 8px 18px rgba(108, 92, 231, .35); transition: transform .15s, box-shadow .15s, opacity .15s;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 12px 24px rgba(108, 92, 231, .4); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .6; cursor: progress; }
.btn.ghost { background: var(--primary-soft); color: var(--primary); box-shadow: none; }
.btn.danger { background: #FEE2E2; color: var(--danger); box-shadow: none; }
.btn.block { width: 100%; }
.icon-btn {
  width: 42px; height: 42px; border-radius: 50%; border: 0; cursor: pointer; display: grid; place-items: center;
  background: var(--primary-soft); color: var(--primary); font-size: 18px; transition: background .15s;
}
.icon-btn:hover { background: #E0DAFF; }
.icon-btn svg, .nav-item svg { width: 20px; height: 20px; }
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; font-weight: 600; }
.input {
  width: 100%; border: 1.5px solid var(--line); background: var(--bg); border-radius: var(--radius-sm);
  padding: 12px 16px; outline: none; transition: border-color .15s, background .15s;
}
.input:focus { border-color: var(--primary); background: var(--surface); }
textarea.input { resize: vertical; min-height: 80px; }
.pill-input { border-radius: 999px; padding-inline-start: 44px; }
.badge-count { min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px; background: var(--primary); color: #fff; font-size: 12px; font-weight: 700; display: inline-grid; place-items: center; }
.vbadge { display: inline-block; width: 16px; height: 16px; border-radius: 50%; vertical-align: -2px; margin-inline-start: 4px; position: relative; }
.vbadge::after { content: "✓"; position: absolute; inset: 0; color: #fff; font-size: 10px; display: grid; place-items: center; font-weight: 900; }
.toast-wrap { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 100; display: grid; gap: 8px; }
.toast { background: var(--text); color: var(--surface); padding: 12px 20px; border-radius: 999px; box-shadow: var(--shadow-lg); animation: pop .25s ease; }
.toast.err { background: var(--danger); color: #fff; }
@keyframes pop { from { transform: translateY(10px); opacity: 0; } }

/* ---------- avatars ---------- */
.av { position: relative; flex: none; width: 48px; height: 48px; }
.av img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; background: var(--primary-soft); box-shadow: 0 4px 10px rgba(76, 64, 160, .18); }
.av.sm { width: 36px; height: 36px; }
.av.lg { width: 120px; height: 120px; }
.av .dot { position: absolute; bottom: 1px; inset-inline-end: 1px; width: 12px; height: 12px; border-radius: 50%; background: var(--success); border: 2px solid var(--surface); }
.av.lg .dot { width: 20px; height: 20px; border-width: 3px; bottom: 8px; inset-inline-end: 8px; }
.group-av { width: 48px; height: 48px; flex: none; border-radius: 16px; display: grid; place-items: center; font-size: 24px; background: linear-gradient(135deg, #EEEBFF, #DCD5FF); box-shadow: 0 4px 10px rgba(76, 64, 160, .15); }
.group-av.lg { width: 120px; height: 120px; border-radius: 36px; font-size: 56px; }

.avatar-picker { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.avatar-picker label { cursor: pointer; text-align: center; font-size: 13px; color: var(--muted); }
.avatar-picker input { position: absolute; opacity: 0; pointer-events: none; }
.avatar-picker img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 50%; border: 3px solid transparent; transition: transform .15s, border-color .15s; background: var(--primary-soft); }
.avatar-picker input:checked + img { border-color: var(--primary); transform: scale(1.06); box-shadow: 0 8px 20px rgba(108, 92, 231, .35); }
.avatar-picker input:focus-visible + img { outline: 3px solid var(--primary-2); }
.seg { display: flex; background: var(--bg); border-radius: 999px; padding: 4px; gap: 4px; }
.seg label { flex: 1; }
.seg input { position: absolute; opacity: 0; }
.seg span { display: block; text-align: center; padding: 10px; border-radius: 999px; cursor: pointer; font-weight: 700; color: var(--muted); transition: all .15s; }
.seg input:checked + span { background: var(--surface); color: var(--primary); box-shadow: var(--shadow); }

/* ---------- auth pages ---------- */
.auth { min-height: 100%; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-art { background: radial-gradient(circle at 30% 20%, #8E7CFF, var(--primary) 60%, #4B3BC4); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-art h1 { font-size: 44px; margin: 0 0 12px; }
.auth-art p { font-size: 18px; opacity: .9; max-width: 420px; line-height: 1.8; }
.auth-art .float-avs { display: flex; gap: 14px; flex-wrap: wrap; }
.auth-art .float-avs img { width: 74px; height: 74px; border-radius: 50%; border: 4px solid rgba(255, 255, 255, .5); box-shadow: 0 10px 30px rgba(0, 0, 0, .2); animation: bob 4s ease-in-out infinite; }
.auth-art .float-avs img:nth-child(2n) { animation-delay: -2s; }
@keyframes bob { 50% { transform: translateY(-8px); } }
.auth-art .bubble { position: absolute; border-radius: 50%; background: rgba(255, 255, 255, .08); }
.auth-form { display: grid; place-items: center; padding: 32px; }
.auth-form .card { width: 100%; max-width: 440px; padding: 36px; }
.auth-form h2 { margin: 0 0 6px; font-size: 26px; }
.auth-form .sub { color: var(--muted); margin: 0 0 24px; }
.form-err { background: #FEE2E2; color: #B91C1C; padding: 10px 14px; border-radius: 12px; margin-bottom: 14px; font-size: 14px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 22px; }
.brand-logo { width: 42px; height: 42px; border-radius: 14px; background: linear-gradient(135deg, #fff, #E8E3FF); display: grid; place-items: center; box-shadow: 0 6px 14px rgba(0, 0, 0, .12); }
.brand-logo svg { width: 26px; height: 26px; }
.steps { display: flex; gap: 6px; margin-bottom: 20px; }
.steps i { flex: 1; height: 5px; border-radius: 99px; background: var(--line); }
.steps i.on { background: var(--primary); }

/* ---------- app layout (4 columns) ---------- */
.app { height: 100vh; height: 100dvh; display: grid; grid-template-columns: 230px 330px 1fr 300px; grid-template-rows: minmax(0, 1fr); gap: 18px; padding: 18px; }
.app > * { min-height: 0; }
.app.no-details { grid-template-columns: 230px 330px 1fr; }
.app.no-details .details { display: none; }

.nav { display: flex; flex-direction: column; padding: 22px 16px; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.nav > * { flex-shrink: 0; }
.nav::-webkit-scrollbar { width: 5px; }
.nav::-webkit-scrollbar-thumb { background: var(--line); border-radius: 5px; }
.nav .brand { color: var(--text); padding: 0 6px 22px; }
.nav .brand-logo { background: linear-gradient(135deg, var(--primary-2), var(--primary)); }
.nav .brand-logo svg path { fill: #fff; }
.nav .new-chat { margin-bottom: 22px; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; color: var(--muted); font-weight: 600; cursor: pointer; border: 0; background: none; width: 100%; text-align: start; transition: background .15s, color .15s; }
.nav-item:hover { background: var(--bg); color: var(--text); }
.nav-item.active { background: var(--primary-soft); color: var(--primary); }
.nav-item .badge-count { margin-inline-start: auto; }
.nav .spacer { flex: 1; }
.wallet-mini { display: block; background: linear-gradient(135deg, var(--primary-2), var(--primary)); color: #fff; border-radius: 18px; padding: 16px; margin-top: 12px; box-shadow: 0 12px 24px rgba(108, 92, 231, .35); }
.wallet-mini small { opacity: .85; }
.wallet-mini b { display: block; font-size: 24px; margin: 4px 0; }
.wallet-mini span { font-size: 12px; background: rgba(255, 255, 255, .2); padding: 4px 10px; border-radius: 99px; }
.me-row { display: flex; align-items: center; gap: 10px; margin-top: 14px; padding: 8px; border-radius: 14px; cursor: pointer; }
.me-row:hover { background: var(--bg); }
.me-row .meta { min-width: 0; flex: 1; }
.me-row b, .me-row small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-row small { color: var(--muted); font-size: 12px; }

.list { display: flex; flex-direction: column; overflow: hidden; }
.list-head { padding: 20px 18px 12px; }
.list-head h3 { margin: 0 0 14px; display: flex; align-items: center; justify-content: space-between; font-size: 17px; }
.search { position: relative; }
.search svg { position: absolute; inset-inline-start: 16px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); }
.tabs { display: flex; gap: 6px; margin-top: 12px; }
.tabs button { flex: 1; border: 0; background: none; padding: 8px; border-radius: 999px; color: var(--muted); font-weight: 700; cursor: pointer; font-size: 13px; white-space: nowrap; }
.tabs button.on { background: var(--primary-soft); color: var(--primary); }
.list-body { flex: 1; overflow-y: auto; padding: 4px 10px 12px; }
.chat-item { display: flex; gap: 12px; align-items: center; padding: 12px 10px; border-radius: 18px; cursor: pointer; transition: background .15s; position: relative; }
.chat-item:hover { background: var(--bg); }
.chat-item.active { background: var(--primary-soft); }
.chat-item .meta { flex: 1; min-width: 0; }
.chat-item .top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.chat-item .name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item .time { font-size: 11px; color: var(--muted); flex: none; }
.chat-item .bottom { display: flex; justify-content: space-between; gap: 8px; align-items: center; margin-top: 3px; }
.chat-item .snippet { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item.unread .snippet { color: var(--text); font-weight: 600; }
.chat-item .pin { font-size: 11px; }
.list-foot { padding: 12px 16px 16px; }
.empty { text-align: center; color: var(--muted); padding: 40px 16px; }
.empty .big { font-size: 46px; margin-bottom: 8px; }

.main { display: flex; flex-direction: column; overflow: hidden; position: relative; }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.chat-head .meta { flex: 1; min-width: 0; cursor: pointer; }
.chat-head b { display: block; font-size: 17px; }
.chat-head small { color: var(--muted); display: flex; align-items: center; gap: 6px; }
.chat-head small .on { width: 8px; height: 8px; border-radius: 50%; background: var(--success); display: inline-block; }
.chat-head .back { display: none; }
.feed { flex: 1; overflow-y: auto; padding: 20px 24px; display: flex; flex-direction: column; gap: 6px; background:
  radial-gradient(circle at 15% 20%, rgba(122, 103, 238, .05), transparent 40%),
  radial-gradient(circle at 85% 80%, rgba(122, 103, 238, .05), transparent 40%); }
.day-sep { align-self: center; background: var(--surface); color: var(--muted); font-size: 12px; padding: 5px 14px; border-radius: 999px; box-shadow: var(--shadow); margin: 12px 0; }
.msg { display: flex; gap: 10px; align-items: flex-end; max-width: 72%; animation: pop .2s ease; }
.msg.out { align-self: flex-end; flex-direction: row-reverse; }
.msg.in { align-self: flex-start; }
.msg .av { width: 34px; height: 34px; }
.msg.cont .av { visibility: hidden; }
.bubble-m { padding: 10px 14px 6px; border-radius: 20px; box-shadow: var(--shadow); line-height: 1.7; word-wrap: break-word; overflow-wrap: anywhere; white-space: pre-wrap; position: relative; }
.msg.in .bubble-m { background: var(--bubble-in); border-end-start-radius: 6px; }
.msg.out .bubble-m { background: var(--bubble-out); border-end-end-radius: 6px; }
.bubble-m .who { font-size: 12px; font-weight: 800; color: var(--primary); display: block; }
.bubble-m .foot { display: flex; gap: 6px; justify-content: flex-end; align-items: center; font-size: 11px; color: var(--muted); margin-top: 2px; white-space: nowrap; }
.bubble-m .ticks { color: var(--muted); letter-spacing: -3px; }
.bubble-m .ticks.read { color: var(--primary); }
.bubble-m.deleted { font-style: italic; color: var(--muted); }
.msg .del { opacity: 0; border: 0; background: none; cursor: pointer; color: var(--muted); font-size: 14px; transition: opacity .15s; align-self: center; }
.msg:hover .del { opacity: 1; }
.composer { margin: 12px 18px 18px; display: flex; align-items: flex-end; gap: 10px; background: var(--surface); border-radius: 999px; padding: 8px; box-shadow: var(--shadow-lg); position: relative; }
.composer textarea { flex: 1; border: 0; outline: none; background: none; resize: none; max-height: 140px; padding: 10px 6px; line-height: 1.5; }
.send-btn { width: 46px; height: 46px; border-radius: 50%; border: 0; cursor: pointer; background: linear-gradient(135deg, var(--primary-2), var(--primary)); color: #fff; display: grid; place-items: center; box-shadow: 0 8px 18px rgba(108, 92, 231, .4); flex: none; }
.send-btn svg { width: 20px; height: 20px; transform: scaleX(-1); }
.emoji-pop { position: absolute; bottom: 64px; inset-inline-end: 60px; background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg); padding: 10px; display: grid; grid-template-columns: repeat(8, 34px); gap: 2px; z-index: 5; }
.emoji-pop button { border: 0; background: none; font-size: 22px; cursor: pointer; border-radius: 8px; height: 34px; }
.emoji-pop button:hover { background: var(--bg); }
.blocked-note { margin: 12px 18px 18px; text-align: center; padding: 14px; border-radius: 18px; background: var(--bg); color: var(--muted); }
.welcome { flex: 1; display: grid; place-items: center; text-align: center; padding: 30px; }
.welcome .avs { display: flex; justify-content: center; margin-bottom: 18px; }
.welcome .avs img { width: 64px; height: 64px; border-radius: 50%; margin-inline-start: -14px; border: 4px solid var(--surface); box-shadow: var(--shadow); }
.welcome h2 { margin: 0 0 6px; }
.load-more { align-self: center; }

.details { overflow-y: auto; display: flex; flex-direction: column; gap: 14px; background: none; box-shadow: none; }
.details > .card { padding: 20px; }
.profile-card { text-align: center; }
.profile-card .av.lg, .profile-card .group-av.lg { margin: 0 auto 12px; }
.profile-card h3 { margin: 0; font-size: 19px; }
.profile-card .handle { color: var(--muted); font-size: 13px; direction: ltr; }
.actions-row { display: flex; justify-content: center; gap: 14px; margin-top: 16px; }
.actions-row button { display: grid; justify-items: center; gap: 6px; font-size: 12px; color: var(--muted); border: 0; background: none; cursor: pointer; }
.details h4 { margin: 0 0 10px; font-size: 14px; display: flex; justify-content: space-between; }
.details p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.7; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; font-size: 14px; }
.switch { position: relative; width: 44px; height: 24px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--line); border-radius: 99px; cursor: pointer; transition: background .2s; }
.switch span::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); }
.switch input:checked + span { background: var(--primary); }
.switch input:checked + span::after { transform: translateX(-20px); }
[dir="ltr"] .switch input:checked + span::after { transform: translateX(20px); }
.danger-link { color: var(--danger); background: none; border: 0; cursor: pointer; font-weight: 700; padding: 8px 0; display: flex; gap: 8px; align-items: center; }
.member-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; cursor: pointer; }
.member-row small { color: var(--muted); }
.member-row .role { margin-inline-start: auto; font-size: 11px; background: var(--primary-soft); color: var(--primary); padding: 2px 8px; border-radius: 99px; }

/* ---------- modal ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(20, 16, 50, .4); backdrop-filter: blur(4px); display: grid; place-items: center; z-index: 50; padding: 16px; animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.modal { width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto; padding: 26px; animation: pop .25s; }
.modal h3 { margin: 0 0 16px; display: flex; justify-content: space-between; align-items: center; }
.modal .close { border: 0; background: var(--bg); width: 34px; height: 34px; border-radius: 50%; cursor: pointer; }
.user-pick { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 14px; cursor: pointer; }
.user-pick:hover { background: var(--bg); }
.user-pick .meta { flex: 1; }
.user-pick small { display: block; color: var(--muted); direction: ltr; text-align: end; }
.group-card { display: flex; gap: 12px; align-items: center; padding: 12px; border-radius: 16px; }
.group-card:hover { background: var(--bg); }
.group-card .meta { flex: 1; min-width: 0; }
.group-card small { color: var(--muted); display: block; }

/* ---------- wallet ---------- */
.page { max-width: 1100px; margin: 0 auto; padding: 24px; }
.page-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 22px; }
.balance-hero { padding: 30px; color: #fff; background: radial-gradient(circle at 20% 0%, #8E7CFF, var(--primary) 55%, #4B3BC4); position: relative; overflow: hidden; display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; }
.balance-hero h1 { font-size: 48px; margin: 4px 0; }
.balance-hero .coin { width: 110px; height: 110px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #FFE58F, #F5B700 60%, #C98A00); display: grid; place-items: center; font-weight: 900; font-size: 24px; color: #7A5200; box-shadow: inset -6px -8px 0 rgba(0, 0, 0, .12), 0 16px 30px rgba(0, 0, 0, .25); }
.grid { display: grid; gap: 18px; }
.grid.cols-2 { grid-template-columns: 1.4fr 1fr; }
.section { padding: 24px; }
.section h2 { margin: 0 0 4px; font-size: 20px; }
.section .sub { color: var(--muted); margin: 0 0 18px; font-size: 14px; }
.packages { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.pkg { border: 2px solid var(--line); border-radius: 20px; padding: 18px; cursor: pointer; text-align: center; transition: all .15s; background: var(--surface); position: relative; }
.pkg:hover { border-color: #CFC8FF; transform: translateY(-2px); }
.pkg.sel { border-color: var(--primary); box-shadow: 0 10px 24px rgba(108, 92, 231, .2); }
.pkg .amt { font-size: 28px; font-weight: 900; color: var(--primary); }
.pkg .bonus { position: absolute; top: -10px; inset-inline-start: 50%; transform: translateX(50%); background: var(--success); color: #fff; font-size: 11px; padding: 3px 10px; border-radius: 99px; white-space: nowrap; }
.pkg .price { margin-top: 8px; font-weight: 700; }
.pkg .name { color: var(--muted); font-size: 13px; }
.secure-box { margin-top: 20px; border-radius: 20px; padding: 18px; background: linear-gradient(135deg, #F0FDF4, #ECFEFF); border: 1px solid #BBF7D0; display: flex; gap: 14px; align-items: center; }
[data-theme="dark"] .secure-box { background: #13261F; border-color: #1E4D3A; }
.secure-box .shield { width: 52px; height: 52px; border-radius: 16px; background: var(--success); color: #fff; display: grid; place-items: center; flex: none; }
.secure-box .shield svg { width: 28px; height: 28px; }
.secure-box b { display: block; }
.secure-box small { color: var(--muted); }
.pay-methods { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.pay-methods span { font-size: 11px; font-weight: 800; padding: 4px 10px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); color: var(--muted); }
.secure-line { margin-top: 14px; color: var(--success); font-weight: 700; font-size: 13px; text-align: center; }
.badge-list { display: grid; gap: 10px; }
.badge-item { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 16px; background: var(--bg); }
.badge-item .meta { flex: 1; }
.badge-item small { color: var(--muted); display: block; }
.tx { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.tx:last-child { border-bottom: 0; }
.tx small { color: var(--muted); display: block; }
.tx .plus { color: var(--success); font-weight: 800; white-space: nowrap; }
.tx .minus { color: var(--danger); font-weight: 800; white-space: nowrap; }
.mode-flag { display: inline-block; background: #FEF3C7; color: #92400E; font-size: 12px; padding: 4px 10px; border-radius: 99px; font-weight: 700; }

/* ---------- result pages ---------- */
.center-page { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.result-card { padding: 36px; text-align: center; max-width: 440px; width: 100%; }
.result-emoji { font-size: 60px; }
.result-card h1 { font-size: 24px; margin: 10px 0; }
.result-card p { color: var(--muted); line-height: 1.8; }
.receipt { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; text-align: start; background: var(--bg); padding: 16px; border-radius: 16px; margin: 18px 0 0; }
.receipt dt { color: var(--muted); }
.receipt dd { margin: 0; font-weight: 700; text-align: end; word-break: break-all; }
.row-btns { display: flex; gap: 10px; justify-content: center; margin-top: 20px; }

/* ---------- admin ---------- */
.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin-table th, .admin-table td { text-align: start; padding: 10px 8px; border-bottom: 1px solid var(--line); }
.admin-table th { color: var(--muted); font-weight: 700; font-size: 12px; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { padding: 18px; }
.stat b { display: block; font-size: 26px; color: var(--primary); }
.stat small { color: var(--muted); }

/* ---------- responsive ---------- */
@media (max-width: 1280px) {
  .app, .app.no-details { grid-template-columns: 210px 300px 1fr; }
  .app .details { position: fixed; inset-block: 18px; inset-inline-end: 18px; width: 300px; z-index: 30; background: var(--bg); border-radius: var(--radius); padding: 0; box-shadow: var(--shadow-lg); }
  .app.no-details .details { display: none; }
}
@media (max-width: 980px) {
  .app, .app.no-details { grid-template-columns: 76px 1fr; gap: 12px; padding: 12px; }
  .app .main { display: none; }
  .app.in-chat .list { display: none; }
  .app.in-chat .main { display: flex; }
  .nav { padding: 16px 10px; align-items: center; }
  .nav .brand span, .nav-item span:not(.nav-emoji), .nav .new-chat span, .wallet-mini, .me-row .meta { display: none; }
  .nav .new-chat { padding: 12px; width: 48px; height: 48px; }
  .nav-item { justify-content: center; position: relative; }
  .nav-item .badge-count { position: absolute; top: 2px; inset-inline-end: 2px; min-width: 18px; height: 18px; font-size: 10px; }
  .chat-head .back { display: grid; }
  .auth { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .grid.cols-2 { grid-template-columns: 1fr; }
}
.grid > * { min-width: 0; }
@media (max-width: 560px) {
  .page { padding: 12px; }
  .section, .balance-hero { padding: 18px; }
  .balance-hero h1 { font-size: 36px; }
  .balance-hero .coin { width: 70px; height: 70px; font-size: 20px; }
  .packages { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .page-top .brand span { display: none; }
  .admin-table { font-size: 12px; }
  .app, .app.no-details { grid-template-columns: 1fr; padding: 0; gap: 0; }
  .app .nav { position: fixed; bottom: 0; inset-inline: 0; flex-direction: row; justify-content: space-around; padding: 8px; z-index: 20; border-radius: 22px 22px 0 0; }
  .app .nav .brand, .app .nav .spacer, .app .nav .new-chat { display: none; }
  .nav-item { width: auto; }
  .me-row { margin: 0; }
  .app .list, .app .main { border-radius: 0; height: calc(100vh - 64px); }
  .app.in-chat .main { height: 100vh; height: 100dvh; position: fixed; inset: 0; z-index: 25; border-radius: 0; }
  .msg { max-width: 88%; }
  .feed { padding: 14px; }
  .app .details { inset: 0; width: auto; border-radius: 0; }
}

/* ---------- transfer gift message & notification ---------- */
.bubble-m.gift { text-align: center; min-width: 190px; padding: 14px 18px 8px; background: linear-gradient(160deg, #FFF7D6, #FFE7A3) !important; border: 1px solid #F6D57A; color: #5B3E00; }
.bubble-m.gift .gift-icon { font-size: 34px; line-height: 1; margin-bottom: 4px; }
.bubble-m.gift .gift-title { font-weight: 800; font-size: 14px; }
.bubble-m.gift .gift-amount { font-size: 24px; font-weight: 900; color: #B7791F; margin: 2px 0; }
.bubble-m.gift .gift-note { font-size: 12px; opacity: .75; }
.bubble-m.gift .foot { color: #8A6A1F; }
[data-theme="dark"] .bubble-m.gift { background: linear-gradient(160deg, #3D3212, #4A3A0E) !important; border-color: #6B5418; color: #FDE7A8; }
[data-theme="dark"] .bubble-m.gift .gift-amount { color: #FBBF24; }
.toast.gift-toast { display: grid; gap: 2px; text-align: center; border-radius: 18px; background: linear-gradient(135deg, #F59E0B, #D97706); color: #fff; padding: 14px 24px; font-size: 15px; }
.toast.gift-toast span { font-size: 13px; opacity: .95; }

/* ---------- side menu fits short screens (laptops) ---------- */
@media (min-width: 981px) and (max-height: 1000px) {
  .app { padding: 12px; gap: 12px; }
  .nav { padding: 14px 12px; }
  .nav .brand { padding-bottom: 12px; font-size: 20px; }
  .nav .new-chat { margin-bottom: 10px; padding: 10px 18px; }
  .nav-item { padding: 8px 12px; }
  .wallet-mini { padding: 12px 14px; margin-top: 8px; }
  .wallet-mini b { font-size: 20px; margin: 2px 0; }
  .me-row { margin-top: 8px; padding: 6px; }
}
/* tablets: the icon column scrolls too */
@media (max-width: 980px) {
  .nav { overflow-y: auto; }
}
/* phones: the bottom bar holds many icons -> swipe sideways */
@media (max-width: 560px) {
  .app .nav { overflow-x: auto; overflow-y: hidden; justify-content: flex-start; gap: 2px; scrollbar-width: none; }
  .app .nav::-webkit-scrollbar { display: none; }
  .app .nav .nav-item, .app .nav .me-row { flex: none; width: 52px; padding: 10px 0; }
}

/* phones: chat list fills the screen, tabs scroll sideways instead of wrapping */
@media (max-width: 560px) {
  .list-head { padding: 16px 14px 8px; }
  .tabs { overflow-x: auto; scrollbar-width: none; gap: 4px; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs button { flex: 1 0 auto; padding: 8px 12px; }
  .list-foot { padding: 8px 14px 10px; }
  .list-foot .btn { padding: 10px; font-size: 14px; }
  .list-body { padding-bottom: 8px; }
}

/* ===== phone bottom bar: 5 clear tabs (icon + label) + "المزيد" sheet ===== */
.m-more { display: none !important; }
@media (max-width: 560px) {
  .app .nav { overflow: visible; justify-content: space-around; align-items: stretch; gap: 0;
    padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); box-shadow: 0 -6px 20px rgba(76, 64, 160, .10); }
  .app .nav .nav-item, .app .nav .me-row, .app .nav .wallet-mini { display: none; }
  .app .nav .nav-item.m-main, .app .nav .nav-item.m-more { display: flex !important; flex: 1 1 0; width: auto; min-width: 0;
    flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 6px 0 4px; border-radius: 14px; position: relative; }
  .app .nav .nav-item.m-main::after, .app .nav .nav-item.m-more::after { content: attr(data-label); font-size: 10.5px; font-weight: 700; line-height: 1; }
  .app .nav .nav-item svg { width: 22px; height: 22px; }
  .app .nav .nav-item .nav-emoji { font-size: 19px; line-height: 22px; height: 22px; width: auto; }
  .app .nav .nav-item.active { background: none; color: var(--primary); }
  .app .nav .nav-item.active::before { content: ""; position: absolute; top: -4px; width: 26px; height: 3px; border-radius: 0 0 3px 3px; background: var(--primary); }
  .app .nav .nav-item[data-m="1"] { order: 1; } .app .nav .nav-item[data-m="2"] { order: 2; }
  .app .nav .nav-item[data-m="3"] { order: 3; } .app .nav .nav-item[data-m="4"] { order: 4; } .app .nav .nav-item[data-m="5"] { order: 5; }
  .app .nav .nav-item .badge-count { position: absolute; top: 0; inset-inline-end: calc(50% - 22px); min-width: 17px; height: 17px; font-size: 10px; padding: 0 4px; }
  .app .nav .m-more .daily-dot { position: absolute; top: 4px; inset-inline-end: calc(50% - 16px); margin: 0; }
}

/* "المزيد" sheet */
.sheet-back { position: fixed; inset: 0; background: rgba(20, 16, 50, .4); z-index: 60; animation: fade .2s; display: flex; align-items: flex-end; }
.sheet { width: 100%; background: var(--surface); border-radius: 24px 24px 0 0; padding: 10px 16px calc(18px + env(safe-area-inset-bottom)); animation: sheetUp .25s ease; max-height: 85vh; overflow-y: auto; }
@keyframes sheetUp { from { transform: translateY(100%); } }
.sheet-grip { width: 40px; height: 5px; border-radius: 5px; background: var(--line); margin: 0 auto 12px; }
.sheet-me { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 18px; background: var(--bg); margin-bottom: 12px; }
.sheet-me .meta { flex: 1; min-width: 0; }
.sheet-me b, .sheet-me small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sheet-me small { color: var(--muted); font-size: 12px; }
.sheet-me .bal { text-align: center; background: linear-gradient(135deg, var(--primary-2), var(--primary)); color: #fff; border-radius: 14px; padding: 6px 12px; font-weight: 800; font-size: 13px; white-space: nowrap; }
.sheet-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.sheet-item { border: 0; background: var(--bg); border-radius: 18px; padding: 14px 6px; display: grid; justify-items: center; gap: 6px; cursor: pointer; color: var(--text); font-weight: 700; font-size: 12.5px; position: relative; }
.sheet-item .si-ic { font-size: 24px; line-height: 1; }
.sheet-item:active { transform: scale(.97); }
.sheet-item .daily-dot { position: absolute; top: 10px; inset-inline-end: 14px; margin: 0; }

/* ===== phone chat screen: compact header, composer always visible ===== */
.chat-head b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-head small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 560px) {
  .chat-head { gap: 8px; padding: 8px 10px; padding-top: calc(8px + env(safe-area-inset-top)); min-height: 60px; }
  .chat-head .av, .chat-head .group-av { width: 40px; height: 40px; }
  .chat-head .group-av { font-size: 20px; border-radius: 12px; }
  .chat-head b { font-size: 15.5px; display: flex; align-items: center; gap: 2px; }
  .chat-head small { font-size: 12px; display: block; }
  .chat-head small .on { vertical-align: middle; margin-inline-end: 4px; }
  .chat-head .status-chip { display: none; }
  .chat-head .icon-btn { width: 38px; height: 38px; font-size: 16px; flex: none; }
  .chat-head .icon-btn svg { width: 18px; height: 18px; }
  .chat-head .icon-btn[title="التفاصيل"] { display: none; }        /* tap the name to open details */
  .feed { padding: 10px 10px 4px; }
  .composer-wrap { margin: 6px 8px calc(8px + env(safe-area-inset-bottom)); }
  .composer { gap: 4px; padding: 5px; }
  .composer .icon-btn { width: 38px; height: 38px; font-size: 17px; }
  .composer .icon-btn[title="إيموجي"] { display: none; }          /* the phone keyboard has emoji */
  .composer textarea { padding: 8px 4px; font-size: 16px; min-width: 0; }   /* 16px stops iOS zooming in */
  .send-btn { width: 42px; height: 42px; }
  .composer .pop { bottom: 56px; inset-inline-end: 0; max-width: calc(100vw - 16px); }
  .sticker-pop { grid-template-columns: repeat(5, 1fr); width: calc(100vw - 16px); }
  .games-pop { width: calc(100vw - 16px); }
  #voice-dock { bottom: calc(76px + env(safe-area-inset-bottom)); }
  .msg { max-width: 92%; }
  .msg .av { width: 28px; height: 28px; }
}

/* ===== PWA: install reminder banner + guide ===== */
#pwa-banner { position: fixed; z-index: 45; left: 12px; right: 12px; bottom: calc(76px + env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 10px;
  background: var(--surface); border-radius: 20px; padding: 10px 12px; box-shadow: 0 16px 40px rgba(30, 27, 57, .25); border: 1px solid var(--line); animation: pwaUp .35s ease; }
@keyframes pwaUp { from { transform: translateY(30px); opacity: 0; } }
#pwa-banner img { width: 44px; height: 44px; border-radius: 12px; flex: none; }
#pwa-banner .pb-text { flex: 1; min-width: 0; }
#pwa-banner .pb-text b { display: block; font-size: 14px; }
#pwa-banner .pb-text small { display: block; font-size: 11.5px; color: var(--muted); line-height: 1.5; }
#pwa-banner .pb-go { padding: 9px 16px; font-size: 13px; flex: none; }
#pwa-banner .pb-later { border: 0; background: none; color: var(--muted); font-size: 12px; cursor: pointer; flex: none; padding: 6px 2px; }
@media (min-width: 561px) { #pwa-banner { left: auto; right: 22px; bottom: 22px; width: 380px; } }
.pwa-guide { text-align: center; }
.pwa-guide .pwa-icon { width: 72px; height: 72px; border-radius: 18px; margin: 0 auto 12px; display: block; box-shadow: 0 8px 20px rgba(108, 92, 231, .3); }
.pwa-guide .pwa-step { text-align: start; background: var(--bg); border-radius: 14px; padding: 10px 14px; margin: 6px 0; line-height: 1.7; font-size: 14px; }
.pwa-guide .pwa-arrow { margin: 10px 0 14px; color: var(--primary); font-weight: 800; animation: bob 1.6s ease-in-out infinite; }
.pwa-settings-btn { background: linear-gradient(135deg, #10B981, #059669); box-shadow: 0 8px 18px rgba(5, 150, 105, .3); }
/* installed app: respect the phone's notch / home bar */
@media (display-mode: standalone) {
  .app { padding-top: env(safe-area-inset-top); }
}

/* official logo image (replaces the old chat-bubble mark) */
img.brand-logo { width: 42px; height: 42px; border-radius: 12px; object-fit: contain; background: none; box-shadow: 0 6px 14px rgba(108, 92, 231, .35); display: block; flex: none; }
.nav img.brand-logo { background: none; }
.auth-art img.brand-logo { box-shadow: 0 6px 18px rgba(0, 0, 0, .25); }
.result-card img.brand-logo, .center-page img.brand-logo { margin: 0; }
.auth-mobile-brand { display: none; }
@media (max-width: 980px) {
  .auth-mobile-brand { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-bottom: 18px; }
  .auth-mobile-brand img.brand-logo { width: 72px; height: 72px; border-radius: 20px; }
  .auth-mobile-brand b { font-size: 20px; }
}
