/* IBM Plex Sans Arabic — SIL Open Font License 1.1 — https://github.com/IBM/plex — مستضاف محلياً */
@font-face { font-family: "IBM Plex Sans Arabic"; font-style: normal; font-weight: 400; font-display: swap; src: url(/assets/fonts/plex-arabic-arabic-400.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC, U+102E0-102FB, U+10E60-10E7E, U+10EC2-10EC7, U+10EC9-10EEE, U+10EF0-10EFF, U+1EE00-1EE03, U+1EE05-1EE1F, U+1EE21-1EE22, U+1EE24, U+1EE27, U+1EE29-1EE32, U+1EE34-1EE37, U+1EE39, U+1EE3B, U+1EE42, U+1EE47, U+1EE49, U+1EE4B, U+1EE4D-1EE4F, U+1EE51-1EE52, U+1EE54, U+1EE57, U+1EE59, U+1EE5B, U+1EE5D, U+1EE5F, U+1EE61-1EE62, U+1EE64, U+1EE67-1EE6A, U+1EE6C-1EE72, U+1EE74-1EE77, U+1EE79-1EE7C, U+1EE7E, U+1EE80-1EE89, U+1EE8B-1EE9B, U+1EEA1-1EEA3, U+1EEA5-1EEA9, U+1EEAB-1EEBB, U+1EEF0-1EEF1; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-style: normal; font-weight: 400; font-display: swap; src: url(/assets/fonts/plex-arabic-latin-400.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-style: normal; font-weight: 500; font-display: swap; src: url(/assets/fonts/plex-arabic-arabic-500.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC, U+102E0-102FB, U+10E60-10E7E, U+10EC2-10EC7, U+10EC9-10EEE, U+10EF0-10EFF, U+1EE00-1EE03, U+1EE05-1EE1F, U+1EE21-1EE22, U+1EE24, U+1EE27, U+1EE29-1EE32, U+1EE34-1EE37, U+1EE39, U+1EE3B, U+1EE42, U+1EE47, U+1EE49, U+1EE4B, U+1EE4D-1EE4F, U+1EE51-1EE52, U+1EE54, U+1EE57, U+1EE59, U+1EE5B, U+1EE5D, U+1EE5F, U+1EE61-1EE62, U+1EE64, U+1EE67-1EE6A, U+1EE6C-1EE72, U+1EE74-1EE77, U+1EE79-1EE7C, U+1EE7E, U+1EE80-1EE89, U+1EE8B-1EE9B, U+1EEA1-1EEA3, U+1EEA5-1EEA9, U+1EEAB-1EEBB, U+1EEF0-1EEF1; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-style: normal; font-weight: 500; font-display: swap; src: url(/assets/fonts/plex-arabic-latin-500.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-style: normal; font-weight: 700; font-display: swap; src: url(/assets/fonts/plex-arabic-arabic-700.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC, U+102E0-102FB, U+10E60-10E7E, U+10EC2-10EC7, U+10EC9-10EEE, U+10EF0-10EFF, U+1EE00-1EE03, U+1EE05-1EE1F, U+1EE21-1EE22, U+1EE24, U+1EE27, U+1EE29-1EE32, U+1EE34-1EE37, U+1EE39, U+1EE3B, U+1EE42, U+1EE47, U+1EE49, U+1EE4B, U+1EE4D-1EE4F, U+1EE51-1EE52, U+1EE54, U+1EE57, U+1EE59, U+1EE5B, U+1EE5D, U+1EE5F, U+1EE61-1EE62, U+1EE64, U+1EE67-1EE6A, U+1EE6C-1EE72, U+1EE74-1EE77, U+1EE79-1EE7C, U+1EE7E, U+1EE80-1EE89, U+1EE8B-1EE9B, U+1EEA1-1EEA3, U+1EEA5-1EEA9, U+1EEAB-1EEBB, U+1EEF0-1EEF1; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-style: normal; font-weight: 700; font-display: swap; src: url(/assets/fonts/plex-arabic-latin-700.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

/* حاسبات — التصميم العام (RTL، أولوية للجوال) */
:root {
  --bg: #f6f8f7;
  --surface: #ffffff;
  --surface-2: #eef4f2;
  --text: #13221f;
  --muted: #5b6b67;
  --border: #dde6e3;
  --brand: #0f766e;
  --brand-dark: #0b5a54;
  --brand-soft: #d9f0ec;
  --brand-fill: #0f766e;
  --brand-fill-dark: #0b5a54;
  --accent: #d99a1e;
  --wa: #15803d;
  --wa-dark: #116a32;
  --danger: #b42318;
  --radius: 16px;
  --shadow: 0 4px 18px rgba(16, 40, 36, 0.08);
  --font: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, system-ui, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1513;
    --surface: #16201d;
    --surface-2: #1c2926;
    --text: #e8f0ee;
    --muted: #9db0ab;
    --border: #2a3a36;
    --brand: #2bb3a5;
    --brand-dark: #1f9488;
    --brand-soft: #173a35;
    --shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
    --danger: #f97066;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1513;
  --surface: #16201d;
  --surface-2: #1c2926;
  --text: #e8f0ee;
  --muted: #9db0ab;
  --border: #2a3a36;
  --brand: #2bb3a5;
  --brand-dark: #1f9488;
  --brand-soft: #173a35;
  --shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
  --danger: #f97066;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  font-size: 17px;
}

a { color: var(--brand); }

img { max-width: 100%; height: auto; }

.wrap { max-width: 760px; margin: 0 auto; padding: 0 16px; }

/* الهيدر */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 58px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 22px;
  color: var(--text);
  text-decoration: none;
}
.logo-mark {
  width: 34px; height: 34px;
  border-radius: 10px;
  background: var(--brand-fill);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 18px;
}
.nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 15px;
  margin-inline-start: 14px;
}
.nav a:hover { color: var(--brand); }

/* مسار التنقل */
.crumbs { font-size: 14px; color: var(--muted); margin: 14px 0 0; }
.crumbs a { color: var(--muted); text-decoration: none; }

h1 { font-size: 28px; line-height: 1.35; margin: 12px 0 6px; }
h2 { font-size: 21px; margin: 28px 0 8px; }
h3 { font-size: 18px; margin: 18px 0 6px; }
.lead { color: var(--muted); margin: 0 0 16px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}

/* حقل الإدخال */
.field label { display: block; font-weight: 600; margin-bottom: 6px; }
.input {
  width: 100%;
  font: inherit;
  font-size: 20px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 2px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  outline: none;
  transition: border-color .15s;
}
.input:focus { border-color: var(--brand); background: var(--surface); }

/* أزرار */
.btn {
  font: inherit;
  font-weight: 600;
  border: 0;
  border-radius: 12px;
  padding: 10px 16px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--brand-fill); color: #fff; }
.btn-primary:hover { background: var(--brand-fill-dark); }
.btn-ghost { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn-wa {
  background: var(--wa);
  color: #fff;
  font-size: 19px;
  padding: 16px 20px;
  width: 100%;
  border-radius: 14px;
}
.btn-wa:hover { background: var(--wa-dark); }
.btn-wa svg { width: 26px; height: 26px; }

/* فلاتر */
.tabs { display: flex; gap: 8px; margin: 16px 0 4px; flex-wrap: wrap; }
.tab {
  font: inherit;
  font-size: 15px;
  padding: 6px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
}
.tab[aria-pressed="true"] { background: var(--brand-fill); border-color: var(--brand-fill); color: #fff; }

/* نتائج الزخرفة */
.results { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 10px; }
.result {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.result-text {
  flex: 1;
  min-width: 0;
  font-size: 22px;
  overflow-wrap: anywhere;
  line-height: 1.6;
  cursor: pointer;
}
.result-actions { display: flex; gap: 6px; flex-shrink: 0; }
.icon-btn {
  width: 44px; height: 44px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  display: grid;
  place-items: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.icon-btn svg { width: 21px; height: 21px; }
.icon-btn.share { background: var(--brand-soft); color: var(--brand); border-color: transparent; }
.icon-btn:active { transform: scale(.94); }
.empty { color: var(--muted); text-align: center; padding: 22px 0; }

/* نافذة البطاقة */
dialog.sheet {
  border: 0;
  padding: 0;
  width: min(480px, calc(100% - 24px));
  border-radius: 20px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
}
dialog.sheet::backdrop { background: rgba(5, 15, 13, .6); }
.sheet-body { padding: 16px; display: grid; gap: 10px; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; }
.sheet-head h2, .sheet-title { margin: 0; font-size: 19px; font-weight: 700; }
.card-preview { width: 100%; border-radius: 14px; display: block; aspect-ratio: 1 / 1; background: var(--surface-2); }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* تنبيه صغير */
.toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #13221f;
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 15px;
  opacity: 0;
  pointer-events: none;
  transition: .2s;
  z-index: 100;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* المحتوى والشرح */
.prose p, .prose li { color: var(--text); }
.prose ul, .prose ol { padding-inline-start: 22px; }
.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  font-size: 14px;
  color: var(--muted);
  border-top: 1px dashed var(--border);
  padding-top: 12px;
  margin-top: 24px;
}
details.faq {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 8px;
}
details.faq summary { font-weight: 600; cursor: pointer; }
details.faq p { margin: 8px 0 0; color: var(--muted); }

/* مساحات الإعلانات (محجوزة لمنع قفز الصفحة لاحقاً) */
.ad-slot { margin: 20px 0; min-height: 0; }
.ad-slot:empty { display: none; }

/* قائمة الأدوات بالرئيسية */
.tools { display: grid; gap: 12px; grid-template-columns: 1fr; margin-top: 16px; }
@media (min-width: 560px) { .tools { grid-template-columns: 1fr 1fr; } }
.tool {
  display: flex;
  gap: 12px;
  align-items: center;
  text-decoration: none;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
}
.tool:hover { border-color: var(--brand); }
.tool-ico {
  width: 48px; height: 48px;
  flex-shrink: 0;
  border-radius: 12px;
  background: var(--brand-soft);
  display: grid;
  place-items: center;
  font-size: 24px;
}
.tool b { display: block; font-size: 17px; }
.tool small { color: var(--muted); font-size: 14px; }
.tool.soon { opacity: .55; pointer-events: none; box-shadow: none; }
.badge {
  font-size: 12px;
  background: var(--surface-2);
  color: var(--muted);
  border-radius: 999px;
  padding: 1px 8px;
  margin-inline-start: 6px;
  font-weight: 400;
}

/* الفوتر */
.site-footer {
  margin-top: 48px;
  padding: 24px 0 32px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  font-size: 14px;
  color: var(--muted);
}
.site-footer nav { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-bottom: 8px; }
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--brand); }

@media (max-width: 420px) {
  h1 { font-size: 24px; }
  .nav a { margin-inline-start: 10px; font-size: 14px; }
  .result-text { font-size: 20px; }
}

/* اسماء مزخرفة جاهزة */
.examples { list-style: none; padding: 0; margin: 12px 0; display: grid; gap: 8px; }
.examples li {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  display: grid;
  gap: 6px;
}
.ex-name { font-weight: 600; text-decoration: none; font-size: 15px; }
.ex-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ex-chip {
  font: inherit;
  font-size: 18px;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px 12px;
  cursor: pointer;
  max-width: 100%;
  overflow-wrap: anywhere;
}
.ex-chip:active { transform: scale(.97); }

/* ===== نماذج الحاسبات ===== */
.form { display: grid; gap: 14px; }
.form-row { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 520px) { .form-row.two { grid-template-columns: 1fr 1fr; } .form-row.three { grid-template-columns: 1fr 1fr 1fr; } }
.form label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 15px; }
.form .hint { display: block; color: var(--muted); font-size: 13px; font-weight: 400; margin-top: 4px; }
.form .input { font-size: 18px; padding: 12px 14px; min-width: 0; }
select.input { appearance: none; -webkit-appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: 18px 55%, 12px 55%; background-size: 6px 6px; background-repeat: no-repeat; padding-left: 34px; }
input[type="date"].input { min-height: 52px; }
.seg { display: flex; gap: 6px; background: var(--surface-2); border-radius: 12px; padding: 4px; }
.seg button { flex: 1; font: inherit; font-size: 15px; border: 0; background: transparent; color: var(--muted); padding: 8px; border-radius: 9px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); font-weight: 700; box-shadow: var(--shadow); }
.btn-block { width: 100%; font-size: 18px; padding: 14px; }
.error { color: var(--danger); font-size: 15px; margin: 0; }

/* ===== لوحة النتيجة ===== */
.result-panel { margin-top: 16px; display: grid; gap: 12px; }
.result-panel[hidden] { display: none; }
.big {
  background: var(--brand-fill);
  color: #fff;
  border-radius: var(--radius);
  padding: 18px;
  text-align: center;
}
.big small { display: block; opacity: .93; font-size: 15px; }
.big strong { display: block; font-size: 34px; line-height: 1.3; margin: 4px 0; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.big span { font-size: 15px; opacity: .9; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; min-width: 0; }
.stat small { display: block; color: var(--muted); font-size: 13px; }
.stat b { font-size: 18px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stat.wide { grid-column: 1 / -1; }
.note { background: var(--surface-2); border-radius: 12px; padding: 10px 14px; font-size: 14px; color: var(--muted); margin: 0; }
.words { font-size: 21px; line-height: 1.9; font-weight: 600; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin: 0; }
.table-wrap { overflow-x: auto; }
table.simple { width: 100%; border-collapse: collapse; font-size: 15px; background: var(--surface); border-radius: 12px; overflow: hidden; }
table.simple th, table.simple td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: right; }
table.simple th { background: var(--surface-2); font-weight: 600; }
.related { display: grid; gap: 8px; grid-template-columns: 1fr 1fr; margin-top: 10px; }
.related a { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; text-decoration: none; color: var(--text); font-weight: 600; font-size: 15px; }

/* صف مادة بحاسبة المعدل */
.courses { display: grid; gap: 8px; }
.course { display: grid; grid-template-columns: 24px 1fr 72px 44px; gap: 6px; align-items: center; }
.course .input { padding: 10px; font-size: 16px; }
.course-n { color: var(--muted); font-size: 14px; text-align: center; }
.course-head { display: grid; grid-template-columns: 24px 1fr 72px 44px; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 600; }

/* خانات اختيار (حاسبة المواريث) */
.checks { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.check { display: flex; align-items: center; gap: 8px; background: var(--surface-2); border-radius: 10px; padding: 10px 12px; font-weight: 600; font-size: 15px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--brand); }

/* زر الوضع الليلي */
.theme-btn { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 6px; margin-inline-start: 10px; border-radius: 10px; display: inline-grid; place-items: center; vertical-align: middle; }
.theme-btn:hover { color: var(--brand); background: var(--surface-2); }
.theme-btn svg { width: 20px; height: 20px; }

/* ===== الصفحة الرئيسية ===== */
.hero { padding-top: 6px; }
.search { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 2px solid var(--border); border-radius: 14px; padding: 0 14px; margin-top: 12px; box-shadow: var(--shadow); }
.search:focus-within { border-color: var(--brand); }
.search svg { width: 22px; height: 22px; color: var(--muted); flex-shrink: 0; }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); font: inherit; font-size: 18px; padding: 14px 0; }
.cat { margin-top: 22px; }
.cat h2 { margin: 0 0 10px; font-size: 19px; display: flex; align-items: center; gap: 8px; }
.cat .count { font-size: 13px; font-weight: 600; color: var(--muted); background: var(--surface-2); border-radius: 999px; padding: 1px 9px; }
.cat .tools { margin-top: 0; }
.tool { padding: 0; gap: 0; }
.tool-link { flex: 1; min-width: 0; display: flex; gap: 12px; align-items: center; padding: 14px; color: var(--text); text-decoration: none; }
.fav-btn { flex-shrink: 0; width: 44px; height: 44px; margin-inline-end: 8px; border: 0; background: transparent; color: var(--muted); font-size: 22px; cursor: pointer; border-radius: 10px; }
.fav-btn[aria-pressed="true"] { color: var(--accent); }
.fav-btn:hover { background: var(--surface-2); }
.pops { display: flex; flex-wrap: wrap; gap: 8px; }
.pop { background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 8px 14px; text-decoration: none; color: var(--text); font-weight: 600; font-size: 15px; }
.pop:hover { border-color: var(--brand); color: var(--brand); }

/* ===== الأدوات السريعة ===== */
.textarea { resize: vertical; min-height: 90px; line-height: 1.7; font-size: 17px; }
.label-strong { display: block; font-weight: 600; margin-bottom: 6px; }
.pct-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; background: var(--surface-2); border-radius: 12px; padding: 10px 12px; }
.pct-row .input { width: 110px; flex: 0 1 110px; padding: 10px 12px; font-size: 17px; background: var(--surface); }
.pct-res { font-size: 22px; color: var(--brand); min-width: 60px; }
.countdowns { display: grid; gap: 8px; margin-bottom: 8px; }
.countdown { display: flex; align-items: center; gap: 12px; background: var(--surface-2); border-radius: 14px; padding: 12px; }
.cd-ico { font-size: 28px; }
.cd-txt { flex: 1; min-width: 0; }
.cd-txt b { display: block; font-size: 17px; }
.cd-txt small { color: var(--muted); font-size: 13px; }
.cd-days { text-align: center; min-width: 64px; }
.cd-days strong { display: block; font-size: 26px; color: var(--brand); line-height: 1.1; font-variant-numeric: tabular-nums; }
.cd-days small { color: var(--muted); font-size: 12px; }
.qr-canvas { width: 100%; max-width: 300px; height: auto; aspect-ratio: 1; margin: 0 auto; display: block; border-radius: 12px; border: 1px solid var(--border); background: #fff; }

/* ===== أدوات الصور وPDF ===== */
.drop { display: grid; place-items: center; gap: 4px; text-align: center; padding: 28px 16px; border: 2px dashed var(--border); border-radius: var(--radius); background: var(--surface-2); cursor: pointer; transition: .15s; }
.drop:hover, .drop.over { border-color: var(--brand); background: var(--brand-soft); }
.drop-ico { font-size: 36px; }
.drop b { font-size: 17px; }
.drop small { color: var(--muted); }
.file-list { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 8px; }
.file-item { display: flex; align-items: center; gap: 10px; background: var(--surface-2); border-radius: 12px; padding: 8px 10px; }
.fi-n { color: var(--muted); font-size: 13px; width: 18px; text-align: center; }
.fi-thumb { width: 48px; height: 48px; flex-shrink: 0; border-radius: 8px; overflow: hidden; display: grid; place-items: center; font-size: 26px; background: var(--surface); }
.fi-thumb img { width: 100%; height: 100%; object-fit: cover; }
.fi-name { flex: 1; min-width: 0; font-size: 14px; overflow-wrap: anywhere; }
.fi-btns { display: flex; gap: 4px; flex-shrink: 0; }
.fi-btns .icon-btn { width: 36px; height: 36px; }
.fi-btns .btn { padding: 8px 12px; font-size: 14px; }
.range { width: 100%; accent-color: var(--brand); height: 32px; }
.preview-img { max-width: 100%; border-radius: 12px; border: 1px solid var(--border); }
.file-item[draggable="true"] { cursor: grab; }
li.dragging { opacity: .45; outline: 2px dashed var(--brand); }
.cancel-btn { margin-top: 8px; }
.next-box { margin-top: 14px; padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--brand-soft); }
.next-title { display: block; font-weight: 600; font-size: 15px; margin-bottom: 8px; }
.next-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.next-btns .btn { padding: 8px 14px; font-size: 15px; }
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.compare figure { margin: 0; }
.compare img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); }
.compare figcaption { text-align: center; font-size: 14px; color: var(--muted); margin-top: 4px; }
button:disabled { opacity: .5; cursor: not-allowed; }

/* ===== مؤشر كتلة الجسم ===== */
.bmi-scale { position: relative; display: grid; grid-template-columns: 3.5fr 6.5fr 5fr 10fr; height: 12px; border-radius: 99px; overflow: hidden; }
.bmi-scale span:nth-child(1) { background: #60a5fa; } .bmi-scale span:nth-child(2) { background: #22c55e; }
.bmi-scale span:nth-child(3) { background: #f59e0b; } .bmi-scale span:nth-child(4) { background: #ef4444; }
.bmi-scale i { position: absolute; top: -4px; width: 4px; height: 20px; background: var(--text); border-radius: 2px; transform: translateX(50%); }
.bmi-legend { display: grid; grid-template-columns: 3.5fr 6.5fr 5fr 10fr; font-size: 12px; color: var(--muted); text-align: center; }

/* ===== أدوات المكتب: المستند (ورقة بيضاء بكل الأوضاع) ===== */
.inv-items { display: grid; gap: 6px; }
.inv-row { display: grid; grid-template-columns: 1fr 64px 90px 40px; gap: 6px; align-items: center; }
.inv-row .input { padding: 10px; font-size: 15px; }
.doc { margin-top: 16px; background: #fff; color: #111; border: 1px solid var(--border); border-radius: 12px; padding: 22px; font-size: 14px; line-height: 1.8; box-shadow: var(--shadow); overflow-wrap: anywhere; }
.doc h2 { margin: 0 0 4px; font-size: 22px; color: #0f766e; }
.doc h3 { font-size: 15px; color: #0f766e; border-bottom: 1px solid #ddd; padding-bottom: 4px; margin: 16px 0 8px; }
.doc p { margin: 0 0 10px; }
.doc-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; border-bottom: 2px solid #0f766e; padding-bottom: 12px; margin-bottom: 14px; }
.doc-from { text-align: left; }
.doc-muted { color: #666; font-size: 13px; }
.doc-box { background: #f3f6f5; border-radius: 8px; padding: 8px 12px; margin-bottom: 12px; }
.doc-table, .doc-totals { width: 100%; border-collapse: collapse; }
.doc-table th, .doc-table td { border: 1px solid #ddd; padding: 6px 8px; text-align: right; }
.doc-table th { background: #f3f6f5; }
.doc-totals { width: auto; min-width: 60%; margin: 12px 0 0 auto; margin-inline-start: auto; }
.doc-totals td { padding: 5px 10px; border-bottom: 1px solid #eee; }
.doc-totals td:last-child { text-align: left; font-variant-numeric: tabular-nums; }
.doc-grand td { font-weight: 700; font-size: 16px; border-top: 2px solid #111; }
.doc-words { margin-top: 10px; font-weight: 600; background: #f3f6f5; border-radius: 8px; padding: 8px 12px; }
.doc-notes { color: #444; }
.doc-amount { font-size: 22px; font-weight: 700; border: 2px solid #0f766e; border-radius: 10px; padding: 6px 16px; align-self: center; }
.doc-lines p { border-bottom: 1px dotted #aaa; padding: 6px 0; margin: 0; }
.doc-sign { display: flex; justify-content: space-between; gap: 20px; margin-top: 30px; padding-top: 10px; }
.cv .cv-head { text-align: center; border-bottom: 2px solid #0f766e; padding-bottom: 10px; }
.cv .cv-head p { margin: 2px 0; }
.cv-item { margin-bottom: 8px; }
.cv-item ul { margin: 4px 0 0; padding-inline-start: 20px; }
.cv-tag { display: inline-block; background: #f3f6f5; border-radius: 6px; padding: 2px 10px; margin: 0 0 6px 6px; }

/* الطباعة / الحفظ كـ PDF: بنطبع المستند بس */
@media print {
  @page { size: A4; margin: 14mm; }
  body { background: #fff !important; }
  body * { visibility: hidden; }
  .doc, .doc * { visibility: visible; }
  .doc { position: absolute; inset: 0 auto auto 0; width: 100%; margin: 0; border: 0; box-shadow: none; padding: 0; font-size: 12pt; }
  .no-print, .site-header, .site-footer, .ad-slot { display: none !important; }
}
.doc-table td:nth-child(n+3), .doc-table th:nth-child(n+3) { white-space: nowrap; }
@media (max-width: 480px) {
  .doc { padding: 14px; font-size: 13px; }
  .doc-table th, .doc-table td { padding: 4px 5px; }
  .doc-from { text-align: right; }
}

/* ===== الدفعة الخامسة ===== */
.units-seg { flex-wrap: wrap; }
.units-seg button { flex: 1 1 18%; min-width: 64px; }
.units-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; }
.units-row .input { flex: 1 1 120px; min-width: 0; }
.pad-wrap { position: relative; }
.pad { width: 100%; height: 220px; display: block; background: #fff; border: 2px dashed var(--border); border-radius: var(--radius); touch-action: none; cursor: crosshair; }
.pad-hint { position: absolute; inset: 0; display: grid; place-items: center; color: #999; pointer-events: none; font-size: 18px; }
.spin { text-align: center; font-size: 28px; font-weight: 700; color: var(--brand); padding: 16px; }
.winners { display: grid; gap: 8px; }
.winner { background: var(--brand-fill); color: #fff; border-radius: 12px; padding: 14px; font-size: 22px; font-weight: 700; text-align: center; }

/* أي عنصر مخفي يضل مخفي مهما كان تنسيقه */
[hidden] { display: none !important; }

/* ===== النسخة الإنجليزية (من اليسار لليمين) ===== */
[dir="ltr"] table.simple th, [dir="ltr"] table.simple td { text-align: left; }
[dir="ltr"] select.input { background-position: calc(100% - 18px) 55%, calc(100% - 12px) 55%; padding-left: 14px; padding-right: 34px; }
[dir="ltr"] body { font-family: system-ui, -apple-system, "Segoe UI", Roboto, var(--font); }

/* إطار واضح للعنصر اللي عليه التركيز بالكيبورد */
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.input:focus-visible { outline: none; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }

/* شريط "في نسخة جديدة" */
.update-bar { position: fixed; inset: auto 12px calc(12px + env(safe-area-inset-bottom, 0px)) 12px; z-index: 120; display: flex; align-items: center; justify-content: space-between; gap: 12px; background: #13221f; color: #fff; border-radius: 14px; padding: 10px 14px; box-shadow: 0 10px 30px rgba(0,0,0,.3); max-width: 560px; margin: 0 auto; }
.update-bar button { font: inherit; font-weight: 700; background: var(--accent); color: #13221f; border: 0; border-radius: 10px; padding: 8px 16px; cursor: pointer; }

/* =====================================================================
   نظام التصميم v2 (نوفمبر 2026): هيرو، أقسام ملونة، شبكات أوسع على الكمبيوتر
   ===================================================================== */
:root { --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-6: 24px; --space-8: 32px; --radius-sm: 10px; --radius-lg: 22px; }
.wrap.wide { max-width: 1080px; }

/* الشعار */
.logo-mark { position: relative; background: linear-gradient(135deg, #14917f, #0b5a54); box-shadow: 0 2px 8px rgba(15,118,110,.35); }
.logo-mark::after { content: ""; position: absolute; top: 4px; left: 4px; width: 7px; height: 7px; border-radius: 50%; background: #f2c14e; }

/* الهيرو */
.hero-band { background: radial-gradient(1200px 400px at 80% -10%, var(--brand-soft), transparent 70%), linear-gradient(180deg, var(--surface) 0%, var(--bg) 100%); border-bottom: 1px solid var(--border); }
.hero.wide { text-align: center; padding-block: 34px 26px; max-width: 760px; }
.hero h1 { font-size: clamp(28px, 6vw, 44px); line-height: 1.25; margin: 0 0 8px; text-wrap: balance; }
.hero .lead { font-size: 17px; max-width: 56ch; margin: 0 auto 18px; text-wrap: balance; }
.search-xl { padding: 4px 18px; border-radius: 18px; border-width: 2px; }
.search-xl input { font-size: 19px; padding: 14px 0; }
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 14px; }
.chip { font-size: 14px; font-weight: 600; text-decoration: none; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 6px 14px; }
.chip:hover { border-color: var(--brand); color: var(--brand); }
.trust { list-style: none; padding: 0; margin: 18px 0 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px; font-size: 14px; color: var(--muted); }

/* شبكة الأقسام */
.cat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 720px) { .cat-grid { grid-template-columns: repeat(4, 1fr); } }
.cat-tile { display: grid; gap: 2px; justify-items: start; text-decoration: none; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; transition: border-color .15s, transform .15s; }
.cat-tile:hover { border-color: var(--c); transform: translateY(-2px); }
.cat-ico { width: 42px; height: 42px; display: grid; place-items: center; font-size: 22px; border-radius: 12px; background: color-mix(in srgb, var(--c) 14%, transparent); margin-bottom: 6px; }
.cat-tile b { font-size: 15px; line-height: 1.4; }
.cat-tile small { color: var(--muted); font-size: 13px; }

/* الأكثر استخداماً */
.mini-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
@media (min-width: 720px) { .mini-grid { grid-template-columns: repeat(4, 1fr); } }
.mini { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 10px 12px; font-weight: 600; font-size: 14px; line-height: 1.4; min-width: 0; }
.mini:hover { border-color: var(--c); }
.mini-ico { flex-shrink: 0; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: color-mix(in srgb, var(--c) 14%, transparent); font-size: 18px; }

/* أقسام الأدوات بلونها */
.cat h2 .cat-dot { width: 6px; height: 22px; border-radius: 3px; background: var(--c, var(--brand)); display: inline-block; }
.cat { scroll-margin-top: 76px; }
.tool .tool-ico { background: color-mix(in srgb, var(--c, var(--brand)) 13%, transparent); }
.tool:hover { border-color: var(--c, var(--brand)); }
@media (min-width: 900px) { .wrap.wide .tools { grid-template-columns: repeat(3, 1fr); } }
.tool small { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.site-header .wrap, .site-footer .wrap { max-width: 1080px; }
.tool-h1 { display: flex; align-items: center; gap: 12px; }
.h1-ico { flex-shrink: 0; width: 48px; height: 48px; display: grid; place-items: center; font-size: 26px; border-radius: 14px; background: color-mix(in srgb, var(--c) 14%, transparent); }
.hub-links { margin: 12px 0 0; font-size: 15px; color: var(--muted); }
.hub-links a { font-weight: 600; text-decoration: none; }
.hub-tools { margin-top: 8px; }
/* ترتيب صفحات PDF */
.pg-grid { list-style: none; padding: 0; margin: 12px 0 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 560px) { .pg-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 820px) { .pg-grid { grid-template-columns: repeat(4, 1fr); } }
.pg { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 8px; display: grid; gap: 6px; justify-items: center; cursor: grab; }
.pg-thumb { width: 100%; aspect-ratio: 1; display: grid; place-items: center; background: var(--surface); border-radius: 8px; overflow: hidden; }
.pg-thumb img { max-width: 92%; max-height: 92%; box-shadow: 0 1px 4px rgba(0,0,0,.15); transition: transform .2s; }
.pg-n { font-size: 13px; color: var(--muted); }
.pg-btns { display: flex; gap: 4px; }
.pg-btns .icon-btn { width: 34px; height: 34px; }
/* العلامة المائية والتمويه */
.wm-preview, .draw-canvas { display: block; width: 100%; height: auto; margin: 10px 0; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); }
.draw-canvas { touch-action: none; cursor: crosshair; }
.pop[aria-pressed="true"] { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
/* كلمات السر */
.pw-out { display: grid; gap: 8px; }
.pw-input { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: 20px; letter-spacing: .5px; text-align: center; }
.pw-meter { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin-top: 12px; }
.pw-meter span { display: block; height: 100%; width: var(--pct, 0%); background: var(--danger); transition: width .2s, background .2s; }
.pw-meter[data-level="fair"] span { background: var(--accent); }
.pw-meter[data-level="strong"] span, .pw-meter[data-level="vstrong"] span { background: var(--wa); }
input[type="color"].input { height: 48px; padding: 4px 6px; cursor: pointer; }
.draw-canvas { user-select: none; -webkit-user-select: none; }
/* التضمين */
body.embed { background: var(--surface); }
.embed-wrap { max-width: 640px; margin: 0 auto; padding: 12px; }
.embed-h1 { font-size: 20px; margin: 4px 0 10px; }
body.embed .card { box-shadow: none; border: 1px solid var(--border); }
.embed-credit { text-align: center; font-size: 13px; color: var(--muted); margin: 10px 0 0; }
.embed-preview { width: 100%; height: 600px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.textarea.code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }

/* صفحات أسئلة التاريخ (date-q.js) */
.form-row.hdate { grid-template-columns: 1fr 2fr 1.3fr; }
.progress { height: 10px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin: 12px 0; }
.progress span { display: block; height: 100%; width: 0; background: var(--brand); border-radius: 99px; }
