/* ═══════════════════════════════════════════════════════════════════════
   تمكين الداعية — واجهة المنصة (التصميم الجديد، أكتوبر 2026)
   Design system ported from «Design feedback request v5»: every colour is a
   token (light values in :root, dark values under html[data-theme="dark"]),
   the primary family (--p…) re-colours per chat (body.theme-nm = كحلي),
   icons are masked SVGs from chat/static/chat/icons/ (.ic-*, defined in
   icons.css, which the admin panel loads too), and the
   layout is a sticky sidebar beside a white panel; under 910px the sidebar
   becomes a drawer and a bottom nav appears.
   The admin and login pages keep the previous stylesheet (legacy.css).
   ═══════════════════════════════════════════════════════════════════════ */

:root {
  --p: #14453A;
  --p-h: #1F5A4B;
  --p-2: #1A5244;
  --p-3: #2B6656;
  --p-ink: #2F4F47;
  --p-50: #EAF2EE;
  --p-200: #CBDDD5;
  --p-250: #C3D8CF;
  --p-300: #A9C4BA;
  --p-400: #8AAA9F;
  --p-rgb: 20, 69, 58;
  --bg-F5F2EA: #F5F2EA;
  --fg-1F2937: #1F2937;
  --fg-6B7280: #6B7280;
  --fg-4B5563: #4B5563;
  --bg-EAE4D5: #EAE4D5;
  --bg-FFFFFF: #FFFFFF;
  --bd-E6DDC6: #E6DDC6;
  --fg-374151: #374151;
  --fg-9A7D33: #9A7D33;
  --fg-8E97A6: #8E97A6;
  --fg-A07E2B: #A07E2B;
  --bg-DDD5C2: #DDD5C2;
  --bd-E3D3AA: #E3D3AA;
  --bd-D9C48F: #D9C48F;
  --fg-7A5E1C: #7A5E1C;
  --bg-FBF3DF: #FBF3DF;
  --fg-7A6A45: #7A6A45;
  --fg-B4232A: #B4232A;
  --bd-F3D3D6: #F3D3D6;
  --bg-EFE3C6: #EFE3C6;
  --bg-DCCB9F: #DCCB9F;
  --bd-E9E1CC: #E9E1CC;
  --bg-F3F0E7: #F3F0E7;
  --bd-p-200: var(--p-200);
  --bg-p-50: var(--p-50);
  --fg-p-h: var(--p-h);
  --bd-EEE3C8: #EEE3C8;
  --bg-ECEEF2: #ECEEF2;
  --fg-9AA1AE: #9AA1AE;
  --fg-C7A14E: #C7A14E;
  --bd-D6CBB0: #D6CBB0;
  --bg-FBF8F0: #FBF8F0;
  --bd-E6D6AE: #E6D6AE;
  --bg-F3EBD6: #F3EBD6;
  --bga-255-255-255-96: rgba(255, 255, 255, 0.96);
  --bg-F7F2E6: #F7F2E6;
  --bg-FFFDF7: #FFFDF7;
  --bg-F3F0E8: #F3F0E8;
  --bg-E9E1CC: #E9E1CC;
  --bg-FBF8F1: #FBF8F1;
  --bg-F5ECD5: #F5ECD5;
  --bg-EEDFB8: #EEDFB8;
  --bg-F7F4EC: #F7F4EC;
  --bd-EEE6D2: #EEE6D2;
  --bg-FBF6EA: #FBF6EA;
  --bg-FFFDF8: #FFFDF8;
  --bg-FBEDEE: #FBEDEE;
  --bg-F7DADD: #F7DADD;
  --bd-E0D3B0: #E0D3B0;
  --bd-E0CC98: #E0CC98;
  --bg-F5E9C8: #F5E9C8;
  --bg-F3EFE6: #F3EFE6;
  --bg-EDE6D6: #EDE6D6;
  --bga-255-255-255-97: rgba(255, 255, 255, 0.97);
  --bg-FAF6EE: #FAF6EE;
  --bd-DFD1AE: #DFD1AE;
  --bg-F1E6CC: #F1E6CC;
  --bd-E0CB93: #E0CB93;
  --bd-F0E3BF: #F0E3BF;
  --bd-ECE4D0: #ECE4D0;
  --fg-1F8A5B: #1F8A5B;
  --bg-EEE3C8: #EEE3C8;
  --bg-E1D9C6: #E1D9C6;
  --bd-EADBB4: #EADBB4;
  --bd-CDBB8E: #CDBB8E;
  --fg-D6CBB0: #D6CBB0;
  --bg-111111: #111111;
  --bg-F1EADA: #F1EADA;
  --bd-E6DAB9: #E6DAB9;
  --fg-1D5FA8: #1D5FA8;
  --bg-F3EEE2: #F3EEE2;
  --bd-F3ECDA: #F3ECDA;
  --bg-EFE8D6: #EFE8D6;
  --bd-E3D9C2: #E3D9C2;
  --bd-F5F0E4: #F5F0E4;
  --fg-5B6475: #5B6475;
  --bd-EEDFB8: #EEDFB8;
  --fg-8A6A1E: #8A6A1E;
  --bg-ECE8F5: #ECE8F5;
  --fg-4B3F72: #4B3F72;
  --bg-E8EEF7: #E8EEF7;
  --fg-24497A: #24497A;
  --fg-p: var(--p);
  --bg-FBEFC9: #FBEFC9;
  --fg-5C4715: #5C4715;
  --fg-C9CED8: #C9CED8;
  --bd-C9CED8: #C9CED8;
  --bd-C9BFA6: #C9BFA6;
  --bg-1F2937: #1F2937;
  --bg-F6EDD6: #F6EDD6;
  --bg-EFE2C0: #EFE2C0;
  --bga-245-242-234-94: rgba(245, 242, 234, 0.94);
  --bg-E6DDC6: #E6DDC6;
  --bg-E5E7EB: #E5E7EB;
  --bd-E9E2D0: #E9E2D0;
  --bg-FAF8F2: #FAF8F2;
  --bd-E7A9AE: #E7A9AE;
  --bg-E1D7BF: #E1D7BF;
  --fg-C7B98F: #C7B98F;
  --fg-5B6472: #5B6472;
  --fg-E3ECE8: #E3ECE8;
  --scrim: rgba(17, 24, 39, 0.45);
  --scrim-f: none;
  --modal-sh: 0 40px 80px -30px rgba(17, 24, 39, 0.45);
  --sb: #D6CBB0;
  --pop-bg: #FFFFFF;
  --pop-bd: #E3D3AA;
  --pop-sh: 0 28px 56px -22px rgba(var(--p-rgb), 0.55);
  --card-hi: #FFFFFF;
  --card-hi-bd: #E3D3AA;
  --card-hi-sh: 0 14px 28px -18px rgba(92, 71, 21, 0.5);
  --soc-bd: transparent;
  --sb-h: #CDB680;
  --tabA-read: #8A6A1E;
  --tabA-aud: #4B3F72;
  --tabA-vid: #24497A;
  --logo-f: none;
  --tg-x: 0px;
  --tg-r: 0deg;
  --tg-sun: 1;
  --tg-moon: 0;
  --tg-knob: #FFFFFF;
  --tg-track: #FBF3DF;
  --tg-bd: #E6D6AE;
}
html[data-theme="dark"] {
  color-scheme: dark;
  --logo-f: brightness(0) invert(1) opacity(0.9);
  --tg-x: -30px;
  --tg-r: -360deg;
  --tg-sun: 0;
  --tg-moon: 1;
  --tg-knob: #E8C979;
  --tg-track: #0F1513;
  --tg-bd: #4A4330;
  --bg-F5F2EA: color-mix(in oklab, var(--p) 10%, #151515);
  --fg-1F2937: #E1DDD5;
  --fg-6B7280: #A39F97;
  --fg-4B5563: #BAB7AF;
  --bg-EAE4D5: #322F27;
  --bg-FFFFFF: color-mix(in oklab, var(--p) 10%, #1E1E1E);
  --bd-E6DDC6: #413D32;
  --fg-374151: #CBC7BF;
  --fg-9A7D33: #B89A51;
  --fg-8E97A6: #88847D;
  --fg-A07E2B: #BA9747;
  --bg-DDD5C2: #3D392F;
  --bd-E3D3AA: #4A422E;
  --bd-D9C48F: #554A2F;
  --fg-7A5E1C: #CCAD6E;
  --bg-FBF3DF: #1D1910;
  --fg-7A6A45: #BBAA83;
  --fg-B4232A: #F3918A;
  --bd-F3D3D6: #493A3B;
  --bg-EFE3C6: #352F20;
  --bg-DCCB9F: #483F27;
  --bd-E9E1CC: #3F3B31;
  --bg-F3F0E7: color-mix(in oklab, var(--p) 10%, #131313);
  --bd-p-200: color-mix(in oklab, var(--p) 60%, #3C4440);
  --bg-p-50: color-mix(in oklab, var(--p) 45%, #1A1F1D);
  --fg-p-h: color-mix(in oklab, var(--p) 30%, #E7E1D2);
  --bd-EEE3C8: #3F392D;
  --bg-ECEEF2: color-mix(in oklab, var(--p) 10%, #111111);
  --fg-9AA1AE: #817D76;
  --fg-C7A14E: #C7A14E;
  --bd-D6CBB0: #4D4739;
  --bg-FBF8F0: color-mix(in oklab, var(--p) 10%, #191919);
  --bd-E6D6AE: #48402C;
  --bg-F3EBD6: #17140A;
  --bga-255-255-255-96: rgba(30, 34, 32, 0.96);
  --bg-F7F2E6: color-mix(in oklab, var(--p) 10%, #151515);
  --bg-FFFDF7: color-mix(in oklab, var(--p) 10%, #1E1E1E);
  --bg-F3F0E8: color-mix(in oklab, var(--p) 10%, #131313);
  --bg-E9E1CC: #353126;
  --bg-FBF8F1: color-mix(in oklab, var(--p) 10%, #191919);
  --bg-F5ECD5: #18140A;
  --bg-EEDFB8: #39311D;
  --bg-F7F4EC: color-mix(in oklab, var(--p) 10%, #161616);
  --bd-EEE6D2: #3C382F;
  --bg-FBF6EA: color-mix(in oklab, var(--p) 10%, #181818);
  --bg-FFFDF8: color-mix(in oklab, var(--p) 10%, #1E1E1E);
  --bg-FBEDEE: color-mix(in oklab, var(--p) 10%, #141414);
  --bg-F7DADD: #3A2C2E;
  --bd-E0D3B0: #494231;
  --bd-E0CC98: #50462B;
  --bg-F5E9C8: #312B1B;
  --bg-F3EFE6: color-mix(in oklab, var(--p) 10%, #121212);
  --bg-EDE6D6: #312D26;
  --bga-255-255-255-97: rgba(30, 34, 32, 0.97);
  --bg-FAF6EE: color-mix(in oklab, var(--p) 10%, #181818);
  --bd-DFD1AE: #4A4332;
  --bg-F1E6CC: #332D20;
  --bd-E0CB93: #514629;
  --bd-F0E3BF: #403A28;
  --bd-ECE4D0: #3D3930;
  --fg-1F8A5B: #5ABC8A;
  --bg-EEE3C8: #352F21;
  --bg-E1D9C6: #3A362C;
  --bd-EADBB4: #453E2B;
  --bd-CDBB8E: #595038;
  --fg-D6CBB0: #64615A;
  --bg-111111: #212121;
  --bg-F1EADA: #2E2B23;
  --bd-E6DAB9: #443F2F;
  --fg-1D5FA8: #7DB7FF;
  --bg-F3EEE2: color-mix(in oklab, var(--p) 10%, #121212);
  --bd-F3ECDA: #38352D;
  --bg-EFE8D6: #302C23;
  --bd-E3D9C2: #443F34;
  --bd-F5F0E4: color-mix(in oklab, var(--p) 10%, #323232);
  --fg-5B6475: #AEAAA2;
  --bd-EEDFB8: #433B28;
  --fg-8A6A1E: #C6A45D;
  --bg-ECE8F5: color-mix(in oklab, var(--p) 10%, #292929);
  --fg-4B3F72: #C5BAF6;
  --bg-E8EEF7: color-mix(in oklab, var(--p) 10%, #111111);
  --fg-24497A: #9FC6FB;
  --fg-p: color-mix(in oklab, var(--p) 30%, #E7E1D2);
  --bg-FBEFC9: #2E2815;
  --fg-5C4715: #D7BF8D;
  --fg-C9CED8: #635F58;
  --bd-C9CED8: color-mix(in oklab, var(--p) 10%, #474747);
  --bd-C9BFA6: #534E41;
  --bg-1F2937: #303B4A;
  --bg-F6EDD6: #19150A;
  --bg-EFE2C0: #36301E;
  --bga-245-242-234-94: rgba(21, 26, 24, 0.94);
  --bg-E6DDC6: #383328;
  --bg-E5E7EB: color-mix(in oklab, var(--p) 10%, #2B2B2B);
  --bd-E9E2D0: #3E3A32;
  --bg-FAF8F2: color-mix(in oklab, var(--p) 10%, #191919);
  --bd-E7A9AE: #67474A;
  --bg-E1D7BF: #3C372B;
  --scrim: rgba(3, 5, 4, 0.74);
  --scrim-f: blur(4px);
  --modal-sh:
    0 0 0 1px rgba(232, 201, 121, 0.18), 0 40px 90px -20px rgba(0, 0, 0, 0.85);
  --sb: #4D4739;
  --pop-bg: color-mix(in oklab, var(--p) 16%, #272727);
  --pop-bd: rgba(232, 201, 121, 0.38);
  --pop-sh:
    0 0 0 1px rgba(0, 0, 0, 0.45), 0 32px 70px -16px rgba(0, 0, 0, 0.92);
  --card-hi: linear-gradient(
    180deg,
    color-mix(in oklab, var(--p) 34%, #2A2A2A),
    color-mix(in oklab, var(--p) 18%, #232323)
  );
  --card-hi-bd: rgba(232, 201, 121, 0.42);
  --card-hi-sh: 0 18px 36px -16px rgba(0, 0, 0, 0.9);
  --soc-bd: rgba(255, 255, 255, 0.22);
  --sb-h: #7A6A45;
  --tabA-read: #8F6E22;
  --tabA-aud: #5B4D8E;
  --tabA-vid: #2E5B96;
  --fg-C7B98F: #6B6555;
  --fg-5B6472: #AEAAA2;
}

/* body.theme-nm marks the non-Muslim chat: the design keeps the same
   green primary on both chats (its «أخضر زيتي» default), so the class only
   carries a few phone-layout differences below. */

/* ── Base ─────────────────────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  background: var(--bg-F5F2EA);
}
body {
  font-family: "Cairo", system-ui, sans-serif;
  color: var(--fg-1F2937);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a {
  color: var(--fg-A07E2B);
  text-decoration: none;
}
a:hover {
  color: var(--fg-1F2937);
}
button,
input,
textarea,
select {
  font-family: inherit;
}
button {
  cursor: pointer;
}
input::placeholder,
textarea::placeholder {
  color: var(--fg-9AA1AE);
}
h1,
h2,
h3,
h4,
p,
figure,
blockquote {
  margin: 0;
}
img {
  max-width: 100%;
}
.hidden {
  display: none !important;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.gold {
  color: var(--fg-A07E2B);
}
.q-font {
  font-family: "Amiri", serif;
}

/* ── Keyframes ─────────────────────────────────────────────────────────── */
@keyframes dcPulse {
  0%,
  80%,
  100% {
    opacity: 0.25;
    transform: scale(0.75);
  }
  40% {
    opacity: 1;
    transform: scale(1);
  }
}
@keyframes bobX {
  0%,
  100% {
    transform: translateX(0);
  }
  50% {
    transform: translateX(-6px);
  }
}
@keyframes bobY {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(5px);
  }
}
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.anim-enter {
  animation: fadeUp 0.35s ease both;
}

/* ── Buttons (shared) ──────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 40px;
  padding: 0 16px;
  border-radius: 11px;
  border: 1px solid var(--bd-E6DDC6);
  background: var(--bg-FFFFFF);
  color: var(--fg-374151);
  font-size: 13.5px;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
  transition:
    border-color 0.2s ease,
    background 0.2s ease,
    color 0.2s ease;
}
.btn:hover {
  border-color: #C7A14E;
  color: var(--fg-1F2937);
}
.btn-primary {
  border: 0;
  background: var(--p);
  color: #FFFFFF;
}
.btn-primary:hover {
  background: var(--p-2);
  color: #FFFFFF;
}
.btn-gold {
  border: 1px solid var(--bd-E3D3AA);
  background: var(--bg-FBF3DF);
  color: var(--fg-7A5E1C);
}
.btn-gold:hover {
  background: var(--bg-F5E9C8);
  border-color: #C7A14E;
  color: var(--fg-7A5E1C);
}
.btn-grad {
  border: 0;
  background: linear-gradient(135deg, #C9A94F, #9A7D33);
  color: #FFFFFF;
  box-shadow: 0 10px 22px -12px rgba(154, 125, 51, 0.9);
}
.btn-danger {
  border: 1px solid var(--bd-F3D3D6);
  background: var(--bg-FBEDEE);
  color: var(--fg-B4232A);
}
.btn-danger:hover {
  background: var(--bg-F7DADD);
  color: var(--fg-B4232A);
  border-color: var(--bd-F3D3D6);
}
.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 1px solid var(--bd-E6DDC6);
  background: var(--bg-FFFFFF);
  color: var(--fg-4B5563);
  cursor: pointer;
  transition:
    border-color 0.2s ease,
    color 0.2s ease;
}
.btn-icon:hover {
  border-color: #C7A14E;
  color: var(--fg-1F2937);
}
.btn-ghost {
  border: 0;
  background: transparent;
  color: var(--fg-4B5563);
}
.btn-ghost:hover {
  background: var(--bg-F3EEE2);
  color: var(--fg-1F2937);
}
.btn-lg {
  height: 46px;
  padding: 0 18px;
  font-size: 14.5px;
  border-radius: 12px;
}
.btn[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
}
.spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-right-color: transparent;
  animation: spin 0.8s linear infinite;
  flex: none;
}
.dots {
  display: inline-flex;
  gap: 4px;
}
.dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  animation: dcPulse 1.2s ease-in-out infinite;
}
.dots span:nth-child(2) {
  animation-delay: 0.2s;
}
.dots span:nth-child(3) {
  animation-delay: 0.4s;
}

/* ── Shell ─────────────────────────────────────────────────────────────── */
.app {
  display: flex;
  align-items: flex-start;
  min-height: 100vh;
}
.scrim {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.35);
  z-index: 39;
  display: none;
}
.scrim.open {
  display: block;
}

.sb {
  width: 272px;
  flex: none;
  height: 100vh;
  position: sticky;
  top: 0;
  right: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 12px 12px 6px;
  background: var(--bg-F5F2EA);
}
.app.sb-closed .sb {
  display: none;
}
.sb-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 6px 8px;
}
.sb-logo {
  width: 28px;
  height: 32px;
  object-fit: contain;
  flex: none;
  filter: var(--logo-f);
}
.sb-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
  flex: 1;
  min-width: 0;
  color: inherit;
}
.sb-brand-name {
  font-weight: 900;
  font-size: 19px;
  color: var(--fg-1F2937);
}
.sb-brand-tag {
  font-size: 11.5px;
  color: var(--fg-6B7280);
  font-weight: 600;
}
.sb-collapse {
  width: 32px;
  height: 32px;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 0;
  background: transparent;
  color: var(--fg-4B5563);
}
.sb-collapse:hover {
  background: var(--bg-EAE4D5);
}
.sb-collapse .ic {
  width: 18px;
  height: 18px;
}
.sb-new {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 14px;
  background: rgba(122, 94, 28, 0.075);
  border: 1px solid transparent;
  color: var(--fg-1F2937);
  font-size: 14px;
  font-weight: 700;
  transition: background 0.2s ease;
}
.sb-new:hover {
  background: rgba(122, 94, 28, 0.13);
  color: var(--fg-1F2937);
}
.sb-new-plus {
  width: 26px;
  height: 26px;
  flex: none;
  border-radius: 8px;
  background: var(--bg-FFFFFF);
  border: 1px solid var(--bd-E6DDC6);
  color: var(--fg-4B5563);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.sb-new-plus .ic {
  width: 15px;
  height: 15px;
}
/* The nav itself does not scroll: the chats and tabs cards stay fixed and only the conversation lists (.sb-hist) scroll when they overflow (user request; the design scrolls the whole nav). */
.sb-nav {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin-top: 4px;
}
.sb-nav-inner {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.sb-nav-inner > :not(.sb-hist) {
  flex: none;
}
.sb-hist {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--sb) transparent;
}
.sb-nav-inner {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
/* The two chats: the open one is the card's gold header, the other a plain row. */
.sb-chats {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 3px 0;
  border-radius: 14px;
  background: var(--bg-FFFFFF);
  border: 1px solid var(--bd-E6D6AE);
  box-shadow: 0 12px 26px -18px rgba(154, 125, 51, 0.65);
}
.sb-chat-cur,
.sb-chat-link {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 3px;
  padding: 5px 10px;
  min-height: var(--row-h, 0);
  border-radius: 11px;
  font-size: 12px;
  white-space: nowrap;
}
.sb-chat-cur {
  cursor: default;
  background: linear-gradient(135deg, #C9A94F, #9A7D33);
  color: #FFFFFF;
  font-weight: 800;
}
.sb-chat-cur .ic {
  width: 15px;
  height: 15px;
  background-color: #FFFFFF;
}
.sb-chat-link {
  color: var(--fg-374151);
  font-weight: 700;
}
.sb-chat-link:hover {
  background: var(--bg-EAE4D5);
  color: var(--fg-1F2937);
}
.sb-chat-link .ic {
  width: 15px;
  height: 15px;
  background-color: var(--fg-9A7D33);
}
.sb-secs {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin-top: 8px;
  padding: 5px;
  border-radius: 14px;
  border: 1px solid var(--bd-E6DDC6);
}
.sb-sec {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 10px;
  min-height: var(--row-h, 0);
  white-space: nowrap;
  border-radius: 9px;
  border: 1px solid transparent;
  color: var(--fg-374151);
  font-size: 13px;
  font-weight: 600;
}
.sb-sec:hover {
  background: var(--bg-EAE4D5);
  color: var(--fg-1F2937);
}
.sb-sec .ic {
  width: 21px;
  height: 21px;
  background-color: var(--fg-9A7D33);
}
.sb-sec.is-current {
  background: var(--p);
  color: #FFFFFF;
}
.sb-sec.is-current .ic {
  background-color: #FFFFFF;
}
.sb-sec span {
  overflow: hidden;
  text-overflow: ellipsis;
}
.sb-label {
  padding: 16px 10px 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--fg-8E97A6);
}
/* The design leaves 2px between conversation rows. */
#pinned-list,
#recent-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.conv-row {
  position: relative;
  display: flex;
  align-items: center;
  border-radius: 9px;
}
.conv-row:hover,
.conv-row.active {
  background: var(--bg-EAE4D5);
}
.conv-btn {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  padding-left: 2px;
  border: 0;
  background: transparent;
  color: var(--fg-374151);
  font-size: 13.5px;
  font-weight: 600;
  text-align: right;
}
.conv-btn .ic {
  width: 17px;
  height: 17px;
  background-color: var(--fg-8E97A6);
}
.conv-row.pinned .conv-btn .ic {
  background-color: var(--fg-A07E2B);
}
.conv-btn .conv-title {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.conv-dots {
  width: 28px;
  height: 28px;
  flex: none;
  margin-left: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--fg-4B5563);
  opacity: 0.55;
  transition:
    opacity 0.2s ease,
    background 0.2s ease;
}
/* The design keeps «…» at 55% until it is hovered or its menu is open. */
.conv-dots:hover,
.conv-dots:focus-visible,
.conv-row.menu-open .conv-dots {
  opacity: 1;
  background: var(--bg-DDD5C2);
}
.conv-dots .ic {
  width: 18px;
  height: 18px;
}
.sb-empty {
  margin: 0;
  padding: 4px 10px;
  font-size: 13px;
  line-height: 1.8;
  color: var(--fg-6B7280);
}
.sb-foot {
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--bd-E3D3AA);
}
.sb-login {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 44px;
  padding: 0 8px;
  border: 1px solid var(--bd-D9C48F);
  border-radius: 12px;
  background: var(--bg-FFFFFF);
  color: var(--fg-7A5E1C);
  font-size: 13.5px;
  font-weight: 800;
  text-align: right;
  box-shadow: 0 4px 10px -8px rgba(92, 71, 21, 0.4);
  transition:
    background 0.2s ease,
    border-color 0.2s ease;
}
.sb-login:hover {
  background: var(--bg-FBF3DF);
  border-color: #C7A14E;
  color: var(--fg-7A5E1C);
}
.sb-login-ic {
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: 999px;
  background: var(--bg-FBF3DF);
  border: 1px solid var(--bd-E3D3AA);
  color: var(--fg-A07E2B);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.sb-login-ic .ic {
  width: 15px;
  height: 15px;
}
.sb-login > span:nth-child(2) {
  flex: 1;
  min-width: 0;
}
.sb-user {
  display: flex;
  align-items: center;
  gap: 10px;
}
.sb-avatar {
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 999px;
  background: var(--p);
  color: #FFFFFF;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 800;
}
.sb-user-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.4;
}
.sb-user-name {
  font-size: 13px;
  font-weight: 800;
  color: var(--fg-1F2937);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sb-user-role {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--fg-7A6A45);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sb-user-role a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.sb-logout {
  width: 32px;
  height: 32px;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  border: 1px solid var(--bd-E3D3AA);
  background: var(--bg-FFFFFF);
  color: var(--fg-6B7280);
}
.sb-logout:hover {
  color: var(--fg-B4232A);
  border-color: var(--bd-F3D3D6);
}
.sb-logout .ic {
  width: 15px;
  height: 15px;
}
.sb-links {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 2px;
}
.sb-link {
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 5px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--fg-4B5563);
  font-size: 12px;
  font-weight: 700;
}
.sb-link:hover,
.sb-link.is-current {
  background: var(--bg-EFE3C6);
  color: var(--fg-1F2937);
}
.sb-link .ic {
  width: 14px;
  height: 14px;
  background-color: var(--fg-A07E2B);
}
.sb-links-sep {
  width: 1px;
  height: 14px;
  background: var(--bg-DCCB9F);
}
.sb-copy {
  display: none;
  padding: 0 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--fg-8E97A6);
}

/* Conversation context menu (مشاركة / إعادة تسمية / تثبيت / حذف). */
.ctx-menu {
  position: fixed;
  z-index: 120;
  width: 196px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 5px;
  background: var(--bg-FFFDF8);
  border: 1px solid var(--bd-E3D3AA);
  border-radius: 14px;
  box-shadow:
    0 18px 36px -18px rgba(92, 71, 21, 0.45),
    0 2px 6px rgba(92, 71, 21, 0.06);
  text-align: right;
}
.ctx-menu button {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 34px;
  padding: 0 9px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--fg-1F2937);
  font-size: 13px;
  font-weight: 700;
  text-align: right;
}
.ctx-menu button:hover {
  background: var(--bg-F3EBD6);
}
.ctx-menu button .ic {
  width: 15px;
  height: 15px;
  background-color: var(--fg-A07E2B);
}
.ctx-menu .ctx-sep {
  height: 1px;
  margin: 4px 8px;
  background: var(--bg-EEE3C8);
}
.ctx-menu button.danger {
  color: var(--fg-B4232A);
}
.ctx-menu button.danger:hover {
  background: var(--bg-FBEDEE);
}
.ctx-menu button.danger .ic {
  background-color: var(--fg-B4232A);
}

.main {
  flex: 1;
  min-width: 0;
  padding: 8px;
}
.panel {
  position: relative;
  min-height: calc(100vh - 16px);
  background: var(--bg-FFFFFF);
  border: 1px solid var(--bd-E9E2D0);
  border-radius: 18px;
  overflow: clip;
  display: flex;
  flex-direction: column;
  box-shadow: 0 1px 2px rgba(var(--p-rgb), 0.04);
}

/* ── Header ────────────────────────────────────────────────────────────── */
.hdr {
  position: relative;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 16px;
  min-height: 60px;
  transition: background 0.3s ease;
}
.hdr.has-lang {
  background: var(--bg-FAF8F2);
}
.hdr-start {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
  flex-wrap: wrap;
}
.hdr-toggle {
  width: 36px;
  height: 36px;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 11px;
  border: 1px solid var(--bd-E9E1CC);
  background: var(--bg-FFFFFF);
  color: var(--fg-4B5563);
}
.hdr-toggle:hover {
  border-color: #C7A14E;
  color: var(--fg-1F2937);
}
.hdr-toggle .ic {
  width: 19px;
  height: 19px;
}
.hdr-toggle .ic-menu {
  display: none;
}
.app:not(.sb-closed) .hdr-toggle {
  display: none;
}
.hdr-title {
  margin: 0;
  flex: none;
  white-space: nowrap;
  font-weight: 800;
  font-size: var(--hdr-fs, 24px);
  line-height: 1.3;
  color: var(--fg-1F2937);
  display: none;
}
/* The design's «cmpW» (panel narrower than 1000px): smaller chat title. The panel is the window minus the open sidebar (272px, 240px up to 1100px). */
@media (max-width: 1271px) {
  .app:not(.sb-closed) .hdr {
    --hdr-fs: 20px;
  }
}
@media (max-width: 999px) {
  .hdr {
    --hdr-fs: 20px;
  }
}
.hdr.has-lang .hdr-title {
  display: block;
}
.hdr-nav {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}
.hdr-nav::-webkit-scrollbar {
  display: none;
}
.hdr.has-lang .hdr-nav {
  justify-content: flex-end;
}
.pill-nav {
  white-space: nowrap;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: auto;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--bd-p-200);
  background: var(--bg-p-50);
  color: var(--fg-1F2937);
  font-size: 13px;
  font-weight: 700;
  line-height: normal;
}
.pill-nav:hover {
  border-color: var(--p);
  color: var(--fg-1F2937);
}
.pill-nav .ic {
  width: 18px;
  height: 18px;
  background-color: var(--fg-p-h);
}
/* The pills shrink in the design's steps until they fit on one line (app.js fitNavPills sets .nav-lvN on the header): padding, font, icon and the gap between pills step down, the title is capped, and from step 3 the icon-text gap tightens. */
.hdr.nav-lv1 .hdr-nav {
  gap: 5px;
}
.hdr.nav-lv1 .pill-nav {
  padding: 6px 10px;
  font-size: 12px;
}
.hdr.nav-lv1 .pill-nav .ic {
  width: 17px;
  height: 17px;
}
.hdr.nav-lv1 .hdr-title {
  font-size: min(var(--hdr-fs, 24px), 21px);
}
.hdr.nav-lv2 .hdr-nav {
  gap: 4px;
}
.hdr.nav-lv2 .pill-nav {
  padding: 5px 9px;
  font-size: 11.5px;
}
.hdr.nav-lv2 .pill-nav .ic {
  width: 16px;
  height: 16px;
}
.hdr.nav-lv2 .hdr-title {
  font-size: min(var(--hdr-fs, 24px), 19px);
}
.hdr.nav-lv3 .hdr-nav {
  gap: 4px;
}
.hdr.nav-lv3 .pill-nav {
  padding: 5px 7px;
  font-size: 11px;
  gap: 4px;
}
.hdr.nav-lv3 .pill-nav .ic {
  width: 15px;
  height: 15px;
}
.hdr.nav-lv3 .hdr-title {
  font-size: min(var(--hdr-fs, 24px), 18px);
}
.hdr.nav-lv4 .hdr-nav {
  gap: 3px;
}
.hdr.nav-lv4 .pill-nav {
  padding: 4px 6px;
  font-size: 10.5px;
  gap: 4px;
}
.hdr.nav-lv4 .pill-nav .ic {
  width: 14px;
  height: 14px;
}
.hdr.nav-lv4 .hdr-title {
  font-size: min(var(--hdr-fs, 24px), 17px);
}
.hdr.nav-lv5 .hdr-nav,
.hdr.nav-lv6 .hdr-nav {
  gap: 2px;
}
.hdr.nav-lv5 .pill-nav,
.hdr.nav-lv6 .pill-nav {
  padding: 4px 5px;
  font-size: 10.5px;
  gap: 4px;
}
.hdr.nav-lv5 .pill-nav .ic,
.hdr.nav-lv6 .pill-nav .ic {
  width: 13px;
  height: 13px;
}
.hdr.nav-lv5 .hdr-title,
.hdr.nav-lv6 .hdr-title {
  font-size: min(var(--hdr-fs, 24px), 16px);
}
.pill-nav.is-current {
  border-color: var(--p);
  background: var(--p);
  color: #FFFFFF;
}
.pill-nav.is-current .ic {
  background-color: #E8C979;
}
.m-title {
  display: none;
  flex: 1;
  min-width: 0;
  justify-content: center;
}
.m-title > span,
.m-title h1 {
  margin: 0;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 800;
  font-size: 18px;
  line-height: 1.3;
  color: var(--fg-1F2937);
}
.m-title > span[data-fit-title] {
  font-size: 20px;
}
.m-title .gold {
  color: var(--fg-A07E2B);
}
.m-tools {
  display: none;
  flex: none;
  align-items: center;
  gap: 6px;
}
.m-tools .m-dark,
.m-tools .m-logo {
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 12px;
  border: 1px solid var(--bd-EEE3C8);
  background: var(--bg-FFFFFF);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  padding: 0;
}
.m-dark .ic {
  position: absolute;
  width: 20px;
  height: 20px;
  transition:
    opacity 0.35s ease,
    transform 0.55s cubic-bezier(0.65, 0, 0.35, 1);
  transform: rotate(var(--tg-r));
}
.m-dark .ic-moon {
  background-color: var(--fg-A07E2B);
  opacity: var(--tg-sun);
}
.m-dark .ic-sun {
  background-color: #E8C979;
  opacity: var(--tg-moon);
}
.m-logo img {
  width: 20px;
  height: 24px;
  object-fit: contain;
  filter: var(--logo-f);
}
/* Desktop dark-mode switch. */
/* Theme switch: the design's circular reveal (app.js setTheme) replaces the default cross-fade. */
::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}
.dark-toggle {
  position: relative;
  flex: none;
  width: 64px;
  height: 34px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--tg-bd);
  background: var(--tg-track);
  box-shadow: inset 0 1px 3px rgba(92, 71, 21, 0.14);
  transition:
    background 0.45s ease,
    border-color 0.45s ease;
}
.dark-toggle:hover {
  border-color: #C7A14E;
}
.dark-toggle .tg-sun,
.dark-toggle .tg-moon {
  position: absolute;
  top: 50%;
  width: 14px;
  height: 14px;
  margin-top: -7px;
  opacity: 0.6;
}
.dark-toggle .tg-sun {
  right: 10px;
  background-color: #C7A14E;
}
.dark-toggle .tg-moon {
  left: 10px;
  background-color: #A07E2B;
}
.dark-toggle .tg-knob {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: var(--tg-knob);
  box-shadow: 0 3px 8px -3px rgba(92, 71, 21, 0.6);
  transform: translateX(var(--tg-x)) rotate(var(--tg-r));
  transition:
    transform 0.55s cubic-bezier(0.65, 0, 0.35, 1),
    background 0.45s ease;
}
.dark-toggle .tg-knob .ic {
  position: absolute;
  inset: 5px;
  width: auto;
  height: auto;
  transition: opacity 0.3s ease;
}
.dark-toggle .tg-knob .ic-sun {
  background-color: #C7A14E;
  opacity: var(--tg-sun);
}
.dark-toggle .tg-knob .ic-moon {
  background-color: var(--fg-p-h);
  opacity: var(--tg-moon);
}
.hdr-close-chat {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 12px;
  border-radius: 9px;
  border: 1px solid var(--bd-E9E1CC);
  background: var(--bg-FFFFFF);
  color: var(--fg-374151);
  font-size: 13px;
  font-weight: 700;
}

/* ── Footer, mobile nav, toast ─────────────────────────────────────────── */
.footer {
  position: relative;
  z-index: 2;
  margin-top: auto;
  padding: 40px 20px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-6B7280);
  text-align: center;
}
.footer-line {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
}
.footer a {
  color: var(--fg-A07E2B);
}
.mob-nav {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  grid-template-columns: repeat(var(--cols, 4), minmax(0, 1fr));
  gap: 2px;
  padding: 4px 6px calc(4px + env(safe-area-inset-bottom));
  background: var(--bg-FFFFFF);
  border-top: 1px solid var(--bd-E6DDC6);
  border-radius: 18px 18px 0 0;
  box-shadow: 0 -10px 28px -20px rgba(17, 24, 39, 0.3);
}
.mob-nav-item {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 54px;
  padding: 5px 2px;
  border-radius: 14px;
  color: var(--fg-374151);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
}
.mob-nav-item:hover {
  background: var(--bg-FBF8F1);
  color: var(--fg-374151);
}
.mob-nav-item.is-current {
  background: var(--bg-FBF3DF);
  color: var(--fg-1F2937);
}
.mob-nav-ic {
  width: 36px;
  height: 30px;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: var(--bg-FBF3DF);
  border: 1px solid var(--bd-F0E3BF);
}
.mob-nav-ic .ic {
  width: 18px;
  height: 18px;
  background-color: var(--fg-A07E2B);
}
.mob-nav-item > span:last-child {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mob-spacer {
  display: none;
  height: 96px;
  flex: none;
}
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(20px);
  z-index: 130;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 0 16px;
  border-radius: 999px;
  background: var(--p);
  color: #FFFFFF;
  font-size: 13.5px;
  font-weight: 700;
  box-shadow: 0 14px 30px -12px rgba(var(--p-rgb), 0.6);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.25s ease,
    transform 0.25s ease;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast .ic {
  background-color: #E8C979;
}

/* ═══ Chat page ═════════════════════════════════════════════════════════ */
.hero {
  position: relative;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1 0 auto;
  text-align: center;
  gap: 18px;
  padding: 24px 20px 72px;
}
.hero.has-lang {
  flex: 0 0 auto;
  padding: 16px 20px 0;
}
/* Room for the phone's bottom nav, inside the hero (see the mobile block). */
.m-spacer {
  display: none;
}
.hero-title {
  width: 100%;
  margin: 6px 0 0;
  font-weight: 800;
  font-size: clamp(26px, 3.2vw, 36px);
  line-height: 1.3;
  color: var(--fg-1F2937);
}
.hero.has-lang .hero-title,
.hero.has-lang .hero-hint {
  display: none;
}
.hero-hint {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--fg-7A5E1C);
}
.hero-hint::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 99px;
  background: #C7A14E;
}
@media (min-width: 1441px) {
  .hero {
    padding-inline: 34px;
  }
}

/* Picker card: language chips (+ religious background on the non-Muslim chat). */
.picker {
  width: 100%;
  max-width: 760px;
  margin-top: 6px;
  background: var(--bg-FFFFFF);
  border: 1px solid var(--bd-E6DDC6);
  border-radius: 22px;
  box-shadow:
    0 24px 50px -34px rgba(var(--p-rgb), 0.4),
    0 1px 3px rgba(var(--p-rgb), 0.05);
  text-align: right;
  display: flex;
  flex-direction: column;
}
.hero.has-lang .picker:not(.editing) {
  display: none;
}
.picker-row {
  position: relative;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 16px;
  padding: 18px 22px;
  transition: background 0.3s ease;
}
.picker-sep {
  height: 1px;
  margin: 0 22px;
  background: var(--bg-EEE3C8);
}
.picker-head {
  min-width: 210px;
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}
@media (max-width: 1030px) {
  .picker-head {
    width: 100%;
    flex-wrap: wrap;
  }
}
.picker-ic {
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: 10px;
  background: var(--bg-FBF3DF);
  color: var(--fg-A07E2B);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.picker-ic.muted {
  background: var(--bg-F3F0E8);
  color: var(--fg-4B5563);
}
.picker-ic .ic {
  width: 17px;
  height: 17px;
}
.picker-ic,
.picker-ic .ic {
  transition:
    background 0.3s ease,
    color 0.3s ease;
}
.picker-label {
  font-size: 16px;
  font-weight: 800;
  color: var(--fg-1F2937);
  white-space: nowrap;
}
.tag-req {
  padding: 2px 9px;
  border-radius: 999px;
  background: #C7A14E;
  color: #1F2937;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}
.tag-opt {
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--bg-F3F0E8);
  color: var(--fg-6B7280);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}
.chips {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.chip {
  white-space: nowrap;
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 40px;
  padding: 0 16px;
  border-radius: 12px;
  border: 1px solid var(--bd-E6DDC6);
  background: var(--bg-FFFFFF);
  color: var(--fg-374151);
  font-size: 14px;
  font-weight: 700;
  transition:
    border-color 0.2s ease,
    background 0.2s ease,
    color 0.2s ease;
}
.chip:hover {
  border-color: var(--p);
  background: var(--p);
  color: #FFFFFF;
}
.chip.is-on {
  border-color: var(--p);
  background: var(--p);
  color: #FFFFFF;
}
.chip .ic-check {
  width: 14px;
  height: 14px;
  background-color: var(--fg-C7A14E);
  display: none;
}
.chip.is-on .ic-check {
  display: inline-block;
}
.chip-pill {
  border-radius: 999px;
}
.chip-more {
  border: 1px dashed var(--bd-D6CBB0);
  background: var(--bg-FBF8F0);
  color: var(--fg-7A5E1C);
  font-weight: 800;
}
.chip-more:hover {
  border-color: #C7A14E;
  background: var(--bg-FBF3DF);
  color: var(--fg-7A5E1C);
}
.chip-less {
  border: 0;
  background: transparent;
  color: var(--fg-6B7280);
  font-size: 13.5px;
  height: 40px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
}
.chip-less:hover {
  color: var(--fg-1F2937);
}
.chip-clear {
  white-space: nowrap;
  flex: none;
  height: 40px;
  padding: 0 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--fg-B4232A);
  font-size: 13px;
  font-weight: 700;
}
.chip-clear:hover {
  background: var(--bg-FBEDEE);
}
/* Step hints (the design's three placements, see chat.html): a bobbing
   gold arrow + a green pill. .hint-out sits beside the card on wide
   desktops, .hint-in at the end of the chips row, .hint-top at the end of
   the head row on phones (pill + arrow; arrow only where the pill would wrap). */
.hint {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  pointer-events: none;
}
.hint .ic {
  width: 20px;
  height: 20px;
  background-color: var(--fg-C7A14E);
}
.bob-x {
  animation: bobX 1.1s ease-in-out infinite;
}
.bob-y {
  animation: bobY 1.1s ease-in-out infinite;
}
.hint-pill {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--p);
  color: #FFFFFF;
  font-size: 12.5px;
  font-weight: 800;
  white-space: nowrap;
}
.hint-in {
  margin-right: auto;
  height: 40px;
}
.hint-top {
  display: none;
  margin-right: auto;
  flex-direction: row-reverse;
  gap: 6px;
}
.hint-top .hint-pill {
  height: 26px;
  padding: 0 10px;
  font-size: 11.5px;
}
.hint-top .ic {
  width: 22px;
  height: 22px;
}
.hint-out {
  display: none;
  position: absolute;
  top: 50%;
  margin-top: -17px;
  right: calc(100% + 14px);
  z-index: 5;
  gap: 8px;
}
.hint-out .hint-pill {
  height: 34px;
  padding: 0 14px;
  font-size: 13px;
  box-shadow: 0 10px 24px -12px rgba(var(--p-rgb), 0.6);
}
.hint-out .ic {
  width: 22px;
  height: 22px;
}
@media (min-width: 1472px) {
  .hint-out {
    display: inline-flex;
  }
  .hint-in {
    display: none;
  }
}
@media (min-width: 1200px) {
  .app.sb-closed .hint-out {
    display: inline-flex;
  }
  .app.sb-closed .hint-in {
    display: none;
  }
}
@media (max-width: 530px) {
  .hint-in {
    display: none;
  }
  .hint-top {
    display: inline-flex;
  }
}
/* The design's narrowest phones (≤420px): the arrow alone, right after the badge. */
@media (max-width: 420px) {
  .hint-top .hint-pill {
    display: none;
  }
  .hint-top {
    margin-right: 0;
  }
}
@media (min-width: 421px) {
  .hint-top .ic {
    width: 20px;
    height: 20px;
  }
}
.picker-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 22px;
  border-top: 1px solid var(--bd-EEE3C8);
}
.picker-foot span {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--fg-6B7280);
}
.picker-done {
  white-space: nowrap;
  flex: none;
  height: 38px;
  padding: 0 24px;
  border-radius: 10px;
  border: 0;
  background: var(--p);
  color: #FFFFFF;
  font-size: 13.5px;
  font-weight: 800;
}
.picker-done:hover {
  background: var(--p-2);
}

/* Summary bar after the pick: «لغة المدعو: X  تعديل». */
.summary {
  width: 100%;
  display: none;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 2px 12px;
  font-size: 13px;
  text-align: right;
}
.hero.has-lang .summary {
  display: flex;
}
.hero.has-lang .picker.editing + .summary {
  display: none;
}
.sum-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  min-width: 0;
}
.sum-lbl {
  font-weight: 600;
  color: var(--fg-6B7280);
}
.sum-lbl .lbl-short {
  display: none;
}
@media (max-width: 520px) {
  .sum-lbl .lbl-long {
    display: none;
  }
  .sum-lbl .lbl-short {
    display: inline;
  }
}
.sum-val {
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--bg-FBF3DF);
  border: 1px solid var(--bd-E6D6AE);
  font-weight: 800;
  color: var(--fg-1F2937);
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sum-edit {
  height: 26px;
  flex: none;
  padding: 0 6px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--fg-A07E2B);
  font-size: 12.5px;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.sum-edit:hover {
  background: var(--bg-F3EBD6);
}
.sum-sep {
  flex: none;
  width: 1px;
  height: 14px;
  background: var(--bg-E1D7BF);
}

/* Everything that needs a language hides until one is picked. */
.needs-lang {
  display: none;
}
.hero.has-lang .needs-lang {
  display: flex;
}
.hero.has-lang .needs-lang.qf {
  display: grid;
}
.hero.has-lang .needs-lang.groups {
  display: flex;
}

/* Search row: الترشيحات + search box. */
.search-row {
  width: 100%;
  align-items: stretch;
  gap: 10px;
}
.btn-filters {
  position: relative;
  white-space: nowrap;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 22px;
  border-radius: 16px;
  border: 0;
  background: linear-gradient(135deg, #C9A94F, #9A7D33);
  color: #FFFFFF;
  font-size: 15px;
  font-weight: 800;
  box-shadow:
    0 0 0 4px rgba(199, 161, 78, 0.18),
    0 12px 24px -12px rgba(154, 125, 51, 0.8);
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}
.btn-filters:hover {
  transform: translateY(-1px);
  box-shadow:
    0 0 0 5px rgba(199, 161, 78, 0.26),
    0 16px 28px -12px rgba(154, 125, 51, 0.9);
}
.btn-filters .ic {
  width: 19px;
  height: 19px;
}
@media (max-width: 1059px) {
  .app:not(.sb-closed) .search-row .btn-filters {
    padding: 0 16px;
  }
  .app:not(.sb-closed) .search-row .btn-filters > span:not(.ic):not(.f-count) {
    display: none;
  }
}
.f-count {
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--bg-FFFFFF);
  color: var(--fg-7A5E1C);
  font-size: 12px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.search-box {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 60px;
  padding: 0 8px;
  padding-right: 18px;
  background: var(--bg-FFFFFF);
  border: 1.5px solid #C7A14E;
  border-radius: 16px;
  box-shadow:
    0 0 0 4px rgba(199, 161, 78, 0.12),
    0 18px 40px -30px rgba(var(--p-rgb), 0.45);
}
.search-box > .ic-sparkle {
  width: 17px;
  height: 17px;
  background-color: var(--fg-A07E2B);
}
.search-box input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  padding: 0 8px;
  font-size: 15.5px;
  font-weight: 600;
  color: var(--fg-1F2937);
  text-align: right;
}
.sb-clear {
  width: 30px;
  height: 30px;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 0;
  background: var(--bg-F3F0E8);
  color: var(--fg-6B7280);
}
.sb-clear:hover {
  background: var(--bg-E9E1CC);
  color: var(--fg-1F2937);
}
.sb-clear .ic {
  width: 14px;
  height: 14px;
}
.mic-btn {
  width: 42px;
  height: 42px;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 0;
  background: transparent;
  color: var(--fg-6B7280);
}
.mic-btn:hover {
  background: var(--bg-F3F0E8);
  color: var(--fg-1F2937);
}
.mic-btn .ic {
  width: 18px;
  height: 18px;
}
.mic-btn.recording {
  background: var(--bg-FBEDEE);
  color: var(--fg-B4232A);
}
.btn-ask {
  white-space: nowrap;
  height: 44px;
  padding: 0 18px;
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 12px;
  border: 0;
  background: linear-gradient(135deg, #C9A94F, #9A7D33);
  color: #FFFFFF;
  font-size: 14.5px;
  font-weight: 800;
  box-shadow: 0 10px 22px -12px rgba(154, 125, 51, 0.9);
  transition: transform 0.2s ease;
}
.btn-ask:hover {
  transform: translateY(-1px);
}
.btn-ask .ic {
  width: 16px;
  height: 16px;
}
.btn-go {
  white-space: nowrap;
  height: 44px;
  padding: 0 24px;
  flex: none;
  border-radius: 12px;
  border: 0;
  background: var(--p);
  color: #FFFFFF;
  font-size: 14.5px;
  font-weight: 800;
}
.btn-go:hover {
  background: var(--p-2);
}
.btn-go .ic {
  display: none;
}

/* Quick filters (desktop): the sources row, then one row holding every classification dropdown. */
.qf {
  width: 100%;
  grid-template-columns: max-content minmax(0, 1fr) max-content;
  align-items: center;
  gap: 6px 8px;
  padding: 2px 0 14px;
  font-size: 13px;
  text-align: right;
}
.qf-row {
  grid-column: 1 / -1;
  min-width: 0;
  display: grid;
  grid-template-columns: subgrid;
  align-items: center;
  column-gap: 8px;
  padding: 3px 10px 3px 2px;
  background: var(--bg-FBF8F1);
  border-radius: 16px;
}
.qf-row-src {
  padding: 2px 10px 2px 2px;
}
.qf-row-src .qf-mid {
  flex-wrap: nowrap;
}
.qf-row-dd .qf-mid {
  gap: 8px;
}
/* Narrow panel (app.js adds is-clamped): one line of chips, the rest behind «المزيد من المصادر». */
.qf-chips.is-clamped {
  height: 26px;
  overflow: hidden;
}
.qf-more {
  flex: none;
  white-space: nowrap;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px dashed var(--bd-D6CBB0);
  background: var(--bg-F5ECD5);
  color: var(--fg-7A5E1C);
  font-size: 11.5px;
  font-weight: 800;
  transition:
    background 0.2s ease,
    border-color 0.2s ease;
}
.qf-more:hover {
  border-color: #C7A14E;
  background: var(--bg-EEDFB8);
}
.qf-title {
  flex: none;
  font-size: 12px;
  font-weight: 700;
  color: var(--fg-6B7280);
  white-space: nowrap;
}
.qf-mid {
  min-width: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
.qf-chips {
  flex: 0 1 auto;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.qf-chip {
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid var(--bd-E6DDC6);
  background: var(--bg-FFFFFF);
  color: var(--fg-6B7280);
  font-size: 11.5px;
  font-weight: 600;
  transition:
    border-color 0.2s ease,
    color 0.2s ease;
}
.qf-chip:hover {
  border-color: #C7A14E;
  color: var(--fg-1F2937);
}
.qf-chip.is-on {
  border-color: var(--p);
  background: var(--p);
  color: #FFFFFF;
}
.qf-chip.is-on:hover {
  background: var(--p-h);
}
.qf-chip svg {
  display: none;
  flex: none;
}
.qf-chip.is-on svg {
  display: inline;
}
.qf-clear {
  flex: none;
  width: 26px;
  height: 26px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid var(--bd-EEE6D2);
  background: var(--bg-FFFFFF);
  color: var(--fg-C9CED8);
  cursor: default;
  transition:
    background 0.2s ease,
    color 0.2s ease;
}
.qf-clear.is-on {
  border-color: var(--bd-F3D3D6);
  background: var(--bg-FBEDEE);
  color: var(--fg-B4232A);
  cursor: pointer;
}
.qf-clear.is-on:hover {
  background: var(--bg-F7DADD);
}
.qf-clear .ic {
  width: 14px;
  height: 14px;
}
.qf-empty {
  grid-column: 1 / -1;
  margin: 0;
  padding: 2px 10px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--fg-B4232A);
}
/* Phones: one pill per filter (design «الفلاتر السريعة — الجوال»); each opens the dialog at its tab. Shown by the mobile block. */
.qf-m {
  display: none;
  align-self: stretch;
  margin: 10px -14px 0;
  padding: 0 14px;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  text-align: right;
}
.qf-m::-webkit-scrollbar {
  display: none;
}
.hero.has-lang .needs-lang.qf-m {
  display: none;
}
.qf-pill {
  flex: none;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--bd-E6DDC6);
  background: var(--bg-FFFFFF);
  color: var(--fg-1F2937);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.qf-pill.has-sel {
  border-color: #C7A14E;
  background: var(--bg-FBF3DF);
}
.qf-pill-t {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--fg-6B7280);
  font-weight: 600;
}
.qf-pill-s {
  font-weight: 800;
}
.qf-pill .ic {
  width: 12px;
  height: 12px;
  flex: none;
  background-color: var(--fg-8E97A6);
}

/* Dropdown with a checkbox tree (classifications, حجم المحتوى). */
.dd {
  position: relative;
  display: inline-flex;
}
.dd-trigger {
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 10px 0 12px;
  border-radius: 999px;
  border: 1px solid var(--bd-E6DDC6);
  background: var(--bg-FFFFFF);
  color: var(--fg-1F2937);
  font-size: 12px;
  font-weight: 700;
  transition:
    border-color 0.2s ease,
    background 0.25s ease;
  max-width: 100%;
}
.dd-trigger:hover {
  border-color: #C7A14E;
}
.dd.has-sel .dd-trigger {
  border-color: #C7A14E;
  background: var(--bg-FBF3DF);
}
.dd-trigger > .ic:first-child {
  width: 13px;
  height: 13px;
  background-color: var(--fg-A07E2B);
}
.dd-trigger .dd-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dd-count {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: #C7A14E;
  color: #FFFFFF;
  font-size: 11px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.dd-chev {
  width: 12px;
  height: 12px;
  background-color: var(--fg-8E97A6);
  transition: transform 0.2s ease;
}
.dd.open .dd-chev {
  transform: rotate(180deg);
}
.dd-pop {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 45;
  width: 300px;
  max-width: calc(100vw - 32px);
  display: flex;
  flex-direction: column;
  background: var(--bg-FFFFFF);
  border: 1px solid var(--bd-E6DDC6);
  border-radius: 14px;
  box-shadow: 0 20px 40px -18px rgba(var(--p-rgb), 0.4);
  text-align: right;
  overflow: hidden;
  animation: fadeUp 0.18s ease both;
}
.dd-pop.drop-up {
  top: auto;
  bottom: calc(100% + 6px);
}
.dd-search {
  margin: 8px 8px 2px;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 10px;
  border-radius: 10px;
  background: var(--bg-F7F4EC);
  border: 1px solid var(--bd-EEE6D2);
}
.dd-search .ic {
  width: 14px;
  height: 14px;
  background-color: var(--fg-8E97A6);
}
.dd-search input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-1F2937);
  text-align: right;
}
.dd-list {
  max-height: 300px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--sb) transparent;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px;
}
.dd-foot {
  display: flex;
  justify-content: flex-start;
  padding: 4px 8px 8px;
}
.tree-clear {
  height: 28px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--fg-B4232A);
  font-size: 12px;
  font-weight: 700;
}
.tree-clear:hover {
  background: var(--bg-FBEDEE);
}
.tree-row {
  display: flex;
  align-items: center;
  gap: 2px;
  border-radius: 9px;
}
.tree-row:hover {
  background: var(--bg-FBF6EA);
}
.tree-row[data-depth="1"] {
  margin-right: 16px;
  padding-right: 6px;
  border-right: 1.5px solid var(--bd-EEE3C8);
}
.tree-row[data-depth="2"] {
  margin-right: 32px;
  padding-right: 6px;
  border-right: 1.5px solid var(--bd-EEE3C8);
}
.tree-row[data-depth="3"] {
  margin-right: 48px;
  padding-right: 6px;
  border-right: 1.5px solid var(--bd-EEE3C8);
}
.tree-toggle {
  width: 28px;
  height: 34px;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--fg-8E97A6);
}
.tree-toggle:hover {
  background: var(--bg-F3EEE2);
  color: var(--fg-1F2937);
}
.tree-toggle .ic {
  width: 15px;
  height: 15px;
  transition: transform 0.2s ease;
}
.tree-row.open > .tree-toggle .ic {
  transform: rotate(-90deg);
}
.tree-toggle-spacer {
  width: 28px;
  flex: none;
}
.tree-label {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  padding: 2px 6px;
  border-radius: 8px;
  color: var(--fg-1F2937);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.5;
  cursor: pointer;
}
.tree-row[data-depth]:not([data-depth="0"]) .tree-label {
  font-weight: 600;
  font-size: 12.5px;
  color: var(--fg-374151);
}
.tree-check {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  flex: none;
  margin: 0;
  border-radius: 5px;
  border: 1.5px solid var(--bd-C9BFA6);
  background: var(--bg-FFFFFF);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.tree-check::after {
  content: "";
  width: 12px;
  height: 12px;
  background-color: #FFFFFF;
  -webkit-mask: url("icons/l-check.2a8d8742e534.svg") center / contain no-repeat;
  mask: url("icons/l-check.2a8d8742e534.svg") center / contain no-repeat;
  opacity: 0;
}
.tree-check:checked {
  border-color: var(--p);
  background: var(--p);
}
.tree-check:checked::after {
  opacity: 1;
}
.tree-check:indeterminate {
  border-color: var(--p);
  background: var(--p);
}
.tree-check:indeterminate::after {
  opacity: 1;
  -webkit-mask-image: url("icons/l-minus.3aac6d0ccb4e.svg");
  mask-image: url("icons/l-minus.3aac6d0ccb4e.svg");
}
.tree-name {
  flex: 1;
  min-width: 0;
}

/* Sticky bar once the search row scrolls away. */
.sticky-wrap {
  position: sticky;
  top: 8px;
  z-index: 30;
  width: 100%;
  height: 0;
  margin-bottom: -18px;
  display: none;
}
.hero.has-lang .sticky-wrap {
  display: block;
}
.sticky-bar {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 52px;
  padding: 6px;
  background: var(--bga-255-255-255-96);
  backdrop-filter: blur(8px);
  border: 1px solid var(--bd-E6DDC6);
  border-radius: 14px;
  box-shadow: 0 16px 34px -22px rgba(var(--p-rgb), 0.45);
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  transition:
    opacity 0.25s ease,
    transform 0.25s ease;
  text-align: right;
}
.sticky-wrap.show .sticky-bar {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}
.sticky-filters {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 40px;
  padding: 0 12px 0 14px;
  border: 0;
  border-radius: 10px;
  background: linear-gradient(135deg, #C9A94F, #9A7D33);
  color: #FFFFFF;
  font-size: 13px;
  font-weight: 800;
}
.sticky-filters .ic {
  width: 16px;
  height: 16px;
}
.sticky-filters .f-count {
  min-width: 20px;
  height: 20px;
  font-size: 11px;
}
/* The chevron turns and the button gets the gold ring while the panel is open. */
.sticky-filters .sticky-chev {
  width: 14px;
  height: 14px;
  transition: transform 0.25s ease;
}
.sticky-filters.is-open {
  box-shadow: 0 0 0 3px rgba(199, 161, 78, 0.3);
}
.sticky-filters.is-open .sticky-chev {
  transform: rotate(180deg);
}
/* The design's drop-down filters panel under the bar: #summary and #qf move in here while it is open (app.js toggleStickyPanel). */
.sticky-panel {
  position: absolute;
  left: 0;
  right: 0;
  top: 60px;
  display: none;
  flex-direction: column;
  gap: 6px;
  padding: 10px;
  background: var(--pop-bg);
  border: 1px solid var(--pop-bd);
  border-radius: 14px;
  box-shadow: var(--pop-sh);
  font-size: 13px;
  text-align: right;
}
.sticky-panel.show {
  display: flex;
}
.sticky-panel .summary {
  padding: 4px 12px;
  margin-bottom: 2px;
  font-size: 12.5px;
}
/* In the panel the design shows the language as plain bold text, not the hero's pill. */
.sticky-panel .sum-val {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-weight: 800;
  color: var(--fg-1F2937);
}
.sticky-panel .qf {
  padding: 0;
}
.sticky-sum {
  flex: 0 1 auto;
  min-width: 0;
  height: 40px;
  padding: 0 8px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--fg-4B5563);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sticky-sum:hover {
  background: var(--bg-F7F2E6);
  color: var(--fg-1F2937);
}
.sticky-search {
  flex: 1 1 200px;
  min-width: 140px;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 40px;
  padding: 0 3px;
  padding-right: 12px;
  border: 1.5px solid #C7A14E;
  border-radius: 10px;
  background: var(--bg-FFFDF7);
  box-shadow: 0 0 0 3px rgba(199, 161, 78, 0.12);
}
.sticky-search input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--fg-1F2937);
  text-align: right;
}
.sticky-search .btn-ask {
  height: 32px;
  padding: 0 12px;
  border-radius: 8px;
  font-size: 12.5px;
}
.sticky-search .btn-go {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 8px;
}
.sticky-search .btn-go .ic {
  display: inline-block;
  width: 15px;
  height: 15px;
}
.sticky-search .btn-go span {
  display: none;
}
.sticky-search .sb-clear {
  width: 26px;
  height: 26px;
}

/* Results heading + groups of cards. */
.results-head {
  width: 100%;
  margin: -12px 0 0;
  display: none;
  align-items: baseline;
  gap: 8px;
  padding: 0 4px;
  text-align: right;
}
.results-head.show {
  display: flex;
}
.results-head b {
  font-size: 15px;
  font-weight: 800;
  color: var(--fg-1F2937);
}
.results-head span {
  font-size: 13px;
  font-weight: 700;
  color: var(--fg-8E97A6);
}
.groups {
  width: 100%;
  margin-top: -8px;
  flex-direction: column;
  gap: 14px;
  text-align: right;
}
.group {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px 16px 16px;
  background: var(--bg-FBF8F1);
  border: 1px solid var(--bd-EEE6D2);
  border-radius: 18px;
}
.group-head {
  display: flex;
  align-items: center;
  gap: 24px;
}
.group-title {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  min-width: 0;
}
.group-title::before {
  content: "";
  width: 4px;
  height: 18px;
  flex: none;
  border-radius: 2px;
  background: #C7A14E;
}
.group-title h2,
.group-title h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
  color: var(--fg-1F2937);
  white-space: normal;
}
.group-count {
  font-size: 13px;
  font-weight: 700;
  color: var(--fg-8E97A6);
}
.group-tools {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.seg {
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
  display: flex;
  gap: 3px;
  padding: 3px;
  background: var(--bg-FFFFFF);
  border: 1px solid var(--bd-E6DDC6);
  border-radius: 12px;
  box-shadow: 0 4px 12px -8px rgba(92, 71, 21, 0.35);
}
.seg button {
  white-space: nowrap;
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-radius: 9px;
  border: 0;
  background: transparent;
  color: var(--fg-6B7280);
  font-size: 13px;
  font-weight: 800;
  transition:
    background 0.2s ease,
    color 0.2s ease;
}
.seg button:not(.is-on):hover {
  background: var(--bg-F3EBD6);
  color: var(--fg-1F2937);
}
.seg button.is-on {
  background: var(--p);
  color: #FFFFFF;
}
.seg button .ic {
  width: 15px;
  height: 15px;
}
/* Material kinds in the design's colours: text when idle, filled when on. */
.seg button.kind-read {
  color: var(--fg-8A6A1E);
}
.seg button.kind-read:not(.is-on):hover {
  background: var(--bg-F5E9C8);
  color: var(--fg-8A6A1E);
}
.seg button.kind-read.is-on {
  background: var(--tabA-read);
  color: #FFFFFF;
}
.seg button.kind-audio {
  color: var(--fg-4B3F72);
}
.seg button.kind-audio:not(.is-on):hover {
  background: var(--bg-ECE8F5);
  color: var(--fg-4B3F72);
}
.seg button.kind-audio.is-on {
  background: var(--tabA-aud);
  color: #FFFFFF;
}
.seg button.kind-video {
  color: var(--fg-24497A);
}
.seg button.kind-video:not(.is-on):hover {
  background: var(--bg-E8EEF7);
  color: var(--fg-24497A);
}
.seg button.kind-video.is-on {
  background: var(--tabA-vid);
  color: #FFFFFF;
}
.cards-grid {
  display: grid;
  grid-template-columns: repeat(
    auto-fill,
    minmax(max(240px, min(calc((100% - 24px) / 3), 300px)), 1fr)
  );
  gap: 12px;
}
.browse-items {
  display: contents;
}
.card {
  font-family: "Almarai", system-ui, sans-serif;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 16px 12px;
  background: var(--bg-FFFFFF);
  border: 1px solid var(--bd-EEE3C8);
  border-radius: 14px;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}
.card:hover {
  border-color: var(--bd-E0CC98);
  box-shadow: 0 16px 30px -24px rgba(var(--p-rgb), 0.4);
}
.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.card-tags {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 100px;
  background: var(--bg-F3F0E8);
  color: var(--fg-5B6475);
  font-size: 0.65625rem;
  font-weight: 700;
  white-space: nowrap;
}
.badge-read {
  background: var(--bg-F5E9C8);
  color: var(--fg-8A6A1E);
}
.badge-audio {
  background: var(--bg-ECE8F5);
  color: var(--fg-4B3F72);
}
.badge-video {
  background: var(--bg-E8EEF7);
  color: var(--fg-24497A);
}
.badge-poster {
  background: var(--bg-p-50);
  color: var(--fg-p);
}
.badge-doc {
  background: var(--bg-E8EEF7);
  color: var(--fg-24497A);
}
.card-star {
  color: #C7A14E;
  display: inline-flex;
}
.card-star .ic {
  width: 14px;
  height: 14px;
}
.card-lang {
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-8E97A6);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.card-title {
  margin: 0;
  font-family: "Almarai", system-ui, sans-serif;
  font-size: 0.84375rem;
  font-weight: 700;
  line-height: 1.55;
  color: var(--fg-1F2937);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-desc {
  margin: -6px 0 0;
  flex: 1;
  font-size: 0.71875rem;
  line-height: 1.7;
  font-weight: 500;
  color: var(--fg-6B7280);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-foot {
  margin-top: auto;
  padding-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.card-foot .spacer {
  flex: 1;
}
.btn-download {
  flex: none;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 1rem;
  border-radius: 0.5rem;
  border: 0;
  background: var(--p);
  color: #FFFFFF;
  font-size: 13px;
  font-weight: 700;
}
.btn-download:hover {
  background: var(--p-2);
  color: #FFFFFF;
}
.btn-download .ic {
  width: 13px;
  height: 13px;
}
.btn-share {
  height: 36px;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--bd-E3D3AA);
  background: var(--bg-FBF3DF);
  color: var(--fg-7A5E1C);
  font-size: 12.5px;
  font-weight: 800;
  transition:
    background 0.2s ease,
    border-color 0.2s ease;
}
.btn-share:hover {
  background: var(--bg-F5E9C8);
  border-color: #C7A14E;
  color: var(--fg-7A5E1C);
}
.btn-share .ic {
  width: 15px;
  height: 15px;
}
.card .btn-icon {
  width: 36px;
  height: 36px;
}
.card .btn-icon .ic {
  width: 17px;
  height: 17px;
}
.read-more {
  white-space: nowrap;
  flex: none;
  height: 36px;
  padding: 0 2px;
  border: 0;
  background: transparent;
  color: var(--fg-7A5E1C);
  font-size: 12.5px;
  font-weight: 800;
}
.read-more:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
  color: var(--fg-7A5E1C);
}
.more-tile {
  min-height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--bd-D6CBB0);
  border-radius: 14px;
  background: var(--bg-F3EFE6);
  color: var(--fg-1F2937);
  font-family: "Almarai", system-ui, sans-serif;
  font-size: 0.84375rem;
  font-weight: 700;
  transition:
    background 0.2s ease,
    border-color 0.2s ease;
}
.more-tile:hover {
  background: var(--bg-EDE6D6);
  border-color: #C7A14E;
}
.more-tile .mt-short,
.more-tile .ic {
  display: none;
}
.browse-status {
  margin: 0;
  padding: 12px;
  text-align: center;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--fg-6B7280);
}
.empty-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 40px 20px;
  background: var(--bg-FFFFFF);
  border: 1px dashed var(--bd-E0D3B0);
  border-radius: 16px;
  text-align: center;
}
.empty-box .ic {
  width: 26px;
  height: 26px;
  background-color: var(--fg-A07E2B);
}
.empty-box b {
  font-size: 15px;
  font-weight: 800;
  color: var(--fg-1F2937);
}
.empty-box span {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-6B7280);
}
.loading-row {
  width: 100%;
  display: flex;
  justify-content: center;
  padding: 12px;
  color: var(--fg-A07E2B);
}

/* Encyclopedia-card text inside the reader and the card page. */
.fld {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.fld-label {
  font-size: 13px;
  font-weight: 800;
  line-height: 1.6;
  color: var(--fg-A07E2B);
}
.fld-text {
  white-space: pre-line;
}
.fld.muted .fld-label,
.fld.muted .fld-text {
  color: var(--fg-8E97A6);
}
.fld-bare {
  font-weight: 500;
}
.fld-strong {
  font-weight: 800;
  color: var(--p-ink);
}
.fld-title {
  font-weight: 800;
  font-size: 1.05em;
  color: var(--fg-1F2937);
}
.fld-bullets {
  margin: 0;
  padding: 0 18px 0 0;
  list-style: disc;
}
.fld-bullets li {
  margin: 0 0 4px;
}
.fld.first-box {
  gap: 6px;
  padding: 16px 18px;
  border-radius: 16px;
  background: var(--bg-FBF8F1);
  border: 1px solid var(--bd-EEE6D2);
}
.fld.first-box .fld-text {
  font-weight: 700;
  color: var(--fg-1F2937);
}
.card .fld {
  gap: 2px;
}
.card .fld-label {
  font-size: 11.5px;
}
.card-body-clamp {
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 0.71875rem;
  line-height: 1.75;
  font-weight: 500;
  color: var(--fg-374151);
  white-space: pre-line;
}

/* ── AI assistant panel ────────────────────────────────────────────────── */
.ai {
  width: 100%;
  margin-top: 8px;
  display: none;
  flex-direction: column;
  background: var(--bg-FFFDF8);
  border: 1.5px solid #C7A14E;
  border-radius: 18px;
  box-shadow: 0 24px 50px -30px rgba(var(--p-rgb), 0.5);
  text-align: right;
}
.ai.open {
  display: flex;
}
.hero.ai-open .groups,
.hero.ai-open .results-head,
.hero.ai-open .sticky-wrap,
.hero.ai-open .qf {
  display: none !important;
}
.ai-head {
  position: sticky;
  top: 8px;
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  margin: 6px 6px 0;
  background: linear-gradient(180deg, var(--bg-FBF3DF), var(--bg-FFFDF7));
  border: 1px solid var(--bd-E6D6AE);
  border-radius: 14px;
  box-shadow: 0 10px 22px -16px rgba(154, 125, 51, 0.7);
}
.ai-head-ic {
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: 10px;
  background: linear-gradient(135deg, #C9A94F, #9A7D33);
  color: #FFFFFF;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 14px -8px rgba(154, 125, 51, 0.9);
}
.ai-head-ic .ic {
  width: 15px;
  height: 15px;
}
.ai-head-title {
  flex: 1;
  min-width: 0;
  font-size: 15px;
  font-weight: 800;
  color: var(--fg-1F2937);
}
.ai-head-btn {
  flex: none;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--bd-E6D6AE);
  background: var(--bg-FFFFFF);
  color: var(--fg-7A5E1C);
  font-size: 12px;
  font-weight: 800;
  transition: background 0.2s ease;
}
.ai-head-btn:hover {
  background: var(--bg-FBF3DF);
}
.ai-head-btn.strong {
  border-color: #C7A14E;
}
.ai-head-btn .ic {
  width: 12px;
  height: 12px;
}
.ai-body {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 18px 16px 8px;
}
.ai-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 28px 8px;
  text-align: center;
}
.ai-empty > span {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--fg-374151);
}
.ai-sugs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}
.ai-sug {
  height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--bd-E6D6AE);
  background: var(--bg-FFFFFF);
  color: var(--fg-7A5E1C);
  font-size: 13px;
  font-weight: 700;
}
.ai-sug:hover {
  border-color: #C7A14E;
  background: var(--bg-FBF3DF);
}
/* The turns are direct children of the design's body (gap 28px); here they sit in #ai-turns, which carries the same gap between one turn's cards and the next question. */
#ai-turns {
  display: flex;
  flex-direction: column;
  gap: 28px;
}
.ai-turn {
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-margin-top: 80px;
}
.ai-q {
  align-self: flex-start;
  max-width: 85%;
  padding: 9px 16px;
  border-radius: 16px 4px 16px 16px;
  background: var(--p);
  color: #FFFFFF;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.6;
  white-space: pre-wrap;
}
.ai-a {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 10px;
}
.ai-a-ic {
  width: 26px;
  height: 26px;
  flex: none;
  border-radius: 999px;
  background: var(--bg-FBF3DF);
  border: 1px solid var(--bd-E6D6AE);
  color: var(--fg-A07E2B);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.ai-a-ic .ic {
  width: 13px;
  height: 13px;
}
.ai-reply {
  font-size: 14px;
  font-weight: 700;
  color: var(--fg-374151);
}
.ai-thinking {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--fg-7A6A45);
}
.ai-sum {
  white-space: nowrap;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--bg-F3EBD6);
  color: var(--fg-7A5E1C);
  font-size: 11.5px;
  font-weight: 800;
}
.ai-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ai-group-head {
  display: flex;
  align-items: center;
  gap: 8px;
}
.ai-group-head::before {
  content: "";
  width: 4px;
  height: 16px;
  flex: none;
  border-radius: 2px;
  background: #C7A14E;
}
.ai-group-head h4 {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  color: var(--fg-1F2937);
}
.ai-group-head span {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--fg-8E97A6);
}
.ai-clarify {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-right: 36px;
}
.ai-clarify button {
  height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--bd-E6D6AE);
  background: var(--bg-FFFFFF);
  color: var(--fg-7A5E1C);
  font-size: 13px;
  font-weight: 700;
}
.ai-clarify button:hover:not([disabled]) {
  border-color: #C7A14E;
  background: var(--bg-FBF3DF);
}
.ai-clarify button.is-on {
  background: var(--p);
  border-color: var(--p);
  color: #FFFFFF;
}
.ai-clarify button[disabled] {
  opacity: 0.6;
  cursor: default;
}
.ai-comp {
  position: sticky;
  bottom: 0;
  z-index: 5;
  padding: 10px 6px 6px;
}
.ai-comp-box {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 56px;
  padding: 0 6px;
  padding-right: 16px;
  background: var(--bg-FFFFFF);
  border: 1.5px solid var(--bd-E6D6AE);
  border-radius: 16px;
  box-shadow: 0 14px 30px -20px rgba(var(--p-rgb), 0.45);
}
.ai-comp-box input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--fg-1F2937);
  text-align: right;
}
.ai-send {
  width: 44px;
  height: 44px;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  border: 0;
  background: var(--bg-ECEEF2);
  color: var(--fg-9AA1AE);
  transition: background 0.2s ease;
}
.ai-send.active {
  background: var(--p);
  color: #FFFFFF;
}
.ai-send .ic {
  width: 19px;
  height: 19px;
}
.ai-note {
  margin: 8px 0 0;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-8E97A6);
}

/* ═══ Modals ════════════════════════════════════════════════════════════ */
.ov {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--scrim);
  backdrop-filter: var(--scrim-f);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.ov.z-top {
  z-index: 110;
}
.modal {
  width: 100%;
  max-width: 560px;
  max-height: calc(100dvh - 32px);
  display: flex;
  flex-direction: column;
  background: var(--bg-FFFFFF);
  border-radius: 20px;
  box-shadow: var(--modal-sh);
  text-align: right;
  overflow: hidden;
  animation: fadeUp 0.22s ease both;
}
.modal-head {
  flex: none;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 22px 24px 10px;
}
.modal-head.bordered {
  padding-bottom: 16px;
  border-bottom: 1px solid var(--bd-EEE3C8);
}
.modal-head-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.modal-title {
  margin: 0;
  font-weight: 900;
  font-size: 24px;
  line-height: 1.35;
  color: var(--fg-1F2937);
}
.modal-sub {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.7;
  color: var(--fg-6B7280);
}
.modal-close {
  width: 36px;
  height: 36px;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 0;
  background: var(--bg-F3F0E8);
  color: var(--fg-4B5563);
}
.modal-close:hover {
  background: var(--bg-EAE4D5);
  color: var(--fg-1F2937);
}
.modal-close .ic {
  width: 16px;
  height: 16px;
}
.modal-close.round {
  border-radius: 999px;
  border: 1px solid var(--bd-E3D3AA);
  background: var(--bg-FFFFFF);
  color: var(--fg-1F2937);
  box-shadow: 0 6px 14px -8px rgba(92, 71, 21, 0.45);
}
.modal-close.round:hover {
  background: var(--bg-FBF3DF);
  border-color: #C7A14E;
}
.modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 14px 24px 20px;
  scrollbar-width: thin;
  scrollbar-color: var(--sb) transparent;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.modal-foot {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 24px 22px;
  border-top: 1px solid var(--bd-EEE3C8);
}
.modal-foot .btn-primary {
  flex: 1;
  height: 46px;
  border-radius: 12px;
  font-size: 15px;
}
.modal-foot .btn-primary[disabled] {
  background: var(--bg-E5E7EB);
  color: var(--fg-9AA1AE);
  opacity: 1;
  cursor: not-allowed;
}
.search-field {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 14px;
  border-radius: 12px;
  background: var(--bg-F7F4EC);
  border: 1px solid var(--bd-EEE6D2);
}
.search-field .ic {
  width: 16px;
  height: 16px;
  background-color: var(--fg-6B7280);
}
.search-field input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--fg-1F2937);
}
.lang-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.lang-opt {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  padding: 8px 14px;
  border-radius: 14px;
  border: 1px solid var(--bd-E6DDC6);
  background: var(--bg-FFFFFF);
  color: var(--fg-1F2937);
  text-align: right;
  transition:
    border-color 0.2s ease,
    background 0.2s ease,
    color 0.2s ease,
    transform 0.2s ease;
}
.lang-opt:hover {
  border-color: var(--p);
  background: var(--p);
  color: #FFFFFF;
  transform: translateY(-1px);
}
.lang-opt.is-on {
  border-color: var(--p);
  background: var(--p);
  color: #FFFFFF;
}
.lang-opt .ic {
  width: 15px;
  height: 15px;
  background-color: var(--fg-C7A14E);
  display: none;
}
.lang-opt.is-on .ic {
  display: inline-block;
}
.lang-opt span {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.4;
}
.modal-empty {
  margin: 0;
  padding: 40px 10px;
  font-size: 14px;
  color: var(--fg-6B7280);
  text-align: center;
}
/* Dialog sizes from the design: languages 440 × min(540px, 100vh − 40px) and the background dialog 440 wide, both on a 20px overlay; the filters dialog 600 × min(720px, 100vh − 40px), 520 × min(540px, 100vh − 80px) when the panel is narrower than 1000px. */
#modal-lang.ov,
#modal-rel.ov,
#modal-ctx.ov,
#modal-filters.ov {
  padding: 20px;
}
.modal-lang,
.modal-rel {
  max-width: 440px;
  border-radius: 22px;
}
.modal-lang {
  height: min(540px, calc(100vh - 40px));
}
.modal-lang .modal-head {
  padding: 22px 24px 16px;
}
.modal-lang .modal-head-text {
  gap: 2px;
}
.modal-lang .modal-title {
  font-size: 26px;
  line-height: normal;
}
.modal-lang .modal-sub {
  line-height: normal;
}
.modal-lang .modal-body {
  direction: ltr;
  padding: 16px 18px 20px 24px;
  gap: 0;
}
.modal-lang .modal-body > * {
  direction: rtl;
}
.modal-rel .modal-head {
  padding: 24px 24px 6px;
}
.modal-rel .modal-head-text {
  gap: 4px;
}
.modal-rel .modal-title {
  font-size: 26px;
  line-height: normal;
}
.modal-rel .modal-sub {
  line-height: normal;
}

/* «تعديل المدعو» (non-Muslim chat, app.js openCtx): 560 × min(600px, 100vh − 40px); two tabs in a tinted track (title + draft value, a gold dot when changed), the language search + grid or the background chips, then «إلغاء» and the full-width «تم» (grey until something changed). */
.modal-ctx {
  max-width: 560px;
  height: min(600px, calc(100vh - 40px));
  border-radius: 22px;
}
.modal-ctx .modal-head {
  align-items: center;
  gap: 12px;
  padding: 18px 20px 6px;
}
.modal-ctx .modal-title {
  flex: 1;
  font-size: 21px;
  line-height: normal;
}
.ctx-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin: 8px 20px 4px;
  padding: 4px;
  background: var(--bg-F3EEE2);
  border-radius: 14px;
}
.ctx-tab {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  padding: 7px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  text-align: right;
}
.ctx-tab.is-on {
  background: var(--bg-FFFFFF);
  box-shadow: 0 1px 3px rgba(var(--p-rgb), 0.12);
}
.ctx-tab-t {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 800;
  color: var(--fg-6B7280);
}
.ctx-tab.is-on .ctx-tab-t {
  color: var(--fg-1F2937);
}
.ctx-dot {
  width: 7px;
  height: 7px;
  border-radius: 99px;
  background: #C7A14E;
}
.ctx-tab-v {
  max-width: 100%;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--fg-8E97A6);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.modal-ctx .modal-body {
  padding: 14px 20px 18px;
  gap: 12px;
}
.ctx-pane {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ctx-search {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--bd-E6DDC6);
  border-radius: 12px;
  background: var(--bg-FBF8F1);
}
.ctx-search .ic {
  width: 16px;
  height: 16px;
  background-color: var(--fg-8E97A6);
}
.ctx-search input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 14px;
  font-weight: 600;
  color: var(--fg-1F2937);
  text-align: right;
}
.ctx-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
}
.ctx-opt {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid var(--bd-E6DDC6);
  background: var(--bg-FFFFFF);
  color: var(--fg-1F2937);
  text-align: right;
  transition:
    border-color 0.2s ease,
    background 0.25s ease;
}
.ctx-opt:hover {
  border-color: #C7A14E;
}
.ctx-opt.is-on {
  border-color: var(--p);
  background: var(--p);
  color: #FFFFFF;
}
.ctx-opt .ic {
  display: none;
  width: 13px;
  height: 13px;
  background-color: var(--fg-C7A14E);
}
.ctx-opt.is-on .ic {
  display: inline-block;
}
.ctx-opt-name {
  flex: 1;
  min-width: 0;
  font-size: 13.5px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ctx-empty {
  margin: 0;
  padding: 24px 0;
  text-align: center;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--fg-8E97A6);
}
.ctx-hint {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--fg-8E97A6);
}
#ctx-rels .chip {
  height: 42px;
}
.ctx-foot {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px 18px;
  border-top: 1px solid var(--bd-EEE3C8);
}
.ctx-cancel {
  white-space: nowrap;
  flex: none;
  height: 46px;
  padding: 0 16px;
  border: 1px solid var(--bd-E6DDC6);
  border-radius: 12px;
  background: var(--bg-FFFFFF);
  color: var(--fg-4B5563);
  font-size: 14px;
  font-weight: 700;
}
.ctx-cancel:hover {
  border-color: #C7A14E;
  color: var(--fg-1F2937);
}
.ctx-foot .btn-primary {
  flex: 1;
  height: 46px;
  padding: 0;
  border-radius: 12px;
  font-size: 14.5px;
  font-weight: 800;
}
.ctx-foot .btn-primary[disabled] {
  background: var(--bg-E5E7EB);
  color: var(--fg-9AA1AE);
  opacity: 1;
  cursor: not-allowed;
}
.modal-rel .modal-body {
  padding: 14px 24px 20px;
  gap: 0;
}
.modal-rel .modal-foot {
  padding: 14px 24px 22px;
}
.modal-rel .chip {
  height: 42px;
}
.lang-opt {
  color: var(--fg-374151);
}
/* Filters dialog: wide 600 × min(720px, 100vh − 40px); compact when the panel is narrower than 1000px (.app.is-cmp, set by app.js) 520 × min(540px, 100vh − 80px) with the design's smaller head, tabs, chips and footer. */
.modal-filters {
  max-width: 600px;
  height: min(720px, calc(100vh - 40px));
  border-radius: 22px;
}
.modal-filters .modal-head {
  align-items: center;
  padding: 22px 24px 6px;
}
.modal-filters .modal-title {
  font-size: 26px;
  line-height: normal;
}
.modal-filters .modal-close {
  width: 40px;
  height: 40px;
}
.modal-filters .modal-tabs {
  margin: 10px 24px 4px;
}
.modal-filters .modal-tab {
  flex: 1 0 auto;
  height: 42px;
  padding: 0 14px;
  gap: 7px;
  font-size: 13.5px;
}
.modal-filters .modal-body {
  padding: 18px 24px 22px;
  gap: 14px;
}
.modal-filters .f-sec .chips .chip {
  height: 40px;
  padding: 0 14px;
  gap: 6px;
  font-size: 13.5px;
}
.modal-filters .f-sec .chips .chip .ic-check {
  width: 13px;
  height: 13px;
}
.modal-filters .modal-foot {
  padding: 14px 24px 20px;
}
.modal-filters .modal-foot .btn-primary {
  height: 48px;
}
.app.is-cmp .modal-filters {
  max-width: 520px;
  height: min(540px, calc(100vh - 80px));
}
.app.is-cmp .modal-filters .modal-head {
  padding: 16px 20px 4px;
}
.app.is-cmp .modal-filters .modal-title {
  font-size: 21px;
}
.app.is-cmp .modal-filters .modal-close {
  width: 34px;
  height: 34px;
}
.app.is-cmp .modal-filters .modal-tabs {
  margin: 8px 20px 2px;
}
.app.is-cmp .modal-filters .modal-tab {
  height: 36px;
  font-size: 12.5px;
}
.app.is-cmp .modal-filters .modal-body {
  padding: 14px 20px 18px;
}
.app.is-cmp .modal-filters .f-sec .chips .chip {
  height: 34px;
  font-size: 12.5px;
}
.app.is-cmp .modal-filters .modal-foot {
  padding: 12px 20px 16px;
}
.app.is-cmp .modal-filters .modal-foot .btn-primary {
  height: 42px;
}
.modal-link-btn {
  height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--bd-E6D6AE);
  background: var(--bg-FFFFFF);
  color: var(--fg-7A5E1C);
  font-size: 13.5px;
  font-weight: 800;
  align-self: center;
}
.modal-link-btn:hover {
  border-color: #C7A14E;
  background: var(--bg-FBF3DF);
}
.modal-tabs {
  flex: none;
  display: flex;
  gap: 4px;
  padding: 4px;
  margin: 4px 24px 0;
  background: var(--bg-F3EEE2);
  border-radius: 14px;
  overflow-x: auto;
  scrollbar-width: none;
}
.modal-tab {
  flex: none;
  white-space: nowrap;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 40px;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--fg-6B7280);
  font-size: 13.5px;
  font-weight: 800;
  transition:
    background 0.2s ease,
    color 0.2s ease;
}
.modal-tab:hover {
  color: var(--fg-1F2937);
}
.modal-tab.is-on {
  background: var(--bg-FFFFFF);
  color: var(--fg-1F2937);
  box-shadow: 0 4px 12px -8px rgba(92, 71, 21, 0.4);
}
.modal-tab .lbl-short {
  display: none;
}
/* Opened from a classification pill: only the table tabs (app.js openFiltersModal noSources puts the class on the overlay). */
#modal-filters.no-sources .modal-tab[data-tab="sources"],
#modal-filters.no-sources .f-sec[data-sec="sources"] {
  display: none;
}
.modal-tab .f-count {
  min-width: 20px;
  height: 20px;
  font-size: 11px;
  background: var(--bg-FBF3DF);
  color: var(--fg-1F2937);
}
.f-sec {
  display: none;
  flex-direction: column;
  gap: 14px;
}
.f-sec.is-on {
  display: flex;
}
.f-sec-hint {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--fg-8E97A6);
}
.f-sec .chips .chip {
  height: 42px;
}
/* In the dialog the tree's search sits above a bordered list of 48px rows with hairlines between them (the design's tree box). */
.f-sec .tree-box {
  display: flex;
  flex-direction: column;
}
.f-sec .dd-tree {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.f-sec .dd-search {
  margin: 0;
  height: 44px;
  padding: 0 12px;
  border-radius: 12px;
}
.f-sec .dd-search .ic {
  width: 16px;
  height: 16px;
}
.f-sec .dd-search input {
  font-size: 14px;
}
.f-sec .dd-list {
  max-height: none;
  padding: 0;
  gap: 0;
  border: 1px solid var(--bd-EEE3C8);
  border-radius: 14px;
  overflow: hidden;
}
.f-sec .tree-row {
  min-height: 48px;
  padding: 0 6px 0 12px;
  border-radius: 0;
}
.f-sec .tree-row + .tree-row {
  border-top: 1px solid var(--bd-EEE3C8);
}
.f-sec .tree-toggle {
  width: 30px;
  height: 36px;
}
.f-sec .tree-toggle .ic {
  --ic: url("icons/l-chevron-left.2b7a62a0e435.svg");
  width: 16px;
  height: 16px;
}
.f-sec .tree-row.open > .tree-toggle .ic {
  transform: rotate(-90deg);
}
.f-sec .tree-label {
  min-height: 44px;
  font-size: 14px;
  font-weight: 800;
}
.f-sec .dd-foot {
  padding: 0;
}

/* Reader. */
.modal-reader {
  max-width: 760px;
  font-family: "Almarai", system-ui, sans-serif;
}
.modal-reader .modal-title {
  font-family: "Cairo", system-ui, sans-serif;
  font-weight: 800;
  font-size: 20px;
  line-height: 1.55;
}
.reader-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.enc-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--bg-F3F0E8);
  color: var(--fg-5B6475);
  font-size: 12px;
  font-weight: 700;
}
.reader-body {
  font-size: 15px;
  line-height: 2;
  font-weight: 500;
  color: var(--fg-374151);
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.modal-reader .modal-foot {
  justify-content: flex-end;
  gap: 8px;
}
.modal-reader .modal-foot .btn {
  flex: none;
}

/* Share: the design centres the card at every width (460 wide on desktop, 420 on phones with a 20px / 14px margin), 22px corners. */
#share-overlay.ov {
  padding: 32px 20px;
}
.modal-share {
  max-width: 460px;
  max-height: calc(100vh - 64px);
  border-radius: 22px;
  background: var(--bg-FFFDF8);
  gap: 12px;
  padding: 18px 20px 20px;
  overflow-y: auto;
}
.sh-head {
  display: flex;
  align-items: center;
  gap: 10px;
}
.sh-head-ic {
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 9px;
  background: linear-gradient(135deg, #C9A94F, #9A7D33);
  color: #FFFFFF;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 16px -10px rgba(154, 125, 51, 0.9);
}
.sh-head-ic .ic {
  width: 15px;
  height: 15px;
}
.sh-head b {
  flex: 1;
  font-size: 17px;
  font-weight: 800;
  color: var(--fg-1F2937);
}
.sh-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 13px 14px 12px;
  background: var(--card-hi);
  border: 1px solid var(--card-hi-bd);
  border-radius: 16px;
  box-shadow: var(--card-hi-sh);
  overflow: hidden;
}
.sh-card::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, #9A7D33, #E8C979, #9A7D33);
}
.sh-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.sh-card-top > span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.sh-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--bg-F3F0E8);
  color: var(--fg-374151);
  font-size: 11.5px;
  font-weight: 800;
}
.sh-tag .ic {
  width: 12px;
  height: 12px;
  background-color: var(--fg-6B7280);
}
.sh-tag.gold {
  background: var(--bg-FBF3DF);
  border: 1px solid var(--bd-EADBB4);
  color: var(--fg-7A5E1C);
}
.sh-tag.gold .ic {
  background-color: var(--fg-A07E2B);
}
.sh-title {
  font-family: "Almarai", system-ui, sans-serif;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.6;
  color: var(--fg-1F2937);
  margin-top: 2px;
}
.sh-desc {
  font-family: "Almarai", system-ui, sans-serif;
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.8;
  color: var(--fg-6B7280);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.sh-opts {
  margin: 0;
  display: flex;
  flex-direction: column;
  padding: 2px 12px 6px;
  border: 1px dashed var(--bd-CDBB8E);
  border-radius: 14px;
  min-width: 0;
}
.sh-opts legend {
  padding: 0 6px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--fg-7A6A45);
}
.sh-opt {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 34px;
  padding: 0 2px;
  color: var(--fg-1F2937);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.sh-opt input {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  flex: none;
  margin: 0;
  border-radius: 5px;
  border: 1.5px solid var(--bd-C9BFA6);
  background: var(--bg-FFFFFF);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition:
    background 0.2s ease,
    border-color 0.2s ease;
}
.sh-opt input::after {
  content: "";
  width: 11px;
  height: 11px;
  background-color: #FFFFFF;
  -webkit-mask: url("icons/l-check.2a8d8742e534.svg") center / contain no-repeat;
  mask: url("icons/l-check.2a8d8742e534.svg") center / contain no-repeat;
  opacity: 0;
}
.sh-opt input:checked {
  border-color: var(--p);
  background: var(--p);
}
.sh-opt input:checked::after {
  opacity: 1;
}
.sh-opt a {
  color: inherit;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-color: var(--fg-D6CBB0);
}
.sh-opt a .ic {
  width: 12px;
  height: 12px;
  background-color: var(--fg-9AA1AE);
}
.ask-tip {
  display: none;
}
.sh-head .modal-close.round {
  width: 34px;
  height: 34px;
}
.sh-native {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  border: 0;
  border-radius: 12px;
  background: var(--p);
  color: #FFFFFF;
  font-size: 13.5px;
  font-weight: 800;
  box-shadow: 0 14px 28px -16px rgba(var(--p-rgb), 0.7);
}
.sh-native:hover {
  background: var(--p-2);
}
.sh-native .ic {
  width: 15px;
  height: 15px;
}
.sh-socials {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}
.sh-soc {
  width: 44px;
  height: 44px;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  box-shadow: 0 10px 20px -12px rgba(17, 24, 39, 0.45);
  transition: transform 0.2s ease;
  color: #FFFFFF;
}
.sh-soc:hover {
  transform: translateY(-2px);
  color: #FFFFFF;
}
.sh-soc .ic {
  width: 20px;
  height: 20px;
  background-color: #FFFFFF;
}
.sh-soc.whatsapp {
  background: #25D366;
}
.sh-soc.telegram {
  background: #229ED9;
}
.sh-soc.x {
  background: var(--bg-111111);
  border: 1px solid var(--soc-bd);
}
.sh-soc.x .ic {
  width: 16px;
  height: 16px;
}
.sh-soc.email {
  background: #5B6475;
}
.sh-link-row {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px;
  background: var(--bg-FFFFFF);
  border: 1px solid var(--bd-E3D3AA);
  border-radius: 12px;
}
.sh-link-row input {
  flex: 1;
  min-width: 0;
  height: 34px;
  padding: 0 8px;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 12px;
  color: var(--fg-6B7280);
}
.sh-link-row .btn {
  height: 34px;
  padding: 0 10px;
  border-radius: 9px;
  font-size: 12px;
  gap: 5px;
}
/* «نسخ الرسالة» is charcoal in the design, not the primary green. */
.sh-link-row .btn-primary {
  background: var(--fg-1F2937);
}
.sh-link-row .btn-primary:hover {
  background: var(--fg-374151);
}
.sh-link-row .btn .ic {
  width: 14px;
  height: 14px;
}
.sh-link-row .btn-primary.copied {
  background: #16A34A;
}

/* Forms (note, contact). */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field > span,
.field > label {
  font-size: 13px;
  font-weight: 800;
  color: var(--fg-374151);
}
.field .opt {
  font-weight: 600;
  color: var(--fg-8E97A6);
}
.input,
.textarea,
.select {
  width: 100%;
  min-width: 0;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--bd-EEE6D2);
  border-radius: 11px;
  background: var(--bg-F7F4EC);
  outline: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--fg-1F2937);
  text-align: right;
  transition:
    border-color 0.2s ease,
    background 0.2s ease,
    box-shadow 0.2s ease;
}
.input:focus,
.textarea:focus,
.select:focus {
  border-color: #C7A14E;
  background: var(--bg-FFFFFF);
  box-shadow: 0 0 0 4px rgba(199, 161, 78, 0.16);
}
.textarea {
  height: 120px;
  padding: 10px 12px;
  line-height: 1.7;
  resize: none;
  display: block;
}
.select-wrap {
  position: relative;
  display: block;
}
.select {
  appearance: none;
  -webkit-appearance: none;
  padding-left: 34px;
  cursor: pointer;
}
.select-wrap .ic {
  position: absolute;
  top: 50%;
  left: 12px;
  width: 14px;
  height: 14px;
  margin-top: -7px;
  background-color: var(--fg-6B7280);
  pointer-events: none;
}
.form-error {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--bg-FBEDEE);
  border: 1px solid var(--bd-F3D3D6);
  color: var(--fg-B4232A);
  font-size: 13px;
  font-weight: 700;
  margin: 0;
}
.form-error .ic {
  width: 16px;
  height: 16px;
}
.form-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 2px;
}
.form-row .btn-primary {
  flex: 1;
  min-width: 0;
  height: 48px;
  border-radius: 12px;
  font-size: 15px;
  box-shadow: 0 12px 24px -14px rgba(var(--p-rgb), 0.6);
}
.form-row .btn {
  height: 48px;
  border-radius: 12px;
}
.honey {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}
.success-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 18px 16px;
  border-radius: 16px;
  background: var(--bg-F7F4EC);
  border: 1px solid var(--bd-EEE6D2);
  text-align: center;
}
.success-ic {
  width: 52px;
  height: 52px;
  border-radius: 999px;
  background: var(--bg-p-50);
  border: 1px solid var(--bd-p-200);
  color: var(--fg-p-h);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.success-ic .ic {
  width: 24px;
  height: 24px;
}
.success-box strong {
  font-size: 16px;
  font-weight: 900;
  color: var(--fg-1F2937);
}
.success-box span {
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.7;
  color: var(--fg-4B5563);
}
.note-number {
  font-weight: 900;
  font-size: 18px;
  color: var(--p);
  direction: ltr;
}
.modal-note {
  max-width: 520px;
}
.modal-note .modal-head {
  align-items: flex-start;
}
.modal-note-ic {
  width: 46px;
  height: 46px;
  flex: none;
  border-radius: 999px;
  background: var(--bg-FBF3DF);
  border: 1px solid var(--bd-E3D3AA);
  color: var(--fg-A07E2B);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.modal-note-ic .ic {
  width: 22px;
  height: 22px;
}
.modal-note .modal-title {
  font-size: 21px;
}
.modal-note .modal-sub {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Contact. */
/* «تواصل معنا» at the design's desktop sizes: 520 wide, 22px corners, head 22/22/14, body 4/22/18 with 14px between fields, full-width 50px submit, column footer. */
.modal-contact {
  max-width: 520px;
  border-radius: 22px;
  background: var(--bg-FFFDF8);
  box-shadow: 0 40px 80px -30px rgba(17, 24, 39, 0.5);
}
.modal-contact .modal-head {
  padding: 22px 22px 14px;
}
.modal-contact .modal-head-text {
  gap: 2px;
}
.modal-contact .modal-title {
  font-size: 22px;
}
.modal-contact .modal-sub {
  font-size: 13.5px;
  line-height: 1.8;
}
.modal-contact .modal-close.round {
  box-shadow: none;
}
.modal-contact .modal-body {
  padding: 4px 22px 18px;
  gap: 14px;
}
.cf-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.modal-contact::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, #9A7D33, #E8C979, #9A7D33);
}
.modal-contact {
  position: relative;
}
.cf-ic {
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 13px;
  background: linear-gradient(135deg, #C9A94F, #9A7D33);
  color: #FFFFFF;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 20px -10px rgba(154, 125, 51, 0.9);
}
.cf-ic .ic {
  width: 21px;
  height: 21px;
}
.cf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
}
.cf-field {
  position: relative;
  display: flex;
}
.cf-field > .ic {
  position: absolute;
  top: 50%;
  right: 13px;
  width: 16px;
  height: 16px;
  margin-top: -8px;
  background-color: var(--fg-A07E2B);
  pointer-events: none;
}
.cf-field .input {
  height: 46px;
  padding-right: 38px;
  background: var(--bg-FFFFFF);
  border-color: var(--bd-E3D9C2);
  border-radius: 12px;
  font-size: 15px;
}
.cf-field .textarea {
  padding: 10px 14px 24px;
  background: var(--bg-FFFFFF);
  border-color: var(--bd-E3D9C2);
  border-radius: 12px;
  height: 104px;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.8;
}
.cf-field .input:focus,
.cf-field .textarea:focus {
  border-color: #C7A14E;
  box-shadow: 0 0 0 3px rgba(199, 161, 78, 0.18);
}
.cf-count {
  position: absolute;
  left: 12px;
  bottom: 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--fg-9AA1AE);
  pointer-events: none;
  direction: ltr;
}
.cf-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  height: 50px;
  border: 0;
  border-radius: 14px;
  background: var(--p);
  color: #FFFFFF;
  font-size: 15px;
  font-weight: 800;
  box-shadow: 0 14px 28px -16px rgba(var(--p-rgb), 0.75);
  transition:
    background 0.2s ease,
    transform 0.2s ease;
}
.cf-submit:hover {
  background: var(--p-2);
  transform: translateY(-1px);
}
.cf-submit .ic {
  width: 17px;
  height: 17px;
  background-color: #E8C979;
}
.cf-sent {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  padding: 14px 4px 6px;
}
.cf-check {
  width: 64px;
  height: 64px;
  border-radius: 999px;
  background: var(--bg-p-50);
  border: 1px solid var(--bd-p-200);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 8px rgba(var(--p-rgb), 0.05);
}
.cf-check > span {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  background: var(--p);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.cf-check .ic {
  width: 22px;
  height: 22px;
  background-color: #E8C979;
}
.cf-sent-title {
  margin-top: 4px;
  font-size: 18px;
  font-weight: 800;
  color: var(--fg-1F2937);
}
.cf-sent-hint {
  font-size: 14px;
  line-height: 1.8;
  color: var(--fg-4B5563);
}
.cf-sent-actions {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 6px;
}
.cf-sent-actions .btn {
  height: 44px;
  border-radius: 12px;
}
.cf-foot {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  padding: 12px 22px 18px;
  background: var(--bg-FBF6EA);
  border-top: 1px solid var(--bd-EEE3C8);
}
.cf-foot > span {
  flex: none;
  white-space: nowrap;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--fg-7A6A45);
}
.cf-channels {
  flex: 1;
  min-width: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.cf-ch {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 50px;
  padding: 0 7px;
  border-radius: 13px;
  border: 1px solid var(--bd-E3D3AA);
  background: var(--bg-FFFFFF);
  color: var(--fg-1F2937);
  font-size: 14px;
  font-weight: 800;
  transition:
    border-color 0.2s ease,
    transform 0.2s ease;
}
.cf-ch:hover {
  transform: translateY(-1px);
  color: var(--fg-1F2937);
}
.cf-ch.whatsapp:hover {
  border-color: #25D366;
}
.cf-ch.telegram:hover {
  border-color: #229ED9;
}
.cf-ch.is-unset {
  opacity: 0.5;
  cursor: not-allowed;
}
.cf-count.is-near {
  color: var(--fg-B4232A);
}
.cf-foot .lbl-short {
  display: none;
}
/* Compact (phones, or a viewport under 720px tall; app.js adds is-cmp when opening): smaller head, placeholders instead of labels, a 96px message box, a row footer «أو عبر» without chevrons. */
.modal-contact.is-cmp .modal-head {
  padding: 18px 22px 12px;
}
.modal-contact.is-cmp .cf-ic {
  width: 38px;
  height: 38px;
}
.modal-contact.is-cmp .modal-title {
  font-size: 19px;
}
.modal-contact.is-cmp .modal-sub {
  font-size: 12.5px;
}
.modal-contact.is-cmp .modal-body {
  padding: 2px 22px 14px;
  gap: 10px;
}
.modal-contact.is-cmp .cf-form,
.modal-contact.is-cmp .cf-grid {
  gap: 10px;
}
.modal-contact.is-cmp .field > span:first-child {
  display: none;
}
.modal-contact.is-cmp .cf-field .textarea {
  height: 96px;
}
.modal-contact.is-cmp .cf-submit {
  height: 48px;
}
.modal-contact.is-cmp .cf-foot {
  flex-direction: row;
  align-items: center;
  padding: 10px 22px calc(12px + env(safe-area-inset-bottom));
}
.modal-contact.is-cmp .cf-foot .lbl-long {
  display: none;
}
.modal-contact.is-cmp .cf-foot .lbl-short {
  display: inline;
}
.modal-contact.is-cmp .cf-ch {
  height: 44px;
  font-size: 13px;
}
.modal-contact.is-cmp .cf-ch > .ic-chevron-left {
  display: none;
}
.cf-ch-ic {
  width: 34px;
  height: 34px;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
}
.cf-ch.whatsapp .cf-ch-ic {
  background: #25D366;
}
.cf-ch.telegram .cf-ch-ic {
  background: #229ED9;
}
.cf-ch-ic .ic {
  width: 18px;
  height: 18px;
  background-color: #FFFFFF;
}
.cf-ch > span:nth-child(2) {
  flex: 1;
  min-width: 0;
}
.cf-ch > .ic-chevron-left {
  width: 14px;
  height: 14px;
  background-color: var(--fg-9AA1AE);
}

/* ═══ Login / register dialog ═══════════════════════════════════════════ */
.modal-auth {
  max-width: 460px;
  transition: max-width 0.3s ease;
}
.modal-auth.is-up {
  max-width: 620px;
}
.modal-auth .auth-in,
.modal-auth .auth-up {
  display: none;
}
.modal-auth.is-in .auth-in,
.modal-auth.is-up .auth-up {
  display: flex;
}
.modal-auth.is-in h2.auth-in,
.modal-auth.is-up h2.auth-up {
  display: block;
}
.modal-auth.is-in span.auth-in,
.modal-auth.is-up span.auth-up {
  display: block;
}
.modal-auth .modal-body {
  gap: 16px;
  padding-top: 4px;
}
.auth-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border-radius: 14px;
  background: var(--bg-F3F0E8);
}
.auth-tab {
  height: 40px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--fg-6B7280);
  font-size: 14px;
  font-weight: 800;
  transition:
    background 0.2s ease,
    color 0.2s ease,
    box-shadow 0.2s ease;
}
.auth-tab.is-on {
  background: var(--bg-FFFFFF);
  color: var(--fg-1F2937);
  box-shadow: 0 4px 12px -8px rgba(92, 71, 21, 0.4);
}
.auth-form {
  flex-direction: column;
  gap: 14px;
  margin: 0;
}
.auth-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 11px 12px;
}
.auth-grid .span2 {
  grid-column: 1 / -1;
}
.auth-grid .field > span:first-child {
  font-size: 12.5px;
}
.req {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.req::after {
  content: "";
  width: 5px;
  height: 5px;
  flex: none;
  border-radius: 1px;
  background: #C7A14E;
  transform: rotate(45deg);
}
.field-ic {
  position: relative;
  display: block;
}
.field-ic > .ic:first-child {
  position: absolute;
  top: 50%;
  right: 13px;
  width: 17px;
  height: 17px;
  margin-top: -8.5px;
  background-color: var(--fg-A07E2B);
  pointer-events: none;
}
.field-ic .input,
.field-ic .select {
  height: 42px;
  padding-right: 40px;
}
.field-ic.lg .input {
  height: 48px;
  padding-right: 44px;
  border-radius: 12px;
  font-size: 14.5px;
}
.field-ic.has-pw .input {
  padding-left: 44px;
}
.field-ic.textarea-ic > .ic:first-child {
  top: 12px;
  margin-top: 0;
}
.field-ic .textarea {
  height: 58px;
  padding: 8px 40px 8px 12px;
  line-height: 1.6;
}
.field-ic .textarea::placeholder {
  font-size: 12px;
}
.field-ic.select-wrap .select-chev {
  position: absolute;
  top: 50%;
  left: 12px;
  width: 14px;
  height: 14px;
  margin-top: -7px;
  background-color: var(--fg-6B7280);
  pointer-events: none;
}
.pw-toggle {
  position: absolute;
  top: 50%;
  left: 4px;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  border: 0;
  background: transparent;
  color: var(--fg-6B7280);
}
.pw-toggle:hover {
  background: var(--bg-EFE8D6);
  color: var(--fg-1F2937);
}
.pw-toggle .ic {
  width: 17px;
  height: 17px;
}
.field-err {
  font-size: 12px;
  font-weight: 700;
  color: var(--fg-B4232A);
}
.field-hint {
  margin-top: -5px;
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-6B7280);
}
.link-btn {
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 13.5px;
  font-weight: 800;
  color: var(--fg-A07E2B);
  cursor: pointer;
}
.link-btn:hover {
  color: var(--fg-7A5E1C);
  text-decoration: underline;
}
.auth-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 50px;
  margin-top: 2px;
  border: 0;
  border-radius: 12px;
  background: var(--p);
  color: #FFFFFF;
  font-size: 15px;
  font-weight: 800;
  box-shadow: 0 12px 24px -14px rgba(var(--p-rgb), 0.6);
  transition:
    filter 0.2s ease,
    transform 0.2s ease;
}
.auth-submit:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}
.auth-submit .ic {
  width: 16px;
  height: 16px;
}
.auth-foot {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--fg-6B7280);
}
/* The /accounts/login/ and /accounts/register/ pages behind the dialog. */
.auth-page {
  align-items: center;
  justify-content: center;
  text-align: center;
  flex: 1 0 auto;
  gap: 12px;
  padding-bottom: 40px;
}
.auth-page-logo {
  width: 56px;
  height: 68px;
  object-fit: contain;
  filter: var(--logo-f);
}
.auth-page .lead {
  max-width: 480px;
}
.auth-page-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 6px;
}

/* ═══ Section pages, card page, about ═══════════════════════════════════ */
.page {
  position: relative;
  z-index: 3;
  flex: 1 0 auto;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 20px 28px 0;
}
@media (min-width: 1441px) {
  .page {
    padding-inline: 34px;
  }
}
.crumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
}
.crumb a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--fg-6B7280);
}
.crumb a:hover {
  color: var(--fg-1F2937);
}
.crumb a .ic {
  width: 14px;
  height: 14px;
}
.crumb .crumb-sep {
  width: 13px;
  height: 13px;
  background-color: var(--fg-C7B98F);
}
.crumb > span:last-child {
  color: var(--fg-1F2937);
}
.sec-head {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 760px;
}
.eyebrow {
  align-self: flex-start;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--bg-FBF3DF);
  color: var(--fg-7A5E1C);
  font-size: 12.5px;
  font-weight: 800;
}
.eyebrow .ic {
  width: 14px;
  height: 14px;
  background-color: var(--fg-A07E2B);
}
a.eyebrow:hover {
  background: var(--bg-F5E9C8);
  color: var(--fg-7A5E1C);
}
.sec-title {
  margin: 0;
  font-weight: 800;
  font-size: clamp(26px, 3vw, 34px);
  line-height: 1.35;
  color: var(--fg-1F2937);
  text-wrap: balance;
}
.lead {
  margin: 0;
  font-size: 15px;
  line-height: 1.95;
  font-weight: 500;
  color: var(--fg-4B5563);
  text-wrap: pretty;
  white-space: pre-line;
}
.page .group .cards-grid .card .card-title {
  font-size: 0.9375rem;
  line-height: 1.6;
  text-wrap: pretty;
}
.page .group .cards-grid .card .card-desc {
  font-size: 0.75rem;
  line-height: 1.8;
  margin-top: -4px;
  -webkit-line-clamp: 3;
}
.card-files {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.file-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  height: 30px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--bd-E6DDC6);
  background: var(--bg-FBF8F1);
  color: var(--fg-374151);
  font-size: 12px;
  font-weight: 700;
}
.file-chip:hover {
  border-color: #C7A14E;
  color: var(--fg-1F2937);
}
.file-chip .ic {
  width: 13px;
  height: 13px;
  background-color: var(--fg-A07E2B);
}
.file-chip span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-chip em {
  font-style: normal;
  font-size: 10.5px;
  font-weight: 800;
  color: var(--fg-8E97A6);
  text-transform: uppercase;
}
.page-search-row {
  display: flex;
  align-items: stretch;
  gap: 10px;
  flex-wrap: wrap;
}
.page-search {
  flex: 1 1 260px;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 0 12px;
  border-radius: 12px;
  background: var(--bg-FFFFFF);
  border: 1px solid var(--bd-E6DDC6);
}
.page-search .ic {
  width: 17px;
  height: 17px;
  background-color: var(--fg-6B7280);
}
.page-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--fg-1F2937);
}
.page-filters {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.page-filters .link-clear {
  height: 30px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--fg-B4232A);
  font-size: 12px;
  font-weight: 700;
}
.page-filters .link-clear:hover {
  background: var(--bg-FBEDEE);
}
.dw-empty {
  margin: 0;
  padding: 18px 12px;
  text-align: center;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--fg-6B7280);
}

/* Card page. */
.cardpg {
  align-items: center;
}
.card-sheet {
  width: 100%;
  max-width: 780px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  font-family: "Almarai", system-ui, sans-serif;
}
.card-sheet-head {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.card-sheet-head .crumb {
  font-family: "Cairo", system-ui, sans-serif;
}
.card-sheet h1 {
  margin: 0;
  font-family: "Cairo", system-ui, sans-serif;
  font-weight: 800;
  font-size: clamp(22px, 2.6vw, 30px);
  line-height: 1.5;
  color: var(--fg-1F2937);
  text-wrap: pretty;
}
.card-tools {
  position: sticky;
  top: 0;
  z-index: 6;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 0 14px;
  background: var(--bg-FFFFFF);
  border-bottom: 1px solid var(--bd-EEE3C8);
}
.card-tools .btn {
  height: 38px;
  font-size: 13px;
}
.card-tools .spacer {
  flex: 1;
}
.font-seg {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 38px;
  padding: 3px;
  border-radius: 11px;
  border: 1px solid var(--bd-E6DDC6);
  background: var(--bg-FFFFFF);
}
.font-seg button {
  width: 32px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--fg-6B7280);
  font-family: "Cairo", system-ui, sans-serif;
  font-weight: 800;
  line-height: 1;
}
.font-seg button:nth-child(1) {
  font-size: 12px;
}
.font-seg button:nth-child(2) {
  font-size: 15px;
}
.font-seg button:nth-child(3) {
  font-size: 18px;
}
.font-seg button.is-on {
  background: var(--p);
  color: #FFFFFF;
}
.card-body {
  display: flex;
  flex-direction: column;
  gap: 22px;
  font-size: 16px;
  line-height: 2.05;
  font-weight: 500;
  color: var(--fg-374151);
  text-wrap: pretty;
}
.card-body.fs-s {
  font-size: 14.5px;
}
.card-body.fs-l {
  font-size: 18px;
}
.card-body .fld {
  gap: 10px;
}
.related {
  width: 100%;
  max-width: 780px;
}
.related .group-title {
  flex: 1;
  min-width: 0;
}
.rel-card {
  font-family: "Almarai", system-ui, sans-serif;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px;
  background: var(--bg-FFFFFF);
  border: 1px solid var(--bd-EEE3C8);
  border-radius: 14px;
  color: var(--fg-1F2937);
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}
.rel-card:hover {
  border-color: var(--bd-E0CC98);
  box-shadow: 0 16px 30px -24px rgba(var(--p-rgb), 0.4);
  color: var(--fg-1F2937);
}
.rel-card .badge {
  align-self: flex-start;
}
.rel-card .rel-title {
  font-size: 0.875rem;
  font-weight: 700;
  line-height: 1.6;
}
.rel-card .rel-go {
  margin-top: auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12.5px;
  font-weight: 800;
  color: var(--fg-7A5E1C);
}
.rel-card .rel-go .ic {
  width: 14px;
  height: 14px;
}
.related .cards-grid {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
}

/* About page. */
.about-hero {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr));
  gap: 18px;
  align-items: stretch;
}
.about-hero-text {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
  min-width: 0;
}
.about-hero-text h1 {
  font-size: clamp(26px, 3.4vw, 38px);
}
.about-tag {
  margin: 0;
  font-size: clamp(16px, 1.6vw, 18px);
  line-height: 1.6;
  font-weight: 800;
  color: var(--p-ink);
}
.about-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}
.about-actions .btn {
  height: 46px;
  padding: 0 18px;
  border-radius: 12px;
  font-size: 14.5px;
}
.about-actions .btn-primary {
  box-shadow: 0 12px 24px -14px rgba(var(--p-rgb), 0.6);
}
.about-actions .btn-primary .ic {
  background-color: #E8C979;
}
.about-actions .btn .ic-arrow-down {
  background-color: var(--fg-A07E2B);
}
.verse {
  margin: 0;
  position: relative;
  overflow: hidden;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
  padding: 28px 30px;
  border-radius: 20px;
  background: var(--p);
  color: #FFFFFF;
  min-height: 220px;
}
.verse img {
  position: absolute;
  left: -26px;
  bottom: -34px;
  width: 190px;
  height: auto;
  opacity: 0.09;
  filter: brightness(0) invert(1);
  pointer-events: none;
}
.verse blockquote {
  position: relative;
  margin: 0;
  font-family: "Amiri", serif;
  font-weight: 700;
  font-size: clamp(22px, 2.4vw, 28px);
  line-height: 1.9;
  color: #FFFFFF;
  text-wrap: balance;
}
.verse figcaption {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 800;
  color: #E8C979;
}
.verse figcaption::before {
  content: "";
  width: 22px;
  height: 2px;
  flex: none;
  border-radius: 2px;
  background: #C7A14E;
}
.h2 {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: clamp(19px, 2.2vw, 23px);
  font-weight: 800;
  line-height: 1.4;
  color: var(--fg-1F2937);
}
.h2::before {
  content: "";
  width: 4px;
  height: 20px;
  flex: none;
  border-radius: 2px;
  background: #C7A14E;
}
.h2-sub {
  margin: 0;
  padding-right: 12px;
  font-size: 14px;
  line-height: 1.85;
  font-weight: 500;
  color: var(--fg-6B7280);
  text-wrap: pretty;
}
.sec-block {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr));
  gap: 10px;
}
.stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 16px 18px;
  background: var(--bg-FBF8F1);
  border: 1px solid var(--bd-EEE6D2);
  border-radius: 16px;
}
.stat b {
  font-weight: 900;
  font-size: clamp(26px, 3vw, 34px);
  line-height: 1.25;
  color: var(--fg-1F2937);
}
.stat span {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--fg-6B7280);
}
.stats-note {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--fg-6B7280);
}
.stats-note .ic {
  width: 13px;
  height: 13px;
  background-color: var(--fg-A07E2B);
}
.why {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(360px, 100%), 1fr));
  gap: 16px;
  align-items: center;
}
.why-text {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}
.prose {
  margin: 0;
  font-family: "Almarai", system-ui, sans-serif;
  font-size: 15px;
  line-height: 2;
  color: var(--fg-374151);
  text-wrap: pretty;
}
.prose strong {
  color: var(--fg-1F2937);
  font-weight: 800;
}
.pillars {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr));
  gap: 10px;
  min-width: 0;
}
.pillar {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 6px 10px;
  padding: 14px;
  background: var(--bg-FFFFFF);
  border: 1px solid var(--bd-EEE3C8);
  border-radius: 14px;
}
.pillar .box-ic {
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: 10px;
  background: var(--bg-FBF3DF);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.pillar .box-ic .ic {
  width: 17px;
  height: 17px;
  background-color: var(--fg-A07E2B);
}
.pillar h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  color: var(--fg-1F2937);
}
.pillar p {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 13px;
  line-height: 1.8;
  font-weight: 500;
  color: var(--fg-6B7280);
}
.steps {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(250px, 100%), 1fr));
  gap: 12px;
}
.steps li {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 8px 12px;
  padding: 16px;
  background: var(--bg-FFFFFF);
  border: 1px solid var(--bd-EEE3C8);
  border-radius: 16px;
}
.steps .num {
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 12px;
  background: var(--p);
  color: #E8C979;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 19px;
}
.steps h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  color: var(--fg-1F2937);
}
.steps p {
  grid-column: 1 / -1;
  margin: 0;
  font-family: "Almarai", system-ui, sans-serif;
  font-size: 13.5px;
  line-height: 1.9;
  color: var(--fg-4B5563);
  text-wrap: pretty;
}
.features {
  display: grid;
  grid-template-columns: repeat(
    auto-fill,
    minmax(max(240px, min(calc((100% - 24px) / 3), 300px)), 1fr)
  );
  gap: 12px;
}
.feature {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
  background: var(--bg-FFFFFF);
  border: 1px solid var(--bd-EEE3C8);
  border-radius: 14px;
}
.feature-head {
  display: flex;
  align-items: center;
  gap: 10px;
}
.feature .box-ic {
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 11px;
  background: var(--bg-FBF3DF);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.feature .box-ic .ic {
  width: 18px;
  height: 18px;
  background-color: var(--fg-A07E2B);
}
.feature h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.5;
  color: var(--fg-1F2937);
}
.feature p {
  margin: 0;
  font-family: "Almarai", system-ui, sans-serif;
  font-size: 13px;
  line-height: 1.85;
  color: var(--fg-6B7280);
  text-wrap: pretty;
}
.enc-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 4px;
}
.enc-list > span {
  font-size: 13px;
  font-weight: 800;
  color: var(--fg-374151);
}
.enc-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.enc-chips span {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--bg-FFFFFF);
  border: 1px solid var(--bd-E6DDC6);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--fg-1F2937);
}
.secs-grid {
  display: grid;
  grid-template-columns: repeat(
    auto-fill,
    minmax(max(240px, min(calc((100% - 24px) / 3), 300px)), 1fr)
  );
  gap: 12px;
}
.sec-card {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  background: var(--bg-FFFFFF);
  border: 1px solid var(--bd-EEE3C8);
  border-radius: 14px;
  color: var(--fg-1F2937);
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}
.sec-card:hover {
  border-color: var(--bd-E0CC98);
  box-shadow: 0 16px 30px -24px rgba(var(--p-rgb), 0.4);
  color: var(--fg-1F2937);
}
.sec-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
}
.sec-card .box-ic {
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 11px;
  background: var(--p);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.sec-card .box-ic .ic {
  width: 18px;
  height: 18px;
  background-color: #E8C979;
}
.sec-card-head b {
  flex: 1;
  min-width: 0;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.5;
}
.sec-card p {
  flex: 1;
  margin: 0;
  font-family: "Almarai", system-ui, sans-serif;
  font-size: 12.5px;
  line-height: 1.85;
  color: var(--fg-6B7280);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.sec-card .go {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12.5px;
  font-weight: 800;
  color: var(--fg-A07E2B);
}
.sec-card .go .ic {
  width: 14px;
  height: 14px;
}
.two-col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(380px, 100%), 1fr));
  gap: 14px;
  align-items: stretch;
}
.audiences {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.audiences li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 6px 14px 6px 16px;
  border-radius: 12px;
  background: var(--bg-FFFFFF);
  border: 1px solid var(--bd-EEE3C8);
  font-size: 14px;
  font-weight: 800;
  color: var(--fg-1F2937);
}
.audiences .ic {
  width: 17px;
  height: 17px;
  background-color: var(--fg-A07E2B);
}
.principles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(140px, 100%), 1fr));
  gap: 8px;
}
.principle {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  background: var(--bg-FFFFFF);
  border: 1px solid var(--bd-EEE3C8);
  border-radius: 12px;
}
.principle > .ic {
  width: 18px;
  height: 18px;
  margin-top: 3px;
  background-color: var(--fg-A07E2B);
}
.principle div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.principle strong {
  font-size: 14.5px;
  font-weight: 800;
  color: var(--fg-1F2937);
}
.principle span {
  font-size: 12.5px;
  line-height: 1.75;
  font-weight: 500;
  color: var(--fg-6B7280);
}
.cta {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px 24px;
  padding: 26px 30px;
  border-radius: 20px;
  background: var(--p);
  color: #FFFFFF;
}
.cta img {
  position: absolute;
  left: 24px;
  top: 50%;
  transform: translateY(-50%);
  width: 120px;
  height: auto;
  opacity: 0.07;
  filter: brightness(0) invert(1);
  pointer-events: none;
}
.cta-text {
  position: relative;
  flex: 1 1 320px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.cta h2 {
  margin: 0;
  font-size: clamp(20px, 2.4vw, 26px);
  font-weight: 800;
  line-height: 1.4;
  color: #FFFFFF;
}
.cta h2 span {
  color: #E8C979;
}
.cta p {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.9;
  font-weight: 500;
  color: var(--fg-E3ECE8);
  text-wrap: pretty;
}
.cta .btn {
  position: relative;
  height: 48px;
  padding: 0 20px;
  border-radius: 12px;
  border: 0;
  background: #C7A14E;
  color: var(--fg-1F2937);
  font-size: 15px;
}
.cta .btn:hover {
  background: #D9B563;
  color: var(--fg-1F2937);
}

/* ═══ Responsive (the design's single breakpoint: 910px) ════════════════ */
@media (max-width: 1100px) {
  .sb {
    width: 240px;
  }
}
@media (max-width: 1155px) and (min-width: 911px) {
  .cards-grid,
  .features,
  .secs-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 910px) {
  /* In the phone drawer the whole nav scrolls again: the fixed cards would leave the conversation lists only a few pixels. */
  .sb-nav {
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--sb) transparent;
    padding-right: 4px;
  }
  .sb-nav-inner {
    flex: none;
  }
  .sb-hist {
    flex: none;
    overflow: visible;
    padding-right: 0;
  }
  .sb {
    position: fixed;
    height: 100vh;
    height: 100dvh;
    width: 272px;
    box-shadow: -20px 0 50px rgba(17, 24, 39, 0.2);
    display: none;
    --row-h: 40px;
  }
  .app.sb-open .sb {
    display: flex;
  }
  .app.sb-closed .sb {
    display: none;
  }
  .app.sb-open .sb {
    display: flex;
  }
  .sb-sec {
    font-size: 14.5px;
  }
  .sb-copy {
    display: block;
  }
  .main {
    padding: 0;
  }
  .panel {
    min-height: 100vh;
    border: 0;
    border-radius: 0;
  }
  .hdr-toggle {
    display: inline-flex !important;
    width: 44px;
    height: 44px;
  }
  .hdr-toggle .ic-panel-open {
    display: none;
  }
  .hdr-toggle .ic-menu {
    display: inline-block;
  }
  .hdr-nav,
  .dark-toggle,
  .hdr-title {
    display: none !important;
  }
  .m-title {
    display: flex;
  }
  .m-tools {
    display: flex;
  }
  .footer {
    display: none;
  }
  .mob-nav {
    display: grid;
  }
  .mob-spacer {
    display: block;
  }
  .toast {
    bottom: calc(84px + env(safe-area-inset-bottom));
  }
  /* Chat page. */
  .hero {
    flex: 1 0 auto;
    justify-content: center;
    gap: 0;
    padding: 0 14px;
  }
  /* Once a language is picked the blocks stack with the design's own top margins (no flex gap). */
  .hero.has-lang {
    flex: 0 0 auto;
    justify-content: flex-start;
    gap: 0;
    padding: 18px 14px 0;
  }
  /* The design keeps a spacer for the bottom nav inside the section (centred with the content). */
  .hero .m-spacer,
  .m-spacer {
    display: block;
    height: 142px;
    flex: none;
  }
  .hero.has-lang .m-spacer {
    height: 110px;
  }
  .hero ~ .mob-spacer {
    display: none;
  }
  .hero-title {
    display: none;
  }
  .hero-hint {
    font-size: 12.5px;
    gap: 7px;
  }
  .hero-hint::before {
    width: 6px;
    height: 6px;
  }
  .hero-hint .hint-rest {
    display: none;
  }
  .picker {
    margin-top: 16px;
    box-shadow: 0 24px 48px -30px rgba(var(--p-rgb), 0.5);
  }
  .picker-row:first-child {
    border-top-left-radius: 21px;
    border-top-right-radius: 21px;
  }
  body.theme-nm #background-step {
    padding: 14px 16px 16px;
  }
  .picker-row {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 16px;
  }
  .picker-row.is-last {
    border-bottom-left-radius: 21px;
    border-bottom-right-radius: 21px;
  }
  .picker-row.is-done {
    background: var(--bg-FBF6EA);
  }
  .picker-row.is-done .picker-ic {
    background: var(--p);
    color: #E8C979;
  }
  .picker-sep {
    margin: 0 16px;
  }
  .picker-head {
    width: auto;
    flex-wrap: wrap;
    gap: 6px 8px;
  }
  .picker-ic {
    width: 30px;
    height: 30px;
    border-radius: 9px;
  }
  .picker-ic .ic {
    width: 16px;
    height: 16px;
  }
  .picker-label {
    font-size: var(--m-title-fs, 20px);
  }
  .tag-req {
    font-size: 10.5px;
    padding: 2px 8px;
  }
  .chip {
    height: 44px;
  }
  .hint-in {
    height: 44px;
  }
  .picker-foot {
    padding: 12px 16px;
  }
  .picker-done {
    height: 44px;
  }
  .summary {
    flex-wrap: nowrap;
    gap: 10px;
    font-size: 12.5px;
    justify-content: center;
    margin-top: 0;
  }
  .sum-item {
    gap: 4px;
  }
  .sum-val {
    max-width: 120px;
    padding: 2px 9px;
  }
  .sum-edit {
    padding: 0 4px;
    font-size: 12px;
  }
  .sticky-wrap {
    margin-bottom: 0;
  }
  /* Phones open the dialog from the sticky bar: no drop-down panel, no chevron. */
  .sticky-filters .sticky-chev,
  .sticky-panel {
    display: none;
  }
  /* The phone search row has no «الترشيحات» button (the pills and the sticky bar open the dialog). */
  .search-row {
    gap: 8px;
    margin-top: 14px;
  }
  .search-row .btn-filters {
    display: none;
  }
  .search-box {
    height: 54px;
    padding: 0 5px;
    gap: 2px;
  }
  .search-box .sb-clear {
    margin-left: 8px;
  }
  .search-box > .ic-sparkle {
    display: none;
  }
  .search-box input {
    font-size: 16px;
    padding: 0 4px;
  }
  .search-box .btn-go {
    width: 44px;
    height: 44px;
    padding: 0;
    order: -1;
  }
  .search-box .btn-go .ic {
    display: inline-block;
    width: 18px;
    height: 18px;
  }
  .search-box .btn-go span {
    display: none;
  }
  .search-box .btn-ask {
    width: 44px;
    height: 44px;
    padding: 0;
  }
  /* Icon-only on phones: hide the label, keep the masked icon and the tooltip. */
  .search-box .btn-ask > span:not(.ic):not(.ask-tip) {
    display: none;
  }
  /* The design's «اسأل المساعد» tooltip under the ask button while typing (app.js adds tip-on for 3.5s). */
  .btn-ask {
    position: relative;
  }
  .ask-tip {
    position: absolute;
    top: calc(100% + 10px);
    left: -2px;
    z-index: 8;
    display: block;
    opacity: 0;
    transform: translateY(-4px);
    pointer-events: none;
    white-space: nowrap;
    transition:
      opacity 0.25s ease,
      transform 0.25s ease;
  }
  .btn-ask.tip-on .ask-tip {
    opacity: 1;
    transform: none;
  }
  .ask-tip-arrow {
    position: absolute;
    top: -4px;
    left: 19.5px;
    width: 9px;
    height: 9px;
    background: var(--p);
    transform: rotate(45deg);
    border-radius: 2px;
  }
  .sticky-search .ask-tip {
    top: calc(100% + 9px);
  }
  .sticky-search .ask-tip-arrow {
    left: 14.5px;
  }
  .ask-tip-pill {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 30px;
    padding: 0 11px;
    border-radius: 9px;
    background: var(--p);
    color: #FFFFFF;
    font-size: 12.5px;
    font-weight: 800;
    box-shadow: 0 10px 22px -12px rgba(17, 24, 39, 0.5);
  }
  .ask-tip-pill .ic {
    width: 12px;
    height: 12px;
  }
  .search-box .btn-ask .ic {
    width: 19px;
    height: 19px;
  }
  .search-box .mic-btn {
    width: 40px;
    height: 40px;
  }
  .hero.has-lang .needs-lang.qf {
    display: none;
  }
  .hero.has-lang .needs-lang.qf-m {
    display: flex;
  }
  .sticky-bar {
    left: -6px;
    right: -6px;
    height: 54px;
    gap: 6px;
    border-radius: 16px;
    background: var(--bga-255-255-255-97);
  }
  .sticky-filters {
    width: 42px;
    padding: 0;
    border-radius: 12px;
  }
  .sticky-filters > span:not(.f-count):not(.ic) {
    display: none;
  }
  .sticky-filters .f-count {
    position: absolute;
    top: -5px;
    left: -5px;
    min-width: 18px;
    height: 18px;
    border: 1.5px solid #C7A14E;
    font-size: 10.5px;
    background: var(--bg-FFFFFF);
  }
  .sticky-sum {
    display: none;
  }
  .sticky-search {
    height: 42px;
    padding: 0 4px;
    border-radius: 12px;
  }
  .sticky-search input {
    font-size: 16px;
  }
  .sticky-search .btn-go {
    order: -1;
    width: 34px;
    height: 34px;
    border-radius: 9px;
  }
  .sticky-search .btn-ask {
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: 9px;
  }
  .sticky-search .btn-ask > span:not(.ic):not(.ask-tip) {
    display: none;
  }
  .results-head {
    margin: 14px 0 -2px;
    gap: 6px;
  }
  .results-head b {
    font-size: 14px;
  }
  .results-head span {
    font-size: 12px;
  }
  .groups {
    gap: 12px;
    margin-top: 14px;
  }
  .group {
    margin: 0 -10px;
    padding: 14px 7px 16px;
    background: var(--bg-FAF6EE);
    border-color: var(--bd-DFD1AE);
    border-radius: 16px;
  }
  /* Group header: title (the chat title's fitted size), count, and the type tabs pushed to the far end; no icons in the tabs. */
  .group-head {
    gap: 8px;
    padding: 0 2px;
    flex-wrap: nowrap;
  }
  .group-title {
    gap: 5px;
  }
  .group-title::before {
    height: 16px;
  }
  .group-title h2,
  .group-title h3 {
    font-size: var(--m-title-fs, 20px);
  }
  .group-count {
    font-size: 12px;
  }
  .group-tools {
    flex: 0 1 auto;
    min-width: 0;
    margin-right: auto;
  }
  .seg {
    flex: 0 1 auto;
    min-width: 0;
    background: var(--bg-F1E6CC);
    border-color: var(--bd-E3D3AA);
    border-radius: 10px;
    box-shadow: none;
    padding: 3px;
    gap: 2px;
  }
  .seg button {
    height: 32px;
    padding: 0 10px;
    border-radius: 8px;
    font-size: 13px;
    gap: 0;
  }
  .seg button .ic {
    display: none;
  }
  .cards-grid,
  .features,
  .secs-grid,
  .related .cards-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }
  .card {
    gap: 7px;
    padding: 12px 14px 10px;
    border-color: var(--bd-E0CB93);
    box-shadow:
      0 2px 4px rgba(92, 71, 21, 0.06),
      0 10px 22px -12px rgba(92, 71, 21, 0.32);
  }
  .card-top {
    gap: 6px;
  }
  .card-title {
    font-size: 15px;
    line-height: 1.6;
  }
  .card-desc {
    font-size: 13px;
    line-height: 1.75;
    margin-top: 0;
  }
  .btn-download {
    height: 38px;
    padding: 0 22px;
    border-radius: 10px;
    font-size: 13px;
  }
  .card .btn-icon {
    width: 40px;
    height: 38px;
  }
  .btn-share {
    height: 38px;
  }
  .read-more {
    height: 40px;
  }
  .more-tile {
    min-height: 42px;
    margin-top: 2px;
    gap: 6px;
    border-radius: 10px;
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 800;
  }
  .more-tile .mt-long {
    display: none;
  }
  .more-tile .mt-short {
    display: inline;
  }
  .more-tile .ic {
    display: inline-block;
    width: 14px;
    height: 14px;
  }
  .ai {
    position: fixed;
    top: 4px;
    bottom: calc(76px + env(safe-area-inset-bottom));
    left: 8px;
    right: 8px;
    z-index: 29;
    margin: 0;
    border-radius: 18px;
  }
  .ai-head {
    top: 0;
    margin: 6px 6px 0;
    padding: 10px 12px;
  }
  .ai-head-btn span {
    display: none;
  }
  .ai-head-btn {
    min-width: 34px;
    padding: 0 8px;
  }
  .ai-body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 14px 12px 8px;
  }
  .ai-comp-box input {
    font-size: 16px;
  }
  /* Pages. */
  .page {
    gap: 16px;
    padding: 6px 14px 0;
  }
  .sec-title {
    font-size: 24px;
  }
  .lead {
    font-size: 14px;
  }
  .page .group .cards-grid .card .card-title {
    font-size: 15px;
  }
  .about-actions .btn {
    flex: 1 1 100%;
  }
  .verse {
    padding: 22px 20px;
    min-height: 180px;
  }
  .cta {
    padding: 20px 18px;
  }
  .cta .btn {
    flex: 1 1 100%;
  }
  .card-tools {
    gap: 6px;
  }
  .card-tools .btn {
    padding: 0 10px;
    font-size: 12.5px;
  }
  .card-body {
    font-size: 15px;
  }
  /* Dialogs become bottom sheets. */
  /* The design centres every dialog on phones as a card with 16px margins and 20px corners (bottom sheets are gone). */
  .ov {
    align-items: center;
    padding: 16px;
  }
  .modal {
    max-width: 100%;
    max-height: calc(100dvh - 32px);
    border-radius: 20px;
  }
  #share-overlay.ov {
    align-items: center;
    padding: 16px;
  }
  .modal-share {
    max-width: 420px;
    max-height: calc(100vh - 40px);
    border-radius: 22px;
    padding: 14px 14px 16px;
  }
  .sh-head b {
    font-size: 15.5px;
  }
  .sh-opt {
    min-height: 32px;
  }
  .sh-native {
    height: 42px;
    font-size: 13px;
  }
  .sh-soc {
    width: 42px;
    height: 42px;
  }
  .modal-head {
    padding: 18px 18px 8px;
  }
  .modal-body {
    padding: 12px 18px 18px;
  }
  .modal-foot {
    padding: 12px 18px calc(16px + env(safe-area-inset-bottom));
  }
  .modal-tabs {
    margin: 4px 18px 0;
  }
  /* Phones: the tabs share the track and show the short table names (المصادر / الحجم / المفردات). */
  .modal-tabs .modal-tab,
  .modal-filters .modal-tab,
  .app.is-cmp .modal-filters .modal-tab {
    flex: 1 1 0;
    min-width: 0;
    padding: 0 6px;
    gap: 5px;
  }
  .modal-tab .lbl-long {
    display: none;
  }
  .modal-tab .lbl-short {
    display: inline;
  }
  .modal-title {
    font-size: 21px;
  }
  .lang-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .dd-pop {
    position: fixed;
    top: auto !important;
    bottom: 0;
    left: 0;
    right: 0;
    width: auto;
    max-width: none;
    border-radius: 20px 20px 0 0;
    max-height: 70vh;
    z-index: 120;
  }
  .dd-list {
    max-height: calc(70vh - 120px);
  }
  /* «تواصل معنا» on phones is a centred card (16px margins, 20px corners), not a bottom sheet, with the design's 16px side padding and 16px input text. */
  #contact-overlay.ov {
    align-items: center;
    padding: 16px;
  }
  .modal-contact {
    max-width: 100%;
    max-height: calc(100dvh - 32px);
    border-radius: 20px;
  }
  .modal-contact.is-cmp .modal-head {
    padding: 18px 16px 12px;
  }
  .modal-contact.is-cmp .modal-body {
    padding: 2px 16px 14px;
  }
  .modal-contact.is-cmp .cf-foot {
    padding: 10px 16px calc(12px + env(safe-area-inset-bottom));
  }
  .modal-contact .cf-field .input,
  .modal-contact .cf-field .textarea {
    font-size: 16px;
  }
  .cf-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .input,
  .textarea,
  .select,
  .search-field input,
  .dd-search input,
  .page-search input {
    font-size: 16px;
  }
  /* The languages and background dialogs stay centred cards on phones (design: 16px overlay, 20px radius); the filters dialog is a 90vh sheet. */
  #modal-lang.ov,
  #modal-rel.ov,
  #modal-ctx.ov {
    align-items: center;
    padding: 16px;
  }
  .modal-ctx {
    max-width: 100%;
    height: min(600px, calc(100dvh - 32px));
    border-radius: 20px;
  }
  .modal-lang,
  .modal-rel {
    max-width: 100%;
    border-radius: 20px;
  }
  .modal-lang {
    height: min(560px, calc(100dvh - 32px));
    max-height: none;
  }
  .modal-rel {
    max-height: calc(100dvh - 32px);
  }
  .modal-rel .modal-head {
    padding: 24px 24px 6px;
  }
  .modal-rel .modal-title {
    font-size: 26px;
  }
  .modal-rel .modal-body {
    padding: 14px 24px 20px;
  }
  .modal-rel .modal-foot {
    padding: 14px 24px 22px;
  }
  .modal-rel .chip {
    height: 42px;
  }
  .modal-lang .modal-head {
    padding: 22px 24px 16px;
  }
  .modal-lang .modal-body {
    padding: 16px 18px 20px 24px;
  }
  .modal-lang .modal-title {
    font-size: 26px;
  }
  .modal-lang .search-field input {
    font-size: 14.5px;
  }
  #modal-filters.ov {
    align-items: center;
    padding: 16px;
  }
  .app .modal-filters,
  .app.is-cmp .modal-filters {
    max-width: 100%;
    height: min(640px, calc(100dvh - 32px));
    max-height: none;
    border-radius: 20px;
  }
  .modal-filters .modal-tab {
    padding: 0 10px;
    gap: 5px;
  }
}
/* Narrow phones (the design's «nw», under 400px): tighter header. */
@media (max-width: 399px) {
  .hdr {
    padding: 12px;
    gap: 8px;
  }
  .hdr-start {
    gap: 8px;
  }
  .hdr-toggle,
  .m-tools .m-dark,
  .m-tools .m-logo {
    width: 40px;
    height: 40px;
  }
}
/* Up to 380px (the design's second phone threshold): tighter pills, group header and tabs. */
@media (max-width: 380px) {
  .qf-m {
    gap: 4px;
  }
  .qf-pill {
    height: 32px;
    padding: 0 6px;
    font-size: 11px;
  }
  /* The non-Muslim chat spreads its pills to the row width instead of scrolling. */
  body.theme-nm .qf-m {
    overflow-x: hidden;
  }
  body.theme-nm .qf-pill {
    flex: 1 1 0;
  }
  .group-head {
    gap: 6px;
  }
  .group-title::before {
    display: none;
  }
  .group-count {
    font-size: 11px;
  }
  .seg button {
    padding: 0 6px;
    font-size: 12.5px;
  }
}
/* Design: the summary bar tightens under 440px. */
@media (max-width: 440px) {
  .summary {
    gap: 6px;
    font-size: 12px;
  }
}
@media (max-width: 360px) {
  .mob-nav-item {
    font-size: 10px;
  }
}
