/* ============================================================
   الأرشيف — نظام تصميم فلو (عربي)
   خلفية كريمية + serif ضخم + لافندر نقطة الفعل + أخضر مقلوب
   ============================================================ */

/* ===== خطوط ثمانية — ثلاث عائلات woff2 محلية ===== */
@font-face { font-family: "Thmanyah Serif Display"; src: url("fonts/thmanyahserifdisplay-Black.woff2") format("woff2"); font-weight: 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Thmanyah Serif Display"; src: url("fonts/thmanyahserifdisplay-Bold.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Thmanyah Serif Display"; src: url("fonts/thmanyahserifdisplay-Medium.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Thmanyah Serif Display"; src: url("fonts/thmanyahserifdisplay-Regular.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Thmanyah Serif Display"; src: url("fonts/thmanyahserifdisplay-Light.woff2") format("woff2"); font-weight: 300; font-style: normal; font-display: swap; }

@font-face { font-family: "Thmanyah Serif Text"; src: url("fonts/thmanyahseriftext-Black.woff2") format("woff2"); font-weight: 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Thmanyah Serif Text"; src: url("fonts/thmanyahseriftext-Bold.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Thmanyah Serif Text"; src: url("fonts/thmanyahseriftext-Medium.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Thmanyah Serif Text"; src: url("fonts/thmanyahseriftext-Regular.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Thmanyah Serif Text"; src: url("fonts/thmanyahseriftext-Light.woff2") format("woff2"); font-weight: 300; font-style: normal; font-display: swap; }

@font-face { font-family: "Thmanyah Sans"; src: url("fonts/thmanyahsans-Black.woff2") format("woff2"); font-weight: 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Thmanyah Sans"; src: url("fonts/thmanyahsans-Bold.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Thmanyah Sans"; src: url("fonts/thmanyahsans-Medium.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Thmanyah Sans"; src: url("fonts/thmanyahsans-Regular.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Thmanyah Sans"; src: url("fonts/thmanyahsans-Light.woff2") format("woff2"); font-weight: 300; font-style: normal; font-display: swap; }

/* ===== الألوان الثابتة (بلا دارك مود) ===== */
:root {
  --bg: #FFFFEB;               /* كريمي */
  --bg-soft: #FBF4E3;          /* كريمي فاتح مائل للحشو */
  --bg-card: #FFFFFF;
  --bg-primary: #FFFDF9;       /* panel */
  --panel: #FFFDF9;
  --ink: #1A1A1A;
  --green: #034F46;            /* fathom */
  --green-deep: #04352F;
  --on-green: #FFFFEB;
  --brand: #F0D7FF;            /* لافندر */
  --brand-deep: #E2C0F6;
  --glow: #FFA946;
  --pulse: #7F1C34;
  --border: rgba(26, 26, 26, 0.16);
  --border-soft: rgba(26, 26, 26, 0.09);
  --text: #1A1A1A;
  --text-dim: #4F4A3E;
  --text-muted: #8B8373;
  --accent: #034F46;
  --accent-strong: #043A33;
  --accent-soft: rgba(3, 79, 70, 0.08);
  --danger: #B3261E;
  --danger-soft: rgba(179, 38, 30, 0.07);
  --success: #1B7F5A;
  --success-soft: rgba(27, 127, 90, 0.10);
  --warning: #A86214;
  --warning-soft: rgba(255, 169, 70, 0.18);
  --radius: 16px;
  --radius-lg: 18px;
  --radius-pill: 999px;
  --transition: 44px;
  --shadow: 0 1px 2px rgba(26, 26, 15, 0.06), 0 10px 26px rgba(26, 26, 15, 0.07);
  --font-display: "Thmanyah Serif Display", "Georgia", "Times New Roman", serif;
  --font-text: "Thmanyah Serif Text", "Tahoma", serif;
  --font-sans: "Thmanyah Sans", "Segoe UI", Tahoma, Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-sans);
  background:
    radial-gradient(920px 440px at 88% -8%, rgba(240, 215, 255, 0.55), transparent 62%),
    radial-gradient(760px 400px at -6% 14%, rgba(255, 169, 70, 0.16), transparent 55%),
    radial-gradient(1100px 560px at 50% 112%, rgba(3, 79, 70, 0.10), transparent 60%),
    var(--bg);
  color: var(--text);
  direction: rtl;
  min-height: 100dvh;
  line-height: 1.9;
  transition: background 0.35s ease, color 0.35s ease;
}

body, .nav, .footer, .announce, .r-card, .ad-banner, .admin-card, .lock-card,
.article-list .item, .field input, .field textarea, .search-form, .reader-nav input,
.theme-toggle {
  transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease, color 0.3s ease;
}

::selection { background: var(--green); color: var(--on-green); }
:focus-visible { outline: 2px solid var(--glow); outline-offset: 2px; }

a { color: var(--green); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== شريط التنبيه العام ===== */
.announce {
  display: none;
  background: linear-gradient(90deg, rgba(255, 169, 70, 0.22), rgba(240, 215, 255, 0.4), rgba(255, 169, 70, 0.22));
  border-bottom: 1px solid rgba(26, 26, 26, 0.1);
  color: var(--ink);
  text-align: center;
  padding: 10px 20px;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.8;
}

/* ===== رأس الموقع: شريط تنقل بطاقة pill عائمة ===== */
.site-head {
  position: sticky;
  top: 12px;
  z-index: 20;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 28px;
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow);
  padding: 10px 14px 10px 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 1.06rem;
  color: var(--ink);
  white-space: nowrap;
}
a.brand { text-decoration: none; }
a.brand:hover { text-decoration: none; }

.brand .logo {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--glow);
  box-shadow: 0 0 0 4px rgba(255, 169, 70, 0.22);
  flex-shrink: 0;
}

/* ===== زر ثانوي (شبح): حدود حبر، خلفية شفافة ===== */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 0.92rem;
  color: var(--ink);
  border: 1.5px solid var(--ink);
  border-radius: var(--radius-pill);
  padding: 9px 20px;
  white-space: nowrap;
  transition: background 0.2s, color 0.2s;
}
.back-link:hover {
  text-decoration: none;
  background: var(--ink);
  color: var(--bg);
}

/* ===== زر تبديل المظهر: شمس / هلال ===== */
.nav-actions { display: flex; align-items: center; gap: 10px; }

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s, transform 0.12s, box-shadow 0.2s;
}
.theme-toggle:hover { border-color: var(--glow); color: var(--glow); box-shadow: 0 0 14px rgba(255, 169, 70, 0.25); }
.theme-toggle:active { transform: scale(0.93); }
.theme-toggle svg { width: 21px; height: 21px; display: block; }
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* ===== الصفحة الرئيسية (هيرو) ===== */
.home {
  max-width: 1180px;
  margin: 0 auto;
  padding: clamp(44px, 9vw, 96px) 28px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.home h1 {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(42px, 7.6vw, 84px);
  line-height: 1.2;
  color: var(--ink);
  margin-bottom: 18px;
  text-wrap: balance;
}

.home .sub {
  font-family: var(--font-sans);
  font-size: clamp(1.05rem, 2.2vw, 1.3rem);
  color: var(--text-dim);
  margin-bottom: 56px;
  max-width: 34rem;
  text-wrap: balance;
}
.home .sub::after {
  content: '';
  display: block;
  width: 72px;
  height: 4px;
  border-radius: 2px;
  margin: 26px auto 0;
  background: linear-gradient(90deg, var(--brand), var(--glow));
}

.search-wrap { width: 100%; max-width: 34rem; }

.search-form {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1.5px solid var(--border-soft);
  border-radius: var(--radius-pill);
  padding: 8px 8px 8px 12px;
  box-shadow: var(--shadow);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.search-form:focus-within {
  border-color: var(--green);
  box-shadow: var(--shadow), 0 0 0 4px rgba(3, 79, 70, 0.12);
}

.search-form input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--ink);
  font-family: var(--font-text);
  font-size: clamp(1.05rem, 2.6vw, 1.3rem);
  font-weight: 500;
  text-align: center;
  padding: 12px 8px;
  min-width: 0;
}
.search-form input::placeholder { color: var(--text-muted); }

/* ===== الزر الأساسي الوحيد في الصفحة (لافندر) ===== */
.search-form button,
.reader-nav button {
  flex-shrink: 0;
  border: none;
  border-radius: var(--radius-pill);
  background: var(--brand);
  color: #1A1A1A;
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 1.05rem;
  padding: 15px 36px;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s, transform 0.12s;
}
.search-form button:hover,
.reader-nav button:hover { background: var(--brand-deep); box-shadow: 0 8px 22px rgba(240, 215, 255, 0.55); }
.search-form button:active,
.reader-nav button:active { transform: scale(0.97); }

.hint {
  margin-top: 18px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.err-box {
  margin: 20px auto 0;
  max-width: 30rem;
  display: none;
  color: var(--pulse);
  background: rgba(127, 28, 52, 0.06);
  border: 1px solid rgba(127, 28, 52, 0.28);
  border-radius: 14px;
  padding: 12px 18px;
  font-size: 0.95rem;
  text-align: center;
}

/* ===== الفوتر: قسم مقلوب بأخضر عميق، زوايا علوية دائرية ===== */
.footer {
  margin-top: clamp(56px, 9vw, 96px);
  background: var(--green);
  color: var(--on-green);
  border-radius: var(--transition) var(--transition) 0 0;
  padding: clamp(44px, 7vw, 72px) 28px 40px;
  text-align: center;
}
.footer-inner { max-width: 1180px; margin: 0 auto; }
.footer-mark {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.5rem;
  color: var(--on-green);
}
.footer-mark::before {
  content: '';
  width: 11px; height: 11px;
  border-radius: 50%;
  background: var(--glow);
  box-shadow: 0 0 14px rgba(255, 169, 70, 0.5);
}
.footer-text {
  margin-top: 16px;
  font-family: var(--font-sans);
  font-size: 0.98rem;
  color: var(--on-green);
  opacity: 0.92;
  line-height: 2;
  text-wrap: balance;
}

/* ===== حاوية القراءة ===== */
.container {
  max-width: 52rem;
  margin: 0 auto;
  padding: clamp(28px, 5vw, 56px) 28px 40px;
  min-height: 60dvh;
}

/* ===== صفحة القراءة ===== */
.article-head {
  border-bottom: 1px solid var(--border-soft);
  padding-bottom: 24px;
  margin-bottom: 32px;
}

.article-num {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-sans);
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--green);
  background: rgba(3, 79, 70, 0.06);
  border: 1px solid rgba(3, 79, 70, 0.28);
  border-radius: var(--radius-pill);
  padding: 5px 16px;
  margin-bottom: 18px;
}
.article-num::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--glow);
}

.article-title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(30px, 4.8vw, 48px);
  line-height: 1.25;
  color: var(--ink);
  margin-bottom: 12px;
  text-wrap: balance;
}

.article-meta {
  font-family: var(--font-sans);
  color: var(--text-muted);
  font-size: 0.88rem;
}

.article-body {
  font-family: var(--font-text);
  font-size: 1.16rem;
  line-height: 2.1;
  color: #292419;
  overflow-wrap: break-word;
  word-break: break-word;
}

.article-body p { margin-bottom: 22px; }
.article-body h1, .article-body h2 {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--ink);
  line-height: 1.35;
}
.article-body h1 { font-size: 1.9rem; margin: 40px 0 16px; }
.article-body h2 { font-size: 1.55rem; margin: 36px 0 14px; }
.article-body h3, .article-body h4 {
  font-family: var(--font-sans);
  font-weight: 700;
  color: var(--green);
  margin: 30px 0 12px;
  line-height: 1.6;
}
.article-body h3 { font-size: 1.25rem; }
.article-body h4 { font-size: 1.12rem; }
.article-body ul, .article-body ol { margin: 0 24px 24px 0; }
.article-body li { margin-bottom: 8px; }
.article-body img, .article-body video {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: block;
  margin: 10px auto;
}
.article-body blockquote {
  border-right: 3px solid var(--glow);
  background: var(--panel);
  border-radius: var(--radius);
  padding: 22px 26px;
  margin: 28px 0;
  color: var(--text-dim);
  font-family: var(--font-text);
}
.article-body code {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2px 8px;
  font-size: 0.92em;
  color: var(--green);
  direction: ltr;
  display: inline-block;
}
.article-body pre {
  background: #15120C;
  color: #F2EAD8;
  border-radius: var(--radius);
  padding: 18px;
  overflow-x: auto;
  direction: ltr;
  text-align: left;
  margin-bottom: 24px;
  font-size: 0.92rem;
}
.article-body pre code { background: transparent; border: none; color: inherit; padding: 0; }
.article-body a { color: var(--green); text-decoration: underline; text-decoration-color: rgba(3, 79, 70, 0.3); text-underline-offset: 3px; }

/* ===== تنقل القارئ ===== */
.reader-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 48px;
  padding-top: 26px;
  border-top: 1px solid var(--border-soft);
}
.reader-nav form { display: flex; gap: 8px; flex: 1; max-width: 24rem; }
.reader-nav input {
  flex: 1;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-pill);
  color: var(--ink);
  font-family: inherit;
  font-size: 0.95rem;
  padding: 11px 20px;
  text-align: center;
  outline: none;
  min-width: 0;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.reader-nav input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(3, 79, 70, 0.12); }

/* ===== شارة / صيغة التقارير المؤرشفة ===== */
.header-badge {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  background: rgba(3, 79, 70, 0.06);
  color: var(--green);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 8px 20px;
  border-radius: var(--radius-pill);
  margin-bottom: 24px;
  border: 1px solid rgba(3, 79, 70, 0.25);
}
.header-badge .dot {
  width: 6px; height: 6px;
  background: var(--glow);
  border-radius: 50%;
  animation: pulseGlow 2s infinite;
}
@keyframes pulseGlow { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.5; transform: scale(0.8); } }

.r-card {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 24px 22px;
  margin: 22px 0;
  box-shadow: var(--shadow);
}
.r-card-title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  line-height: 1.5;
}
.r-card-title .icon {
  width: 38px; height: 38px;
  background: var(--brand);
  color: #1A1A1A;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  flex-shrink: 0;
}

.warning-box {
  background: rgba(127, 28, 52, 0.05);
  border: 1px solid rgba(127, 28, 52, 0.28);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin: 24px 0;
  position: relative;
}
.warning-box::before {
  content: '';
  position: absolute;
  right: 0; top: 0; bottom: 0;
  width: 5px;
  background: var(--pulse);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.warning-box-title {
  font-family: var(--font-sans);
  font-weight: 700;
  color: var(--pulse);
  font-size: 1.05rem;
  margin-bottom: 8px;
}
.warning-box p { color: var(--text-dim); }

.info-box {
  background: rgba(3, 79, 70, 0.06);
  border: 1px solid rgba(3, 79, 70, 0.22);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin: 22px 0;
}
.info-box-title {
  font-family: var(--font-sans);
  font-weight: 700;
  color: var(--green);
  font-size: 1.05rem;
  margin-bottom: 8px;
}

.feature-list {
  list-style: none;
  padding: 0;
  margin: 0 0 18px !important;
}
.feature-list li {
  position: relative;
  padding-right: 28px;
  margin-bottom: 14px;
}
.feature-list li::before {
  content: '';
  position: absolute;
  right: 0; top: 11px;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--glow);
  box-shadow: 0 0 10px rgba(255, 169, 70, 0.55);
}

.highlight {
  background: rgba(3, 79, 70, 0.10);
  color: var(--green);
  padding: 2px 8px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.95em;
}
.highlight-danger {
  background: rgba(127, 28, 52, 0.08);
  color: var(--pulse);
  padding: 2px 8px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.95em;
}
.highlight-success {
  background: var(--success-soft);
  color: #17734F;
  padding: 2px 8px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.95em;
}

.quote {
  background: var(--panel);
  border-right: 4px solid var(--glow);
  border-radius: var(--radius);
  padding: 22px 26px;
  margin: 22px 0;
  font-family: var(--font-text);
  font-style: normal;
  color: var(--text-dim);
}

.creator-card {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 22px;
  margin: 18px 0;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  box-shadow: var(--shadow);
}
.creator-avatar {
  width: 56px; height: 56px;
  background: linear-gradient(135deg, var(--brand), #DFB9FF);
  color: #1A1A1A;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
  box-shadow: 0 4px 16px rgba(240, 215, 255, 0.6);
}
.creator-info h4 { font-family: var(--font-sans); font-size: 1.08rem; font-weight: 700; margin-bottom: 4px; color: var(--text); }

.price-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--warning-soft);
  color: var(--warning);
  font-size: 0.9rem;
  font-weight: 700;
  padding: 4px 14px;
  border-radius: var(--radius-pill);
  margin: 4px 0;
  direction: ltr;
}

.r-source {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border-soft);
  color: var(--text-muted);
  font-size: 0.88rem;
}

/* ===== صيغة تقرير المنصات (334) ===== */
.category-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--ink);
  font-size: clamp(1.3rem, 3.6vw, 1.6rem);
  line-height: 1.5;
  margin: 44px 0 10px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-soft);
}
.category-title .icon {
  width: 42px; height: 42px;
  background: var(--brand);
  color: #1A1A1A;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 21px;
  flex-shrink: 0;
}

.site-name {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--ink);
  line-height: 1.5;
  margin-bottom: 10px;
}
.site-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  background: var(--green);
  color: var(--on-green);
  font-size: 0.9rem;
  font-weight: 700;
  border-radius: 10px;
  flex-shrink: 0;
  padding: 0 8px;
}
.site-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.tag {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}
.tag-free { background: var(--success-soft); color: var(--success); border: 1px solid rgba(27, 127, 90, 0.3); }
.tag-open { background: var(--accent-soft); color: var(--accent); border: 1px solid rgba(3, 79, 70, 0.3); }
.tag-community { background: var(--warning-soft); color: var(--warning); border: 1px solid rgba(255, 169, 70, 0.4); }

.site-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.92rem;
  font-weight: 600;
  border: 1px solid rgba(3, 79, 70, 0.3);
  border-radius: var(--radius-pill);
  padding: 8px 18px;
  margin: 4px 0 2px;
  text-decoration: none;
  direction: ltr;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.site-link:hover { background: var(--accent); color: var(--bg); border-color: var(--accent); text-decoration: none; }

/* ===== دليل (335): صناديق القوالب، الهاشتاقات، الجداول ===== */
.tmpl-box {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 26px 26px 20px;
  margin: 26px 0;
}
.tmpl-tag {
  position: absolute;
  top: -13px;
  right: 20px;
  background: var(--brand);
  color: #1A1A1A;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 4px 14px;
  border-radius: var(--radius-pill);
  letter-spacing: 0.3px;
}
.tmpl-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--ink);
  margin: 6px 0 10px;
}
.tmpl-body {
  color: var(--text-dim);
  font-size: 0.96rem;
  line-height: 1.9;
  white-space: pre-line;
}
.tmpl-body strong { color: var(--ink); }
.hashtag-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.tag-hash {
  font-family: var(--font-sans);
  font-size: 0.74rem;
  font-weight: 600;
  padding: 5px 14px;
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid rgba(3, 79, 70, 0.22);
  user-select: all;
  cursor: default;
}
.tag-hash:hover { background: var(--brand); color: #1A1A1A; border-color: transparent; }
.count-badge {
  display: inline-block;
  background: var(--green);
  color: var(--on-green);
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  margin-right: 8px;
}
.flow-table {
  width: 100%;
  border-collapse: collapse;
  margin: 14px 0;
  font-size: 0.92rem;
}
.flow-table th {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  padding: 11px 14px;
  text-align: right;
  border-bottom: 2px solid rgba(3, 79, 70, 0.25);
}
.flow-table td {
  padding: 11px 14px;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border-soft);
  vertical-align: top;
}
.flow-table tr:last-child td { border-bottom: none; }
:root[data-theme="dark"] .tmpl-box { background: var(--panel); border-color: rgba(255, 255, 255, 0.12); }
:root[data-theme="dark"] .tag-hash { background: rgba(240, 215, 255, 0.08); color: var(--brand); border-color: rgba(240, 215, 255, 0.25); }

/* ===== الإعلانات ===== */
.ad-slot {
  display: none;
  width: 100%;
  margin: 20px 0;
}
.ad-slot.has-ads { display: block; }
.ad-slot.site-top-slot {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 28px;
}
.ad-banner {
  display: block;
  background: var(--bg-card);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  font-size: 0.98rem;
  line-height: 1.9;
  overflow: hidden;
  overflow-wrap: anywhere;
  box-shadow: var(--shadow);
}
.ad-banner img, .ad-banner video {
  max-width: 100%;
  max-height: 320px;
  width: auto;
  height: auto;
  border-radius: 12px;
  display: block;
  margin: 4px auto;
  object-fit: contain;
}
.ad-label {
  display: inline-block;
  font-size: 0.72rem;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1px 8px;
  margin-bottom: 6px;
}

/* ===== لوحة التحكم (فرونت إند داخلي، نفس الهوية) ===== */
.admin-panel {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px;
}
.admin-panel .head { margin-bottom: 20px; }
.admin-panel .head h1 { font-family: var(--font-display); font-weight: 900; font-size: clamp(30px, 4vw, 44px); }

.admin-card {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 22px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.admin-card h2 { font-family: var(--font-display); font-size: 1.3rem; margin-bottom: 16px; font-weight: 700; color: var(--ink); }

.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 8px;
}
.field input, .field textarea {
  width: 100%;
  background: var(--bg-soft);
  border: 1.5px solid var(--border-soft);
  border-radius: 14px;
  color: var(--ink);
  font-family: inherit;
  font-size: 1rem;
  padding: 12px 16px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.field input:focus, .field textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(3, 79, 70, 0.12); }
.field textarea { resize: vertical; min-height: 140px; line-height: 1.8; }
.field.check { display: flex; align-items: center; gap: 8px; }
.field.check input { width: auto; }
.field.check label { margin: 0; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--brand);
  color: #1A1A1A;
  border: none;
  border-radius: var(--radius-pill);
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 700;
  padding: 12px 26px;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s, transform 0.12s;
}
.btn:hover { background: var(--brand-deep); text-decoration: none; box-shadow: 0 8px 20px rgba(240, 215, 255, 0.5); }
.btn:active { transform: scale(0.98); }
.btn.danger {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1.5px solid rgba(179, 38, 30, 0.3);
}
.btn.danger:hover { background: var(--pulse); color: var(--on-green); box-shadow: none; }

.article-list .item {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  box-shadow: var(--shadow);
}
.article-list .item .info { display: flex; align-items: center; gap: 12px; min-width: 0; }
.article-list .item .num {
  background: var(--green);
  color: var(--on-green);
  border-radius: var(--radius-pill);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 3px 12px;
  flex-shrink: 0;
}
.article-list .item .title { font-weight: 600; overflow-wrap: anywhere; }
.article-list .item .actions { display: flex; gap: 8px; }
.article-list .item .actions button {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  color: var(--text);
  font-family: inherit;
  font-size: 0.85rem;
  padding: 6px 14px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.article-list .item .actions button:hover { border-color: var(--green); color: var(--green); }
.article-list .item .actions button.del:hover { border-color: var(--pulse); color: var(--pulse); }

.msg {
  display: none;
  margin-bottom: 14px;
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 0.92rem;
}
.msg.ok {
  display: block;
  color: var(--success);
  background: var(--success-soft);
  border: 1px solid rgba(27, 127, 90, 0.25);
}
.msg.err {
  display: block;
  color: var(--pulse);
  background: var(--danger-soft);
  border: 1px solid rgba(127, 28, 52, 0.25);
}
.msg.warn {
  display: block;
  color: var(--warning);
  background: var(--warning-soft);
  border: 1px solid rgba(255, 169, 70, 0.35);
}

.lock-mask {
  min-height: 70dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.lock-card {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 28px;
  width: 100%;
  max-width: 24rem;
  text-align: center;
  box-shadow: var(--shadow);
}
.lock-card h1 { font-family: var(--font-display); font-weight: 700; font-size: 1.4rem; margin-bottom: 8px; }
.lock-card p { color: var(--text-dim); font-size: 0.92rem; margin-bottom: 20px; }
.lock-card .field:last-child { margin-top: 16px; }

.hidden { display: none !important; }
.wide-container { max-width: 1200px; }

/* ===== توسعات الشاشات ===== */
@media (max-width: 600px) {
  .site-head { padding: 0 16px; top: 8px; }
  .home { padding-left: 20px; padding-right: 20px; }
  .container { padding-left: 20px; padding-right: 20px; }
  .search-form { flex-direction: row; }
  .search-form button { padding: 13px 22px; font-size: 1rem; }
  .footer { padding-left: 20px; padding-right: 20px; border-radius: 28px 28px 0 0; }
}
@media (max-width: 480px) {
  .creator-card { flex-direction: column; align-items: center; text-align: center; }
  .r-card { padding: 18px 16px; }
  .nav { padding-right: 14px; }
  .back-link { padding: 8px 14px; font-size: 0.85rem; }
  .reader-nav { flex-direction: column; align-items: stretch; }
  .reader-nav form { max-width: none; }
  .home .sub { font-size: 0.98rem; }
  .ad-slot.site-top-slot { padding: 0 20px; }
}

/* ============================================================
   المظهر الليلي — القراءة الليلية (هلال / شمس)
   ============================================================ */
:root[data-theme="dark"] {
  --bg: #12100C;
  --bg-soft: #1B1813;
  --bg-card: #1E1A14;
  --bg-primary: #1B1712;
  --panel: #1B1712;
  --ink: #FFFFEB;
  --green: #0B6B5E;
  --green-deep: #043A33;
  --on-green: #FFFFEB;
  --brand: #F0D7FF;
  --brand-deep: #E2C0F6;
  --glow: #FFA946;
  --pulse: #E8848F;
  --border: rgba(255, 255, 235, 0.16);
  --border-soft: rgba(255, 255, 235, 0.08);
  --text: #FFFFEB;
  --text-dim: #CDC6B4;
  --text-muted: #A59D8C;
  --accent: #7FD6C9;
  --accent-strong: #0B6B5E;
  --accent-soft: rgba(127, 214, 201, 0.13);
  --danger: #FF8A84;
  --danger-soft: rgba(255, 138, 132, 0.12);
  --success: #6FCFA3;
  --success-soft: rgba(111, 207, 163, 0.13);
  --warning: #FFC57A;
  --warning-soft: rgba(255, 169, 70, 0.16);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 10px 26px rgba(0, 0, 0, 0.45);
}

:root[data-theme="dark"] body {
  background:
    radial-gradient(920px 440px at 88% -8%, rgba(240, 215, 255, 0.09), transparent 62%),
    radial-gradient(760px 400px at -6% 14%, rgba(255, 169, 70, 0.06), transparent 55%),
    radial-gradient(1100px 560px at 50% 112%, rgba(3, 79, 70, 0.25), transparent 60%),
    var(--bg);
}

:root[data-theme="dark"] .announce {
  background: linear-gradient(90deg, rgba(255, 169, 70, 0.12), rgba(240, 215, 255, 0.15), rgba(255, 169, 70, 0.12));
  border-bottom-color: rgba(255, 255, 235, 0.1);
}

:root[data-theme="dark"] .search-form:focus-within,
:root[data-theme="dark"] .reader-nav input:focus,
:root[data-theme="dark"] .field input:focus,
:root[data-theme="dark"] .field textarea:focus {
  box-shadow: var(--shadow), 0 0 0 4px rgba(127, 214, 201, 0.16);
}

:root[data-theme="dark"] .article-body { color: var(--text); }
:root[data-theme="dark"] .article-body pre { background: #0D0B08; border: 1px solid var(--border-soft); }
:root[data-theme="dark"] .article-body code { background: var(--bg-soft); color: var(--accent); }

:root[data-theme="dark"] .article-num,
:root[data-theme="dark"] .header-badge {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: rgba(127, 214, 201, 0.35);
}

:root[data-theme="dark"] .info-box {
  background: var(--accent-soft);
  border-color: rgba(127, 214, 201, 0.25);
}
:root[data-theme="dark"] .info-box-title { color: var(--accent); }

:root[data-theme="dark"] .warning-box {
  background: var(--danger-soft);
  border-color: rgba(232, 132, 143, 0.3);
}
:root[data-theme="dark"] .warning-box-title { color: var(--danger); }
:root[data-theme="dark"] .warning-box::before { background: var(--pulse); }

:root[data-theme="dark"] .highlight { background: rgba(127, 214, 201, 0.16); color: var(--accent); }
:root[data-theme="dark"] .highlight-danger { background: var(--danger-soft); color: var(--danger); }
:root[data-theme="dark"] .highlight-success { background: var(--success-soft); color: var(--success); }

:root[data-theme="dark"] .err-box {
  background: var(--danger-soft);
  border-color: rgba(232, 132, 143, 0.35);
  color: var(--danger);
}

:root[data-theme="dark"] .btn.danger { border-color: rgba(255, 138, 132, 0.35); }

:root[data-theme="dark"] .article-list .item .num { background: var(--green); color: var(--on-green); }
:root[data-theme="dark"] .tab-bar { background: var(--bg-card); }

:root[data-theme="dark"] .site-link,
:root[data-theme="dark"] .tag-open { border-color: rgba(127, 214, 201, 0.35); }
:root[data-theme="dark"] .tag-free { border-color: rgba(111, 207, 163, 0.4); }
:root[data-theme="dark"] .tag-community { border-color: rgba(255, 169, 70, 0.45); }