/* دليل 2T Club Manager — تصميم المجلة (RTL) + الطباعة إلى PDF */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700;800&display=swap');

:root {
  --brand: #0d9488;
  --brand-dark: #0f5f58;
  --brand-soft: #e6f6f4;
  --accent: #f59e0b;
  --mark: #e11d48;
  --ink: #0f172a;
  --muted: #5b6577;
  --line: #e3e8ef;
  --paper: #ffffff;
  --bg: #f4f6f8;
  --tip: #ecfdf5;
  --tip-line: #34d399;
  --warn: #fff7ed;
  --warn-line: #fb923c;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(15, 23, 42, .08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: 'Cairo', 'Segoe UI', Tahoma, sans-serif; font-size: 16.5px; line-height: 1.9;
}
a { color: var(--brand-dark); text-decoration: none; border-bottom: 1px dashed rgba(13, 148, 136, .45); }
a:hover { color: var(--brand); border-bottom-style: solid; }
a.soon { color: var(--muted); border-bottom-color: #cbd5e1; }
img { max-width: 100%; }
kbd {
  display: inline-block; min-width: 1.8em; padding: 0 .45em; border: 1px solid #cbd5e1; border-bottom-width: 3px;
  border-radius: 6px; background: #fff; font: 600 .82em/1.7 Consolas, monospace; text-align: center; direction: ltr;
}
.ltr { direction: ltr; unicode-bidi: embed; }

/* ===== الشريط العلوي ===== */
.topnav {
  position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 14px;
  padding: 10px 22px; background: rgba(255, 255, 255, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.topnav .logo { display: flex; align-items: center; gap: 10px; font-weight: 800; color: var(--ink); border: 0; white-space: nowrap; }
.topnav .logo b { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--brand); color: #fff; font-size: 15px; }
.topnav .spacer { flex: 1; }
.search { position: relative; width: min(360px, 45vw); }
.search input {
  width: 100%; padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px; font: inherit; font-size: 14px; background: #f8fafc;
}
.search input:focus { outline: 2px solid var(--brand); background: #fff; }
.search .results {
  position: absolute; inset-inline: 0; top: calc(100% + 6px); display: none; max-height: 60vh; overflow: auto;
  background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow);
}
.search .results.show { display: block; }
.search .results a { display: block; padding: 9px 14px; border: 0; border-bottom: 1px solid var(--line); color: var(--ink); font-size: 14px; line-height: 1.6; }
.search .results a:hover, .search .results a.active { background: var(--brand-soft); }
.search .results small { display: block; color: var(--muted); font-size: 12px; }
.search .results .none { padding: 12px 14px; color: var(--muted); font-size: 14px; }
.btn {
  white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border: 1px solid var(--line); border-radius: 999px;
  background: #fff; color: var(--ink); font: inherit; font-size: 14px; cursor: pointer;
}
.btn:hover { border-color: var(--brand); color: var(--brand-dark); }

/* ===== الغلاف ===== */
.cover {
  position: relative; overflow: hidden; padding: 70px 24px 90px; color: #fff; text-align: center;
  background: radial-gradient(circle at 15% 20%, rgba(255, 255, 255, .14), transparent 40%),
              radial-gradient(circle at 85% 80%, rgba(245, 158, 11, .25), transparent 45%),
              linear-gradient(135deg, #0f5f58, #0d9488 55%, #14b8a6);
}
.cover .issue { display: inline-block; padding: 4px 16px; border: 1px solid rgba(255, 255, 255, .5); border-radius: 999px; font-size: 14px; letter-spacing: .5px; }
.cover h1 { margin: 18px 0 6px; font-size: clamp(34px, 6vw, 62px); line-height: 1.25; font-weight: 800; }
.cover p { max-width: 720px; margin: 0 auto; font-size: 19px; opacity: .92; }
.cover .shot {
  display: block; width: min(1000px, 94%); margin: 44px auto 0; border-radius: 16px; border: 6px solid rgba(255, 255, 255, .22);
  box-shadow: 0 30px 70px rgba(0, 0, 0, .35);
}
.cover .meta { margin-top: 26px; font-size: 14px; opacity: .85; }

/* ===== الفهرس ===== */
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 22px; }
.toc-title { margin: 56px 0 8px; font-size: 30px; }
.toc-sub { margin: 0 0 26px; color: var(--muted); }
.toc { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px; padding-bottom: 60px; }
.toc a {
  position: relative; display: flex; gap: 16px; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--paper); color: var(--ink); transition: transform .15s, box-shadow .15s;
}
.toc a:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--brand); }
.toc .num {
  flex: none; display: grid; place-items: center; width: 52px; height: 52px; border-radius: 14px;
  background: var(--brand-soft); color: var(--brand-dark); font-size: 22px; font-weight: 800;
}
.toc h3 { margin: 0; font-size: 18px; line-height: 1.5; }
.toc p { margin: 4px 0 0; color: var(--muted); font-size: 14px; line-height: 1.7; }
.toc a.soon { opacity: .55; }
.toc a.soon::after {
  content: 'قريباً'; position: absolute; top: 12px; inset-inline-end: 12px; padding: 0 10px; border-radius: 999px;
  background: #f1f5f9; color: var(--muted); font-size: 12px;
}

/* ===== صفحة الباب ===== */
.chapter-head {
  padding: 46px 24px 40px; color: #fff; background: linear-gradient(135deg, #0f5f58, #0d9488);
}
.chapter-head .wrap { display: flex; align-items: center; gap: 26px; }
.chapter-head .big { font-size: 88px; font-weight: 800; line-height: 1; opacity: .35; }
.chapter-head h1 { margin: 0; font-size: clamp(28px, 4.5vw, 44px); line-height: 1.3; }
.chapter-head p { margin: 6px 0 0; max-width: 760px; opacity: .9; font-size: 17.5px; }
.chapter-head .crumbs { font-size: 14px; opacity: .85; }
.chapter-head .crumbs a { color: #fff; border-bottom-color: rgba(255, 255, 255, .5); }

.layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 34px; max-width: 1240px; margin: 0 auto; padding: 30px 22px 60px; }
.side { position: sticky; top: 76px; align-self: start; max-height: calc(100vh - 96px); overflow: auto; font-size: 14.5px; }
.side h4 { margin: 0 0 8px; color: var(--muted); font-size: 13px; }
.side a { display: block; padding: 5px 12px; border: 0; border-inline-start: 3px solid transparent; color: var(--ink); line-height: 1.6; }
.side a.sub { padding-inline-start: 26px; color: var(--muted); font-size: 13.5px; }
.side a.on { border-inline-start-color: var(--brand); background: var(--brand-soft); color: var(--brand-dark); font-weight: 700; }

.content { min-width: 0; }
.content section { margin-bottom: 30px; padding: 28px 32px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
.content h2 { display: flex; align-items: center; gap: 12px; margin: 0 0 14px; font-size: 26px; line-height: 1.4; }
.content h2 .n { display: grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 12px; background: var(--brand); color: #fff; font-size: 17px; }
.content h3 { margin: 26px 0 8px; font-size: 20px; color: var(--brand-dark); }
.content p { margin: 0 0 12px; }
.content ul, .content ol { margin: 0 0 14px; padding-inline-start: 24px; }
.content li { margin-bottom: 4px; }
.lead { font-size: 18px; color: #334155; }
.path {
  display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 14px; padding: 4px 14px;
  border-radius: 999px; background: #f1f5f9; color: #334155; font-size: 14px;
}
.path::before { content: '📍'; }

/* الصور */
figure.shot { margin: 18px 0 22px; }
figure.shot img {
  display: block; width: 100%; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 6px 20px rgba(15, 23, 42, .08); cursor: zoom-in;
}
figure.shot.narrow img { max-width: 420px; margin-inline: auto; }
figure.shot.mid img { max-width: 720px; margin-inline: auto; }
figure.shot figcaption { margin-top: 8px; color: var(--muted); font-size: 14px; text-align: center; }

/* شرح الأرقام على الصورة */
ol.legend { list-style: none; padding: 0; counter-reset: none; display: grid; gap: 8px; }
ol.legend li { display: flex; gap: 12px; align-items: flex-start; }
ol.legend li::before {
  content: attr(data-n); flex: none; display: grid; place-items: center; width: 26px; height: 26px; margin-top: 4px;
  border-radius: 50%; background: var(--mark); color: #fff; font: 700 13px/1 sans-serif;
}

/* خطوات */
ol.steps { list-style: none; padding: 0; counter-reset: s; }
ol.steps > li { position: relative; padding: 0 44px 12px 0; counter-increment: s; }
ol.steps > li::before {
  content: counter(s); position: absolute; right: 0; top: 2px; display: grid; place-items: center; width: 30px; height: 30px;
  border-radius: 10px; background: var(--brand-soft); color: var(--brand-dark); font-weight: 800; font-size: 15px;
}

/* صناديق */
.box { margin: 16px 0; padding: 14px 18px; border-radius: 12px; border-inline-start: 5px solid; }
/* عنوان الصندوق = أول <b> مباشر فيه فقط (لا <b> داخل قائمة أو جدول بالصندوق) */
.box > b:first-child { display: block; margin-bottom: 2px; }
.box.tip { background: var(--tip); border-color: var(--tip-line); }
.box.warn { background: var(--warn); border-color: var(--warn-line); }
.box.info { background: #eff6ff; border-color: #60a5fa; }

/* شارات الإصدار بجانب العناوين (D-377): new = جديد في هذا الإصدار، upd = عُدّل فيه، old = أُضيف في إصدار سابق */
.badge { display: inline-block; vertical-align: middle; margin-inline-start: 6px; padding: 1px 9px; border-radius: 999px;
  color: #fff; font-size: 12px; font-weight: 800; line-height: 1.6; white-space: nowrap; }
.badge.new { background: #16a34a; }
.badge.upd { background: #2563eb; }
.badge.old { background: #e2e8f0; color: #475569; font-weight: 700; }
h2 .badge, h3 .badge { font-size: 13px; }
@media print { .badge.new, .badge.upd { border: 1px solid currentColor; background: none; color: #111; } }
/* نقطة في القائمة الجانبية للقسم الجديد/المعدّل */
.side a .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-inline-start: 6px; vertical-align: middle; }
.side a .dot.new { background: #16a34a; } .side a .dot.upd { background: #2563eb; }
/* رقم إصدار الدليل في الشريط العلوي */
.topnav .ver { padding: 3px 11px; border-radius: 999px; background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0;
  font-size: 13px; font-weight: 700; white-space: nowrap; }
.topnav .ver:hover { background: #d1fae5; }
@media (max-width: 700px) { .topnav .ver { display: none; } }
/* مثال عملي خطوة بخطوة */
.box.example { background: #fdf4ff; border-color: #c026d3; }
.box.example table.t { background: #fff; }
.box.example ol { margin-bottom: 4px; }
.calc { font-family: inherit; direction: rtl; }
.calc td:last-child { text-align: left; direction: ltr; font-weight: 700; white-space: nowrap; }
.calc tr.total td { border-top: 2px solid #334155; }

/* جداول */
table.t { width: 100%; margin: 12px 0 18px; border-collapse: collapse; font-size: 15px; }
table.t th, table.t td { padding: 9px 12px; border: 1px solid var(--line); text-align: start; vertical-align: top; }
table.t th { background: #f8fafc; }

/* سؤال وجواب */
.faq details { margin-bottom: 10px; border: 1px solid var(--line); border-radius: 12px; background: #fcfdfd; }
.faq summary { position: relative; padding: 13px 48px 13px 18px; font-weight: 700; cursor: pointer; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::before {
  content: 'س'; position: absolute; right: 12px; top: 11px; display: grid; place-items: center; width: 28px; height: 28px;
  border-radius: 8px; background: var(--accent); color: #fff; font-size: 14px;
}
.faq details[open] summary { border-bottom: 1px dashed var(--line); }
.faq .a { position: relative; padding: 12px 48px 6px 18px; }
.faq .a::before {
  content: 'ج'; position: absolute; right: 12px; top: 13px; display: grid; place-items: center; width: 28px; height: 28px;
  border-radius: 8px; background: var(--brand); color: #fff; font-size: 14px;
}

/* انظر أيضاً */
.see { display: flex; flex-wrap: wrap; gap: 10px; }
.see a {
  padding: 8px 16px; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--ink); font-size: 14.5px;
}
.see a::before { content: '↖ '; color: var(--brand); }
.see a:hover { border-color: var(--brand); }

/* التنقل بين الأبواب */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 10px; }
.pager a { padding: 16px 20px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; color: var(--ink); }
.pager a small { display: block; color: var(--muted); }
.pager a.next { text-align: left; }

/* عرض الصورة مكبرة */
.lightbox { position: fixed; inset: 0; z-index: 100; display: none; place-items: center; padding: 20px; background: rgba(15, 23, 42, .86); cursor: zoom-out; }
.lightbox.show { display: grid; }
.lightbox img { max-height: 94vh; border-radius: 10px; }

.toast {
  position: fixed; bottom: 24px; left: 50%; z-index: 120; transform: translateX(-50%); padding: 10px 20px; border-radius: 999px;
  background: var(--ink); color: #fff; font-size: 14px; opacity: 0; transition: opacity .2s; pointer-events: none;
}
.toast.show { opacity: 1; }

footer.foot { padding: 26px; color: var(--muted); font-size: 13px; text-align: center; border-top: 1px solid var(--line); background: #fff; }

/* ===== الموبايل ===== */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; padding: 18px 12px 40px; }
  .side { display: none; }
  .content section { padding: 20px 16px; }
  .chapter-head .big { display: none; }
  .topnav { padding: 8px 12px; }
  .topnav .logo span { display: none; }
  .topnav .btn { display: none; }
  .search { width: auto; flex: 1; }
  .pager { grid-template-columns: 1fr; }
}

/* ===== الطباعة / PDF ===== */
@page { size: A4; margin: 14mm 12mm; }
@media print {
  body { background: #fff; font-size: 12.5pt; line-height: 1.75; }
  .topnav, .side, .pager, .lightbox, .toast, .no-print { display: none !important; }
  .layout { display: block; padding: 0; }
  .content section { padding: 0 0 8mm; border: 0; border-radius: 0; break-inside: auto; }
  .content h2 { break-after: avoid; }
  figure.shot { break-inside: avoid; }
  figure.shot img { box-shadow: none; }
  .chapter-head, .cover { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .cover { min-height: 260mm; padding-top: 40mm; break-after: page; }
  .chapter-head { break-before: page; }
  .faq details { break-inside: avoid; }
  .faq summary::before, .faq .a::before, ol.legend li::before, .content h2 .n, ol.steps > li::before { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  a { border: 0; color: inherit; }
  .toc a.soon::after { display: none; }
}

/* أبواب المحاسبة (38): بطاقة المفهوم بأربع فقرات، المعادلة، مخطط التدفق، وجداول القيود */
dl.concept { margin: 14px 0 22px; padding: 6px 18px 14px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
dl.concept dt { display: inline-block; margin: 14px 0 6px; padding: 2px 12px; border-radius: 999px; background: #eef2ff; color: #3730a3; font-weight: 800; font-size: 14px; }
dl.concept dd { margin: 0; }
dl.concept dd > table.t:last-child, dl.concept dd > .box:last-child { margin-bottom: 6px; }
.eq { margin: 14px 0 18px; padding: 16px; border-radius: 14px; background: #f8fafc; border: 1px dashed #94a3b8; text-align: center; font-size: 22px; font-weight: 800; }
.eq span { padding: 2px 12px; border-radius: 10px; }
.eq .a { background: #dbeafe; color: #1e40af; } .eq .l { background: #fee2e2; color: #991b1b; } .eq .o { background: #dcfce7; color: #166534; }
.flow { display: flex; flex-wrap: wrap; align-items: stretch; gap: 8px; margin: 14px 0 20px; }
.flow > div { flex: 1 1 150px; padding: 12px 14px; border-radius: 12px; background: #fff; border: 2px solid #c7d2fe; text-align: center; }
.flow > div b { display: block; color: #3730a3; }
.flow > div small { color: var(--muted); font-size: 13px; }
.flow > span { align-self: center; color: #6366f1; font-size: 22px; font-weight: 800; }
table.t.je { max-width: 560px; }
table.t.je td:nth-child(2), table.t.je td:nth-child(3) { width: 110px; text-align: left; direction: ltr; font-weight: 700; white-space: nowrap; }
table.t.je td:nth-child(2) { color: #1d4ed8; } table.t.je td:nth-child(3) { color: #b91c1c; }
table.t.je tr td:first-child { padding-inline-start: 12px; }
table.t.je tr:has(td:nth-child(3):not(:empty)) td:first-child { padding-inline-start: 34px; }
table.t td.dr { color: #1d4ed8; font-weight: 700; } table.t td.cr { color: #b91c1c; font-weight: 700; }
@media (max-width: 700px) { .flow > span { transform: rotate(-90deg); flex-basis: 100%; text-align: center; } .eq { font-size: 17px; } }
