/* ===== الخطوط (محلية، من غير أي خدمة خارجية) ===== */
@font-face { font-family: 'Tajawal'; font-style: normal; font-weight: 400; font-display: swap;
  src: url(/fonts/tajawal-latin-400-normal.woff2) format('woff2');
  unicode-range: U+0020-007E, U+00A0-00FF, U+2013-2014, U+2018-201D, U+2022, U+2026; }
@font-face { font-family: 'Tajawal'; font-style: normal; font-weight: 700; font-display: swap;
  src: url(/fonts/tajawal-latin-700-normal.woff2) format('woff2');
  unicode-range: U+0020-007E, U+00A0-00FF, U+2013-2014, U+2018-201D, U+2022, U+2026; }
@font-face { font-family: 'Tajawal'; font-style: normal; font-weight: 400; font-display: swap;
  src: url(/fonts/tajawal-arabic-400-normal.woff2) format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F, U+25CC; }
@font-face { font-family: 'Tajawal'; font-style: normal; font-weight: 500; font-display: swap;
  src: url(/fonts/tajawal-arabic-500-normal.woff2) format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F, U+25CC; }
@font-face { font-family: 'Tajawal'; font-style: normal; font-weight: 700; font-display: swap;
  src: url(/fonts/tajawal-arabic-700-normal.woff2) format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F, U+25CC; }
@font-face { font-family: 'Tajawal'; font-style: normal; font-weight: 800; font-display: swap;
  src: url(/fonts/tajawal-arabic-800-normal.woff2) format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F, U+25CC; }

/* ===== الألوان: نيلي عميق (وقار) + ذهبي دافئ (أمل) ===== */
:root {
  --indigo-900: #1b1745;
  --indigo-800: #2a2470;
  --indigo-600: #4338a5;
  --indigo-100: #e9e7f8;
  --gold: #f2a93b;
  --gold-dark: #b87410;
  --bg: #f5f3fb;
  --card: #ffffff;
  --text: #1f1d3a;
  --muted: #625f80;
  --line: #dcd8ee;
  --danger: #b3261e;
  --ok: #17724a;
  --wa: #128c4a;
  --radius: 16px;
  --shadow: 0 2px 10px rgba(42, 36, 112, .10);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Tajawal', 'Segoe UI', Tahoma, 'Noto Naskh Arabic', sans-serif;
  font-size: 17px;
  line-height: 1.75;
  min-height: 100vh;
  padding-inline: env(safe-area-inset-right) env(safe-area-inset-left);
}
h1, h2, h3 { line-height: 1.4; margin: 0 0 .5em; font-weight: 800; }
h1 { font-size: 1.7rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 .8em; }
a { color: var(--indigo-600); }
img { max-width: 100%; }
[hidden] { display: none !important; }
.hp { position: absolute; inset-inline-start: -9999px; width: 1px; height: 1px; overflow: hidden; opacity: 0; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 6px; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
.ltr { direction: ltr; unicode-bidi: plaintext; text-align: right; }

.container { max-width: 760px; margin: 0 auto; padding: 18px 16px 48px; }

/* ===== الشريط العلوي ===== */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--indigo-800); color: #fff;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 14px; box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 800; font-size: 1rem; min-width: 0; }
.brand img { border-radius: 9px; flex: none; }
.brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav { display: flex; gap: 6px; flex: none; }
.nav a, .nav button {
  position: relative;
  color: #fff; background: rgba(255, 255, 255, .12); border: 0; border-radius: 12px;
  min-height: 44px; padding: 0 14px; font: inherit; font-weight: 700; font-size: .95rem;
  display: inline-flex; align-items: center; text-decoration: none; cursor: pointer;
}
.nav a:hover, .nav button:hover { background: rgba(255, 255, 255, .22); }
.dot {
  background: var(--gold); color: var(--indigo-900); border-radius: 99px;
  min-width: 22px; height: 22px; padding: 0 6px; font-size: .8rem; font-weight: 800;
  display: inline-flex; align-items: center; justify-content: center; margin-inline-start: 6px;
}

/* ===== شاشة الدخول ===== */
.landing {
  min-height: 100vh;
  background: radial-gradient(1200px 500px at 50% -10%, var(--indigo-600), transparent 70%), var(--indigo-900);
  color: #fff; padding: 28px 16px 40px;
}
.landing-inner { max-width: 460px; margin: 0 auto; }
.hero { text-align: center; padding: 8px 0 22px; }
.hero-logo { width: 92px; height: 92px; border-radius: 24px; box-shadow: 0 6px 24px rgba(0, 0, 0, .35); margin-bottom: 14px; }
.hero h1 { font-size: 1.75rem; margin-bottom: .25em; }
.hero-voice { font-size: 1.55rem; font-weight: 800; color: var(--gold); margin: 0 0 .35em; }
.hero-plea { font-size: 1.08rem; font-weight: 700; background: rgba(255, 255, 255, .1); border: 1px solid rgba(242, 169, 59, .55); border-radius: 14px; padding: 10px 14px; margin: 0; }
.landing .card { color: var(--text); }
.landing a:not(.btn) { color: #ffe2ad; }
.landing .card a:not(.btn) { color: var(--indigo-600); }
.landing .btn-ghost { color: #fff; border-color: rgba(255, 255, 255, .45); }
.landing ol { padding-inline-start: 22px; margin: 0 0 12px; }
.landing ol li { margin-bottom: 6px; }
.landing-links { text-align: center; margin-top: 18px; display: grid; gap: 10px; }
.landing-note { text-align: center; color: #d6d2f2; font-size: .95rem; margin-top: 22px; }

/* ===== البطاقات والنماذج ===== */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 14px; }
.card.flat { box-shadow: none; border: 1px solid var(--line); }
.form { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; font-weight: 700; }
.field > span { font-size: .98rem; }
.field .hint { font-weight: 400; color: var(--muted); font-size: .88rem; }
input[type=text], input[type=password], input[type=tel], input[type=search], textarea, select {
  width: 100%; min-height: 50px; padding: 10px 14px; font: inherit; font-weight: 500; color: var(--text);
  background: #fff; border: 2px solid var(--line); border-radius: 12px;
}
textarea { min-height: 130px; resize: vertical; line-height: 1.7; }
input:focus, textarea:focus, select:focus { border-color: var(--indigo-600); outline: none; box-shadow: 0 0 0 3px rgba(67, 56, 165, .2); }
.check { display: flex; align-items: center; gap: 10px; font-weight: 700; min-height: 44px; }
.check input { width: 22px; height: 22px; accent-color: var(--indigo-600); }
.error { color: var(--danger); font-weight: 700; background: #fdecea; border-radius: 10px; padding: 10px 12px; }
.notice { background: #fff6e0; border: 1px solid #f0d28f; border-radius: 12px; padding: 12px 14px; color: #5b3d00; }
.notice a { color: #7a4d00; font-weight: 700; }

/* ===== الأزرار ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 50px; padding: 0 20px; border-radius: 14px; border: 0; cursor: pointer;
  font: inherit; font-weight: 800; font-size: 1rem; text-decoration: none; text-align: center;
  background: var(--indigo-100); color: var(--indigo-800);
}
.btn:hover { filter: brightness(.96); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--indigo-600); color: #fff; }
.btn-gold { background: var(--gold); color: var(--indigo-900); }
.btn-wa { background: var(--wa); color: #fff; }
.btn-danger { background: #fdecea; color: var(--danger); }
.btn-ghost { background: transparent; border: 2px solid var(--line); color: var(--text); }
.btn-block { width: 100%; }
.btn-sm { min-height: 44px; padding: 0 14px; font-size: .92rem; border-radius: 12px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row.between { justify-content: space-between; }
.stack { display: grid; gap: 12px; }

/* ===== شارات ===== */
.badge { display: inline-block; font-size: .8rem; font-weight: 800; padding: 1px 10px; border-radius: 99px; background: var(--indigo-100); color: var(--indigo-800); vertical-align: middle; }
.badge.admin { background: var(--gold); color: var(--indigo-900); }
.badge.warn { background: #fff0cf; color: #7a4d00; }
.badge.bad { background: #fdecea; color: var(--danger); }
.badge.ok { background: #dff3e8; color: var(--ok); }

/* ===== الأقسام والمواضيع ===== */
.welcome { background: linear-gradient(135deg, var(--indigo-800), var(--indigo-600)); color: #fff; }
.welcome h1 { margin: 0 0 .15em; font-size: 1.45rem; }
.welcome p { margin: 0; color: #e6e3fb; }
.section-card { display: block; text-decoration: none; color: inherit; border-inline-start: 6px solid var(--gold); transition: transform .12s; }
.section-card:hover { transform: translateY(-2px); }
.section-card h2 { color: var(--indigo-800); margin-bottom: .2em; }
.section-card p { color: var(--muted); margin: 0 0 .4em; }
.post-item { display: block; text-decoration: none; color: inherit; }
.post-item:hover { box-shadow: 0 4px 16px rgba(42, 36, 112, .2); }
.post-item h3 { color: var(--indigo-800); margin-bottom: .2em; }
.post-item p { color: var(--muted); margin: 0 0 .4em; }
.meta { color: var(--muted); font-size: .88rem; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.post-body { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 1.08rem; line-height: 1.95; }
.crumbs { margin-bottom: 10px; }
.comment { border-top: 1px solid var(--line); padding: 14px 0 6px; }
.comment:first-child { border-top: 0; }
.comment .who { font-weight: 800; }
.comment .text { white-space: pre-wrap; overflow-wrap: anywhere; margin: 4px 0 8px; }
.comment.pending { background: #fffaf0; border-radius: 12px; padding: 12px; margin: 8px 0; border: 1px dashed #e7c27a; }
.empty { text-align: center; color: var(--muted); padding: 26px 8px; }

/* ===== لوحة الإدارة ===== */
.tabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 12px; scrollbar-width: thin; }
.tab { flex: none; min-height: 46px; padding: 0 16px; border-radius: 12px; font-weight: 800; background: #fff; color: var(--indigo-800); border: 2px solid var(--line); text-decoration: none; display: inline-flex; align-items: center; }
.tab[aria-current=page] { background: var(--indigo-800); border-color: var(--indigo-800); color: #fff; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; font-size: .95rem; margin: 8px 0 12px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.stat { background: var(--indigo-100); border-radius: 14px; padding: 12px; text-align: center; }
.stat b { display: block; font-size: 1.6rem; color: var(--indigo-800); }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.seg label { border: 2px solid var(--line); border-radius: 12px; padding: 10px; text-align: center; font-weight: 800; cursor: pointer; min-height: 50px; display: flex; align-items: center; justify-content: center; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:checked) { border-color: var(--indigo-600); background: var(--indigo-100); color: var(--indigo-800); }
.seg label:has(input:focus-visible) { outline: 3px solid var(--gold); }

/* ===== نافذة منبثقة وتنبيهات ===== */
.overlay { position: fixed; inset: 0; background: rgba(15, 12, 45, .65); z-index: 50; display: flex; align-items: flex-end; justify-content: center; padding: 0; }
.modal { background: #fff; width: 100%; max-width: 560px; border-radius: 22px 22px 0 0; padding: 20px 18px 26px; max-height: 92vh; overflow: auto; }
@media (min-width: 600px) { .overlay { align-items: center; padding: 20px; } .modal { border-radius: 22px; } }
.secret { font-size: 1.25rem; font-weight: 800; letter-spacing: .04em; background: var(--indigo-100); border-radius: 12px; padding: 8px 14px; direction: ltr; text-align: center; user-select: all; overflow-wrap: anywhere; }
.msg-preview { white-space: pre-wrap; background: #f3f2fa; border-radius: 12px; padding: 12px; font-size: .95rem; max-height: 180px; overflow: auto; }
.toast { position: fixed; bottom: 22px; inset-inline: 16px; margin: 0 auto; max-width: 420px; z-index: 80; background: var(--indigo-900); color: #fff; padding: 12px 16px; border-radius: 14px; text-align: center; font-weight: 700; box-shadow: 0 6px 24px rgba(0, 0, 0, .35); }
.toast.ok { background: var(--ok); }
.toast.err { background: var(--danger); }
.loading { text-align: center; color: var(--muted); padding: 40px 0; }
.footer { text-align: center; color: var(--muted); font-size: .9rem; padding: 10px 16px 30px; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
@media (min-width: 640px) { .stats { grid-template-columns: repeat(4, 1fr); } }
