:root {
  --bg: #f6f5f4;
  --surface: #ffffff;
  --surface-2: #efedec;
  --ink: #221d1f;
  --ink-2: #6e6568;
  --hairline: #e4e0de;
  --teal: #0f766e;
  --teal-strong: #0b5f59;
  --teal-soft: #d9efec;
  --danger: #b4232a;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(34, 29, 31, .06), 0 4px 14px rgba(34, 29, 31, .06);
  --topbar-h: 56px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: 'Tajawal', system-ui, 'Segoe UI', Tahoma, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  padding-bottom: calc(64px + env(safe-area-inset-bottom));
}
img { max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: var(--surface);
  border-bottom: 1px solid var(--hairline);
}
.topbar-inner {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; max-width: 1100px; margin: 0 auto;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 17px; white-space: nowrap; }
.brand-mark { width: 22px; height: 22px; color: var(--teal); flex: 0 0 auto; }
.brand-name { display: inline; }
.search { flex: 1; min-width: 0; display: flex; }
.search input {
  width: 100%; padding: 9px 14px; border: 1px solid var(--hairline);
  border-radius: 999px; background: var(--bg); outline: none;
}
.search input:focus { border-color: var(--teal); background: var(--surface); }
.topnav { display: none; align-items: center; gap: 8px; }
@media (min-width: 720px) { .topnav { display: flex; } }
.icon-btn {
  display: flex; align-items: center; gap: 6px; padding: 8px 10px;
  border-radius: 10px; color: var(--ink-2); font-size: 14px;
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.nav-label { font-weight: 500; }

.cats {
  display: flex; gap: 8px; overflow-x: auto; padding: 0 16px 10px;
  max-width: 1100px; margin: 0 auto; scrollbar-width: none;
}
.cats::-webkit-scrollbar { display: none; }
.cat-chip {
  flex: 0 0 auto; padding: 6px 14px; border-radius: 999px;
  border: 1px solid var(--hairline); background: var(--surface);
  color: var(--ink-2); font-size: 14px; cursor: pointer; white-space: nowrap;
}
.cat-chip[aria-pressed="true"] { background: var(--teal); border-color: var(--teal); color: #fff; font-weight: 700; }

.demo-banner {
  background: #fdf6e3; color: #7c5e10; border-bottom: 1px solid #f0e2b0;
  font-size: 13px; padding: 8px 16px; text-align: center;
}

/* ---------- layout ---------- */
.app { max-width: 1100px; margin: 0 auto; padding: 16px; outline: none; }
.view-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 4px 0 14px; }
.view-head h1 { font-size: 20px; margin: 0; }
.view-head .count { color: var(--ink-2); font-size: 14px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid transparent; border-radius: 10px; cursor: pointer;
  font-weight: 700; padding: 10px 18px; font-size: 15px; transition: background .15s;
}
.btn-sm { padding: 7px 14px; font-size: 14px; }
.btn-primary { background: var(--teal); color: #fff; }
.btn-primary:hover { background: var(--teal-strong); }
.btn-secondary { background: var(--surface); border-color: var(--hairline); color: var(--ink); }
.btn-secondary:hover { background: var(--surface-2); }
.btn-danger { background: #fdecec; color: var(--danger); }
.btn-ghost { background: none; color: var(--teal); padding: 6px 10px; }
.btn[disabled] { opacity: .5; cursor: default; }
.btn-block { width: 100%; }

/* ---------- listing grid / cards ---------- */
.grid { display: grid; gap: 14px; grid-template-columns: repeat(2, 1fr); }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(3, 1fr); gap: 18px; } }
@media (min-width: 960px) { .grid { grid-template-columns: repeat(4, 1fr); } }
.card {
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
  display: flex; flex-direction: column;
}
.card-photo {
  position: relative; display: block; width: 100%; aspect-ratio: 4 / 3;
  background: var(--surface-2); overflow: hidden; cursor: pointer; border: 0; padding: 0;
}
.card-photo img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .2s; }
.card-photo img:not([src]) { opacity: 0; } /* الصورة مخفية لحد ما تنزل (تحميل كسول) */
.card-photo:hover img { transform: scale(1.03); }
.card-photo .badge-cond {
  position: absolute; top: 8px; inset-inline-start: 8px;
  background: rgba(34,29,31,.75); color: #fff; font-size: 12px;
  padding: 2px 10px; border-radius: 999px;
}
.card-photo .badge-cond.new { background: var(--teal); }
.card-photo .badge-sold {
  position: absolute; top: 8px; inset-inline-end: 8px;
  background: #dc2626; color: #fff; font-size: 12px; font-weight: 700;
  padding: 2px 10px; border-radius: 6px;
}
.sold-tag { background: #dc2626; color: #fff; border-radius: 6px; padding: 1px 9px; font-size: 12px; font-weight: 700; }
.card-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 5px; flex: 1; }
.card-title { font-weight: 700; font-size: 15px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-meta { color: var(--ink-2); font-size: 12.5px; }
.card-price { color: var(--teal); font-weight: 800; font-size: 17px; }
.card-actions { display: flex; gap: 8px; margin-top: auto; padding-top: 8px; }
.chip-btn {
  display: inline-flex; align-items: center; gap: 5px;
  border: 1px solid var(--hairline); background: var(--surface);
  border-radius: 999px; padding: 5px 12px; font-size: 13px; cursor: pointer; color: var(--ink-2);
}
.chip-btn.on { background: var(--teal-soft); border-color: var(--teal); color: var(--teal-strong); font-weight: 700; }
.chip-btn svg { width: 15px; height: 15px; }
.mine-tag { background: var(--teal-soft); color: var(--teal-strong); border-radius: 999px; padding: 1px 9px; font-size: 12px; font-weight: 700; }

/* ---------- listing detail ---------- */
.detail { display: grid; gap: 20px; }
@media (min-width: 860px) { .detail { grid-template-columns: 1.1fr 1fr; } }
.gallery-main { width: 100%; aspect-ratio: 4 / 3; object-fit: contain; background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius); display: block; }
.thumbs { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.thumbs button { border: 2px solid var(--hairline); border-radius: 10px; padding: 0; background: var(--surface); cursor: pointer; overflow: hidden; }
.thumbs button[aria-current="true"] { border-color: var(--teal); }
.thumbs img { width: 64px; height: 64px; object-fit: cover; display: block; }
.detail-title { font-size: 22px; font-weight: 800; margin: 0 0 4px; }
.detail-price { font-size: 24px; font-weight: 800; color: var(--teal); margin: 6px 0; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 6px 12px; font-size: 14.5px; margin: 10px 0; }
.kv dt { color: var(--ink-2); } .kv dd { margin: 0; }
.seller-card {
  display: flex; align-items: center; gap: 12px; background: var(--surface);
  border: 1px solid var(--hairline); border-radius: var(--radius); padding: 12px 14px; margin: 14px 0;
}
.avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--teal-soft); color: var(--teal-strong); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 18px; flex: 0 0 auto; }
.seller-card .who { flex: 1; }
.seller-card .who b { display: block; }
.seller-card .who span { color: var(--ink-2); font-size: 13px; }
.section-title { font-weight: 800; font-size: 17px; margin: 22px 0 10px; }

/* ---------- comments ---------- */
.comment { border-top: 1px solid var(--hairline); padding: 10px 0; }
.comment .c-author { font-weight: 700; font-size: 13.5px; }
.comment .c-time { color: var(--ink-2); font-size: 12px; margin-inline-start: 6px; }
.inline-form { display: flex; gap: 8px; margin-top: 10px; }
.inline-form input { flex: 1; padding: 10px 14px; border: 1px solid var(--hairline); border-radius: 999px; background: var(--surface); outline: none; }
.inline-form input:focus { border-color: var(--teal); }

/* ---------- forms ---------- */
.form-card { background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; max-width: 640px; margin: 0 auto; }

[hidden] { display: none !important; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-weight: 700; font-size: 14px; }
.field input, .field select, .field textarea {
  padding: 10px 12px; border: 1px solid var(--hairline); border-radius: 10px;
  background: var(--surface); outline: none; width: 100%;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--teal); }
.field textarea { min-height: 90px; resize: vertical; }
.field .hint { color: var(--ink-2); font-size: 12.5px; }
.seg { display: flex; gap: 8px; flex-wrap: wrap; }
.seg button { border: 1px solid var(--hairline); background: var(--surface); border-radius: 999px; padding: 7px 16px; cursor: pointer; font-size: 14px; }
.seg button[aria-pressed="true"] { background: var(--teal); color: #fff; border-color: var(--teal); font-weight: 700; }
.photo-picker { display: flex; gap: 8px; flex-wrap: wrap; }
.photo-slot {
  width: 84px; height: 84px; border: 1.5px dashed var(--hairline); border-radius: 10px;
  display: flex; align-items: center; justify-content: center; color: var(--ink-2);
  cursor: pointer; overflow: hidden; position: relative; background: var(--surface); font-size: 22px;
}
.photo-slot img { width: 100%; height: 100%; object-fit: cover; }
.photo-slot .rm { position: absolute; top: 2px; inset-inline-end: 2px; background: rgba(34,29,31,.7); color: #fff; border: 0; border-radius: 50%; width: 20px; height: 20px; font-size: 12px; cursor: pointer; line-height: 1; }
.form-error { color: var(--danger); font-size: 14px; margin: 4px 0; }
.form-note { color: var(--teal-strong); font-size: 14px; margin: 4px 0; }

/* ---------- auth ---------- */
.auth-card { max-width: 420px; margin: 24px auto; background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; }
.auth-tabs { display: flex; background: var(--surface-2); border-radius: 10px; padding: 4px; margin-bottom: 18px; }
.auth-tabs button { flex: 1; border: 0; background: none; padding: 8px; border-radius: 8px; cursor: pointer; font-weight: 700; color: var(--ink-2); }
.auth-tabs button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.divider { display: flex; align-items: center; gap: 10px; color: var(--ink-2); font-size: 13px; margin: 14px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--hairline); }

/* ---------- inbox / chat ---------- */
.conv-row { display: flex; gap: 12px; align-items: center; padding: 12px 10px; border-bottom: 1px solid var(--hairline); }
.conv-row:hover { background: var(--surface); }
.conv-row .who { flex: 1; min-width: 0; }
.conv-row .who b { display: block; }
.conv-row .who .sub { color: var(--ink-2); font-size: 13px; display: flex; align-items: baseline; gap: 4px; }
.conv-row .who .sub .sub-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.conv-row .time { color: var(--ink-2); font-size: 12px; }
.conv-row .side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.conv-badge { position: static; }
.more-link { color: var(--teal); font-weight: 700; flex-shrink: 0; }
.chat-wrap { display: flex; flex-direction: column; height: calc(100dvh - 200px); min-height: 380px; }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--hairline); }
.chat-head .about { flex: 1; min-width: 0; }
.chat-head .about b { display: block; }
.chat-head .about a { color: var(--teal); font-size: 13px; }
.msgs { flex: 1; overflow-y: auto; padding: 14px 4px; display: flex; flex-direction: column; gap: 8px; }
.msg { max-width: 78%; padding: 9px 13px; border-radius: 16px; font-size: 15px; width: fit-content; }
.msg.them { background: var(--surface); border: 1px solid var(--hairline); border-start-start-radius: 4px; align-self: flex-start; }
.msg.me { background: var(--teal); color: #fff; border-start-end-radius: 4px; align-self: flex-end; }
.msg .m-time { display: block; font-size: 11px; opacity: .7; margin-top: 3px; }
.chat-input { display: flex; gap: 8px; padding-top: 10px; border-top: 1px solid var(--hairline); }
.chat-input input { flex: 1; min-width: 0; padding: 11px 14px; border: 1px solid var(--hairline); border-radius: 999px; outline: none; background: var(--surface); }
.chat-input input:focus { border-color: var(--teal); }
.chat-input .icon-btn { display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--hairline); background: var(--surface); color: var(--ink-2); cursor: pointer; flex-shrink: 0; padding: 0; }
.chat-input .icon-btn svg { width: 19px; height: 19px; }
.chat-input .icon-btn:active { border-color: var(--teal); color: var(--teal); }
.rec-bar { display: flex; align-items: center; gap: 10px; padding-top: 10px; border-top: 1px solid var(--hairline); }
.rec-bar[hidden] { display: none; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger, #c0392b); animation: rec-blink 1s ease-in-out infinite; }
@keyframes rec-blink { 50% { opacity: .25; } }
.rec-time { font-weight: 700; font-variant-numeric: tabular-nums; flex: 1; }
.rec-cancel { border: 0; background: none; color: var(--ink-2); font-size: 14.5px; cursor: pointer; padding: 8px; }
.msg .att { display: block; }
.msg .att-image img { display: block; max-width: 220px; max-height: 280px; width: 100%; object-fit: cover; border-radius: 12px; }
.msg .att-video { max-width: 220px; width: 100%; border-radius: 12px; display: block; background: #000; }
.msg .att-audio { display: flex; align-items: center; gap: 8px; min-width: 190px; }
.msg .att-audio svg { width: 17px; height: 17px; flex-shrink: 0; }
.msg .att-audio audio { width: 150px; max-width: 100%; height: 34px; }
.msg .att-dur { font-size: 12.5px; font-variant-numeric: tabular-nums; }
.msg .att-file { display: flex; align-items: center; gap: 9px; color: inherit; text-decoration: none; }
.msg .att-file svg { width: 22px; height: 22px; flex-shrink: 0; }
.msg .att-file .att-name { font-size: 14px; word-break: break-all; }
.msg .att-file .att-size { font-size: 12px; opacity: .75; white-space: nowrap; }
.msg .att-cap { display: block; margin-top: 6px; }
.msg .att-missing { font-size: 13.5px; opacity: .75; }
.attach-sheet { display: flex; flex-direction: column; gap: 8px; }
.attach-sheet .attach-opt { display: flex; align-items: center; gap: 12px; border: 1px solid var(--hairline); background: var(--surface); border-radius: 12px; padding: 13px 14px; font-size: 15.5px; font-weight: 600; color: var(--ink); cursor: pointer; }
.attach-sheet .attach-opt svg { width: 21px; height: 21px; color: var(--teal); }

/* ---------- misc ---------- */
.empty { text-align: center; color: var(--ink-2); padding: 48px 16px; }
.empty .big { display: block; margin-bottom: 8px; color: var(--ink-2); }
.empty .big svg { width: 34px; height: 34px; }
.notice { background: var(--surface); border: 1px solid var(--hairline); border-inline-start: 3px solid var(--teal); border-radius: 10px; padding: 12px 14px; font-size: 14px; color: var(--ink-2); margin: 12px 0; }
.spinner { display: flex; justify-content: center; padding: 40px; }
.spinner::after { content: ""; width: 26px; height: 26px; border: 3px solid var(--hairline); border-top-color: var(--teal); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast {
  position: fixed; bottom: calc(76px + env(safe-area-inset-bottom)); inset-inline: 16px;
  background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 12px;
  text-align: center; font-size: 14.5px; z-index: 50; box-shadow: var(--shadow);
}
.back-link { color: var(--ink-2); font-size: 14px; display: inline-block; margin-bottom: 10px; }
.tabs-simple { display: flex; gap: 6px; margin-bottom: 14px; border-bottom: 1px solid var(--hairline); }
.tabs-simple button { border: 0; background: none; padding: 9px 12px; cursor: pointer; color: var(--ink-2); font-weight: 700; border-bottom: 2.5px solid transparent; margin-bottom: -1px; }
.tabs-simple button[aria-pressed="true"] { color: var(--teal); border-bottom-color: var(--teal); }

/* ---------- bottom bar (mobile) ---------- */
.bottombar {
  position: fixed; bottom: 0; inset-inline: 0; z-index: 30;
  display: flex; background: var(--surface); border-top: 1px solid var(--hairline);
  padding-bottom: env(safe-area-inset-bottom);
}
.bottombar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 0 6px; font-size: 11.5px; color: var(--ink-2);
}
.bottombar a.active { color: var(--teal); font-weight: 700; }
.bottombar .tab-ic { display: flex; }
.bottombar .tab-ic svg { width: 21px; height: 21px; }
.bottombar .tab-new .tab-ic {
  background: var(--teal); color: #fff; width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; margin-top: -18px;
  box-shadow: var(--shadow); border: 3px solid var(--bg);
}
.bottombar .tab-new .tab-ic svg { width: 20px; height: 20px; }
@media (min-width: 720px) {
  .bottombar { display: none; }
  body { padding-bottom: 0; }
}

/* test/sample banner */
.test-banner {
  background: #b45309;
  color: #fff;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 12px;
  line-height: 1.5;
}

.confirm-overlay { position: fixed; inset: 0; background: rgba(34,29,31,.45); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 1000; }
.confirm-box { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; width: min(360px, 100%); }
.confirm-box p { margin: 0 0 16px; font-weight: 600; }
.confirm-actions { display: flex; gap: 10px; justify-content: flex-start; }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }

/* Incoming unread message counts, account credit and chat verse. */
.unread-badge { display:inline-flex; align-items:center; justify-content:center; min-width:19px; height:19px; padding:0 5px; border-radius:12px; background:#b91c1c; color:white; font-size:11px; font-weight:800; line-height:1; font-family:Arial,sans-serif; }
.unread-badge[hidden] { display:none; }
.bottombar a, #nav-chats { position:relative; }
.bottombar [data-unread] { position:absolute; top:2px; inset-inline-start:calc(50% + 5px); }
#nav-chats [data-unread] { margin-inline-start:3px; }
.account-heading { align-items:center; }
.developer-credit { max-width:265px; color:var(--ink-2); font-size:12px; line-height:1.8; text-align:left; font-weight:500; }
.site-credit { text-align:center; color:var(--ink-2); font-size:12px; line-height:1.8; font-weight:500; margin:28px 0 4px; }
.chat-verse { background:#f0f8f5; border:1px solid #cce4da; border-radius:14px; padding:18px 20px; margin-bottom:16px; color:#174b40; text-align:center; }
.chat-verse p { margin:0 0 8px; font-family:Tahoma,Arial,sans-serif; font-size:15px; line-height:2; }
.chat-verse small { font-size:11px; color:#4b6a60; }
@media(max-width:420px) { .account-heading { gap:8px; } .developer-credit { max-width:230px; font-size:11px; } .chat-verse { padding:14px 15px; } .chat-verse p { font-size:14px; } }

@font-face { font-family:"Amiri Quran"; font-style:normal; font-weight:400; font-display:swap; src:url("fonts/amiri-quran.ttf") format("truetype"); }
.chat-verse p { font-family:"Amiri Quran",serif; font-size:15px; line-height:2; }

/* Next steps after email confirmation, signup only. */
.signup-guidance { margin-top: 16px; padding: 14px 16px; border: 1px solid #f5b56b; border-inline-start: 4px solid #ea7a17; border-radius: 10px; background: #fff1df; color: #763607; font-size: 14px; line-height: 1.9; overflow-wrap: anywhere; }

.avatar-btn { border: 2px solid var(--teal); cursor: pointer; font-family: inherit; }
.avatar-btn:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }
.acct-details { background: #fff; border: 1px solid var(--line, #e3e8ee); border-radius: 14px; padding: 14px; margin: 0 0 14px; display: flex; flex-direction: column; gap: 12px; }
.acct-details[hidden] { display: none; }
.acct-details h2 { margin: 0; font-size: 17px; }
.acct-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.acct-label { font-weight: 700; }
.acct-email { overflow-wrap: anywhere; }
.acct-note { color: var(--ink-2); font-size: 12.5px; }
.acct-form { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--line, #e3e8ee); padding-top: 12px; }
.acct-form label { font-weight: 700; font-size: 14px; }
.acct-form input { padding: 10px; border: 1.5px solid var(--line, #d5dbe3); border-radius: 10px; font: inherit; width: 100%; box-sizing: border-box; }
.acct-form .inline-form { display: flex; gap: 8px; }

/* push notification opt-in card */
.push-card { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.push-card span { flex: 1 1 220px; }
/* ---------- طلب تفعيل الإشعارات عند الدخول (أندرويد) ---------- */
.push-entry { padding: 12px 16px 0; max-width: 1100px; margin: 0 auto; }
.push-entry-card {
  background: var(--surface); border: 1.5px solid var(--teal); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 8px;
}
.push-entry-title { font-size: 17px; font-weight: 800; }
.push-entry-text { font-size: 14px; color: var(--ink-2); line-height: 1.7; }
.push-entry-actions { display: flex; gap: 8px; flex-wrap: wrap; }
/* أول دخولة: الطلب بنص الشاشة فوق كل اشي */
.push-entry-modal-wrap {
  position: fixed; inset: 0; z-index: 1000; max-width: none; margin: 0; padding: 20px;
  background: rgba(34,29,31,.45); display: flex; align-items: center; justify-content: center;
}
.push-entry-modal-wrap[hidden] { display: none; }
.push-entry-modal {
  background: var(--surface); border: 1.5px solid var(--teal); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 22px 18px; width: min(360px, 100%);
  display: flex; flex-direction: column; gap: 12px; text-align: center;
}
.push-entry-modal .push-entry-title { font-size: 19px; }
.push-entry-modal .push-entry-actions { justify-content: center; }
/* بعد «لاحقًا»: تذكرة صغيرة معلّقة من فوق */
.push-entry-strip {
  background: var(--surface); border: 1.5px solid var(--teal); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 8px 12px;
  display: flex; align-items: center; gap: 10px;
}
.push-entry-strip-text { flex: 1; font-size: 13px; color: var(--ink-2); line-height: 1.5; }
.push-entry-how { font-size: 13px; color: var(--ink-2); line-height: 1.7; background: var(--bg, #f6f5f4); border-radius: 10px; padding: 8px 10px; }

/* Wide Android reminders, install and notifications are separate steps. */
.push-entry-wide { flex-wrap: wrap; padding: 16px; background: #e5f5f1; border-width: 2px; }
.push-entry-wide .push-entry-strip-text { flex: 1 1 180px; font-size: 20px; font-weight: 800; color: var(--teal); }
.push-entry-wide .push-entry-actions { flex: 1 1 100%; }
.push-entry-wide .push-entry-actions .btn-primary { flex: 1; min-height: 46px; font-size: 17px; }
.push-entry-wide > .push-entry-text, .push-entry-wide > .push-entry-how { flex: 1 1 100%; }

/* Keep manual iOS installation steps readable on small screens. */
.push-entry-modal { max-height: calc(100dvh - 32px); overflow-y: auto; }
.ios-install-steps { text-align: right; }
.ios-install-steps ol { padding-right: 22px; margin: 8px 0; }
.ios-install-steps li + li { margin-top: 5px; }

.ios-install-steps > b { display: block; font-size: 16px; color: var(--teal); }
.ios-install-steps ol { list-style: decimal; }
.ios-install-steps li { margin: 0 0 16px; padding-right: 3px; }
.ios-install-steps li:last-child { margin-bottom: 0; }
.ios-install-steps p { margin: 6px 0; }
.ios-step-heading { display: flex; align-items: center; gap: 9px; color: var(--ink); }
.ios-guide-icon { flex: 0 0 28px; width: 28px; height: 28px; color: #0f766e; }
.ios-install-steps .ios-guide-note { font-size: 12px; line-height: 1.8; }

.push-entry-ios .push-entry-modal > .push-entry-text { font-size: 16px; line-height: 1.8; }
.ios-guide-short li { margin-bottom: 13px; }
.ios-guide-short .ios-step-heading { line-height: 1.7; }

.ios-install-steps .ios-guide-closing { margin: 14px 0 8px; font-size: 14px; line-height: 1.8; color: var(--ink); }

/* Admin-authored notification messages */
.admin-head-actions{display:flex;align-items:center;gap:10px;flex-wrap:wrap}.broadcast-card{margin-bottom:16px}.broadcast-card h2{font-size:18px;margin:0 0 12px}.broadcast-card textarea{display:block;width:100%;box-sizing:border-box;min-height:125px;resize:vertical;font:inherit;line-height:1.7;border:1px solid var(--border,#ddd);border-radius:12px;padding:12px;background:var(--surface,#fff);color:inherit}.broadcast-card label{display:block;font-weight:700;margin-bottom:8px}.broadcast-count{text-align:left;font-size:12px;color:#64748b;margin:5px 0 15px}.broadcast-preview{display:flex;align-items:flex-start;gap:12px;background:#f3f5f8;color:#172033;border:1px solid #dce2ea;padding:15px;border-radius:15px}.broadcast-preview img{border-radius:10px;flex:none}.broadcast-preview p{margin:6px 0 0;white-space:pre-wrap;overflow-wrap:anywhere}.broadcast-note{font-size:12px;line-height:1.7}.broadcast-history-row{padding:12px 0;border-bottom:1px solid #e2e8f0}.broadcast-history-row p{margin:6px 0;white-space:pre-wrap;overflow-wrap:anywhere}.broadcast-history-row small{color:#64748b}#broadcast-result{margin-top:14px;line-height:1.8;overflow-wrap:anywhere}

.broadcast-count{direction:ltr;unicode-bidi:isolate}

.gallery-photo-choice{display:flex;align-items:center;justify-content:center;width:100%;height:100%;min-width:58px;min-height:58px;font-weight:700;font-size:13px;color:var(--ink-2,#475569);background:var(--bg,#f3f5f8)}

.corner-conversation{border:1px solid #b8d8d4;border-radius:14px;background:#f0faf8;margin-bottom:12px}.corner-brand-avatar{background:transparent;flex-shrink:0}.corner-brand-avatar img{border-radius:12px}.conv-body{flex:1;min-width:0}.conv-body>b{display:block}.conv-preview{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--ink-2);font-size:13px;margin-top:5px}.corner-official{font-size:10px;color:#0f766e}.corner-pin{font-size:11px;color:#0f766e;flex-shrink:0}.corner-readonly-title{display:block;color:var(--ink-2);margin-top:4px}.corner-trial{margin:10px 0;font-size:12px}.corner-readonly{padding:14px;border-top:1px solid var(--hairline);text-align:center;color:var(--ink-2);font-size:13px}.corner-message{white-space:normal}.corner-message p{white-space:pre-wrap;overflow-wrap:anywhere;margin:8px 0}.corner-messages .empty{margin:auto}

.brand .brand-mark{width:36px;height:36px;object-fit:contain;border-radius:9px}.brand{gap:7px}

.site-cover{display:block;width:100%;max-height:220px;object-fit:cover;border-radius:14px;margin:0 0 14px}.avatar-img,.site-img-prev img{width:100%;height:100%;border-radius:50%;object-fit:cover;display:block}.site-img-prev{overflow:hidden}.avatar-btn{overflow:hidden;padding:0}

/* Google sign-in */
.auth-or{display:flex;align-items:center;gap:10px;margin:14px 0 10px;color:var(--muted,#777);font-size:13px}
.auth-or::before,.auth-or::after{content:"";flex:1;height:1px;background:var(--line,#ddd)}
.btn-google{display:flex;align-items:center;justify-content:center;gap:10px;background:#fff;color:#3c4043;border:1px solid #dadce0;font-weight:600}
.auth-legal{margin-top:10px;font-size:12px;color:var(--muted,#777);text-align:center}
.auth-legal a{color:inherit;text-decoration:underline}

/* home banner (admin-set image + description, staged to admins first) */
.site-banner{display:flex;align-items:stretch;margin:0 0 14px;border-radius:14px;overflow:hidden;background:#fff;border:1px solid var(--line,#e3e8ee)}
.site-banner-img{width:50%;max-height:210px;object-fit:cover;display:block}
.site-banner-text{flex:1;display:flex;align-items:center;padding:14px;font-weight:700;line-height:1.8;white-space:pre-wrap;overflow-wrap:anywhere}
.site-banner-preview{margin:0 0 12px}
@media (max-width:520px){.site-banner-img{max-height:150px}}

/* profile pages + phone gate (staged) */
.user-link { color: inherit; text-decoration: none; display: contents; }
.chat-head .about a.user-link, .seller-card .who a.user-link { color: inherit; font-size: inherit; display: block; }
.c-author a.user-link { display: inline; font-weight: inherit; }
.user-page { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 28px 16px; margin-top: 12px; background: var(--surface); border: 1px solid var(--hairline); border-radius: 14px; text-align: center; }
.user-avatar { width: 84px; height: 84px; font-size: 36px; }
.user-name { margin: 0; font-size: 22px; }
.user-phone { display: flex; flex-direction: column; gap: 6px; align-items: center; color: var(--ink-2); font-size: 14px; }
.user-phone .phone-link { font-size: 22px; font-weight: 800; color: var(--teal-strong); text-decoration: none; letter-spacing: .5px; }
.user-phone-none { font-size: 15px; }
.phone-gate { margin-top: 16px; }

/* reply to message (staged) */
.msg .quote { display: block; width: 100%; text-align: start; border: 0; border-inline-start: 3px solid var(--teal); background: rgba(0,0,0,.07); border-radius: 8px; padding: 4px 8px; margin-bottom: 5px; font: inherit; font-size: 12.5px; color: inherit; cursor: pointer; }
.msg.me .quote { border-inline-start-color: #fff; background: rgba(255,255,255,.2); }
.msg .quote b { display: block; font-size: 12px; }
.msg .quote span { display: block; opacity: .85; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; }
.msg .quote-gone { cursor: default; font-style: italic; opacity: .8; }
.msg .reply-btn { border: 0; background: none; color: inherit; opacity: .75; font-size: 15px; padding: 0 6px; cursor: pointer; margin-inline-start: 6px; }
.msg.flash { animation: msgflash 1.3s; }
@keyframes msgflash { 0%,60% { box-shadow: 0 0 0 3px rgba(0,150,140,.45); } 100% { box-shadow: none; } }
.reply-bar { display: flex; align-items: center; gap: 8px; padding: 6px 10px; margin-top: 8px; background: var(--surface); border: 1px solid var(--hairline); border-inline-start: 3px solid var(--teal); border-radius: 10px; font-size: 13px; }
.reply-bar[hidden] { display: none; }
.reply-bar .rb-main { flex: 1; min-width: 0; }
.reply-bar .rb-who { display: block; color: var(--teal); font-size: 12px; }
.reply-bar .rb-text { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.reply-bar .rb-x { border: 0; background: none; font-size: 16px; padding: 4px 8px; cursor: pointer; color: var(--ink-2); }

.phone-strip { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 8px 12px; padding: 10px 14px; background: #fff7e6; border: 1px solid #f0d9a8; border-radius: 12px; font-size: 14px; font-weight: 700; color: #7a5200; }
#phone-strip[hidden] { display: none; }

.msg[data-message-id] { touch-action: pan-y; user-select: none; -webkit-user-select: none; }

/* ---------- light/dark mode (admin-only for now; class set from app.js) ---------- */
.theme-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--surface); border: 1px solid var(--hairline); border-radius: 12px; padding: 10px 14px; margin-bottom: 12px; font-weight: 700; }
.theme-row .seg { display: flex; gap: 6px; }
body.theme-dark {
  --bg: #121416; --surface: #1c1f22; --surface-2: #272b2f; --ink: #eceff1; --ink-2: #9ea8ad;
  --hairline: #31363a; --teal-soft: #12403d; --teal-strong: #6fdcd0; --danger: #f2777d;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 4px 14px rgba(0,0,0,.35);
  --line: #31363a; --border: #31363a; --muted: #9ea8ad;
  color-scheme: dark;
}
body.theme-dark .acct-details, body.theme-dark .site-banner { background: var(--surface); }
body.theme-dark .chat-verse { background: #14302b; border-color: #24524a; color: #bfe9df; }
body.theme-dark .chat-verse small { color: #8fc2b6; }
body.theme-dark .corner-conversation { background: #14302b; border-color: #24524a; }
body.theme-dark .demo-banner { background: #3a3014; color: #f1d98a; border-color: #5a4a1c; }
body.theme-dark .phone-strip { background: #3a3014; color: #f1d98a; border-color: #5a4a1c; }
body.theme-dark .signup-guidance { background: #3a2410; color: #f6c590; border-color: #7a4a1c; }
body.theme-dark .push-entry-wide { background: #14302b; }
body.theme-dark .btn-danger { background: #3b1f21; color: #f2777d; border-color: #5a2a2d; }
body.theme-dark .broadcast-preview { background: var(--surface-2); color: var(--ink); border-color: var(--hairline); }
body.theme-dark .broadcast-history-row { border-color: var(--hairline); }
body.theme-dark .toast { background: #eceff1; color: #121416; }
body.theme-dark .msg.me { color: #fff; }
.card-photo { background: linear-gradient(110deg, #ececec 30%, #f6f6f6 50%, #ececec 70%); background-size: 200% 100%; animation: ctshimmer 1.4s linear infinite; }
@keyframes ctshimmer { to { background-position: -200% 0; } }
