/* كمّلها | مكتبة ملفات الطباعة — الأنماط المشتركة */

@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+0870-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FEFC; }
@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+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@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+0870-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FEFC; }
@font-face { font-family: 'Tajawal'; font-style: normal; font-weight: 500; font-display: swap; src: url(/fonts/tajawal-latin-500-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@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+0870-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FEFC; }
@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+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@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+0870-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FEFC; }
@font-face { font-family: 'Tajawal'; font-style: normal; font-weight: 800; font-display: swap; src: url(/fonts/tajawal-latin-800-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --brand: #350041;
  --brand-800: #4a0a5a;
  --brand-600: #6d2a80;
  --brand-400: #9a64aa;
  --brand-200: #dcc8e3;
  --brand-100: #efe5f2;
  --brand-50: #f8f3fa;
  --bg: #fcfbfd;
  --surface: #ffffff;
  --text: #1f1424;
  --muted: #6b5f70;
  --line: #ebe4ee;
  --ok: #0f7a4f;
  --ok-bg: #e8f6ef;
  --warn: #8a5a00;
  --warn-bg: #fff6e0;
  --danger: #b42318;
  --danger-bg: #fdecea;
  --info-bg: #eef4ff;
  --info: #1d4ed8;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(53, 0, 65, .06), 0 4px 16px rgba(53, 0, 65, .06);
  --shadow-lg: 0 12px 40px rgba(53, 0, 65, .18);
  --focus: 0 0 0 3px rgba(109, 42, 128, .35);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: 'Tajawal', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-weight: 400;
  font-size: 16px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
}
img { max-width: 100%; display: block; }
a { color: var(--brand-600); }
h1, h2, h3, h4 { margin: 0; line-height: 1.35; font-weight: 700; color: var(--brand); }
h1 { font-weight: 800; }
label, .label { font-weight: 500; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 8px; }
.num, .ltr { direction: ltr; unicode-bidi: isolate; font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.container { width: 100%; max-width: 1200px; margin-inline: auto; padding-inline: 20px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* ---------- الأزرار ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 12px;
  border: 1px solid transparent; background: var(--brand); color: #fff;
  font-weight: 700; font-size: 15px; line-height: 1; text-decoration: none;
  white-space: nowrap; cursor: pointer; transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { background: var(--brand-800); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn-outline { background: #fff; color: var(--brand); border-color: var(--brand-200); }
.btn-outline:hover { background: var(--brand-50); border-color: var(--brand-400); }
.btn-ghost { background: transparent; color: var(--brand); }
.btn-ghost:hover { background: var(--brand-50); }
.btn-whatsapp { background: #128c4a; }
.btn-whatsapp:hover { background: #0e7a40; }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #912018; }
.btn-danger-outline { background: #fff; color: var(--danger); border-color: #f2c4bf; }
.btn-danger-outline:hover { background: var(--danger-bg); }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
.btn-block { width: 100%; }
.icon-btn {
  width: 40px; height: 40px; display: inline-grid; place-items: center; border-radius: 10px;
  border: 1px solid var(--line); background: #fff; color: var(--brand); cursor: pointer;
}
.icon-btn:hover { background: var(--brand-50); }
.icon-btn[aria-pressed="true"] { background: var(--brand); color: #fff; border-color: var(--brand); }
.icon-btn svg { width: 20px; height: 20px; }

/* ---------- الحقول ---------- */
.field { display: grid; gap: 6px; }
.field > span, .field > label { font-weight: 500; font-size: 14px; color: var(--brand); }
.input, .select, .textarea {
  width: 100%; min-height: 46px; padding: 10px 14px; border-radius: 12px;
  border: 1px solid var(--line); background: #fff; font-size: 15px; transition: border-color .15s;
}
.textarea { min-height: 120px; resize: vertical; line-height: 1.7; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--brand-400); outline: none; box-shadow: var(--focus); }
.select { appearance: none; padding-inline-start: 14px; padding-inline-end: 38px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%236d2a80' stroke-width='2'/%3E%3C/svg%3E") no-repeat left 14px center; }
.hint { font-size: 13px; color: var(--muted); }

/* ---------- الترويسة ---------- */
.site-header { position: sticky; top: 0; z-index: 30; background: rgba(255,255,255,.94); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.site-header .container { display: flex; align-items: center; gap: 16px; min-height: 68px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--brand); flex: none; }
.brand img { width: 44px; height: 44px; border-radius: 12px; object-fit: contain; background: #fff; }
.brand-name { font-weight: 800; font-size: 18px; line-height: 1.2; }
.brand-sub { font-weight: 500; font-size: 12px; color: var(--muted); line-height: 1.2; }
.nav { display: flex; gap: 4px; margin-inline-start: auto; }
.nav a { padding: 8px 12px; border-radius: 10px; font-weight: 500; text-decoration: none; color: var(--text); white-space: nowrap; }
.nav a:hover, .nav a[aria-current="page"] { background: var(--brand-50); color: var(--brand); }
.menu-btn { display: none; margin-inline-start: auto; }
@media (max-width: 860px) {
  .menu-btn { display: inline-grid; }
  .nav { display: none; position: absolute; inset-inline: 0; top: 68px; background: #fff; flex-direction: column; padding: 8px 16px 16px; border-bottom: 1px solid var(--line); box-shadow: var(--shadow); }
  .nav.open { display: flex; }
  .nav a { padding: 12px; }
}

/* ---------- الواجهة الرئيسية ---------- */
.hero { background: linear-gradient(180deg, var(--brand-50), var(--bg)); border-bottom: 1px solid var(--line); }
.hero .container { padding-block: 40px 28px; }
.hero h1 { font-size: clamp(26px, 4vw, 38px); }
.hero p { margin: 8px 0 22px; color: var(--muted); font-size: 17px; max-width: 640px; }
.search { position: relative; max-width: 720px; }
.search svg { position: absolute; inset-inline-start: 16px; top: 50%; transform: translateY(-50%); width: 22px; height: 22px; color: var(--brand-400); pointer-events: none; }
.search .input { min-height: 56px; padding-inline-start: 50px; font-size: 17px; border-radius: 16px; box-shadow: var(--shadow); border-color: var(--brand-100); }

.notice {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--radius);
  background: var(--info-bg); color: #1e3a8a; border: 1px solid #d6e2ff; font-weight: 500;
}
.notice svg { width: 22px; height: 22px; flex: none; margin-top: 2px; }
.notice a { font-weight: 700; color: var(--info); white-space: nowrap; }
.notice-warn { background: var(--warn-bg); color: #5c3c00; border-color: #f4dfa6; }
.notice-danger { background: var(--danger-bg); color: #7a1a12; border-color: #f2c4bf; }
.notice-ok { background: var(--ok-bg); color: #0b5b3b; border-color: #bfe6d2; }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 22px 0 16px; }
.toolbar .select { width: auto; min-width: 150px; min-height: 42px; font-size: 14px; }
.toolbar .spacer { flex: 1; }
.result-count { font-weight: 500; color: var(--muted); font-size: 14px; white-space: nowrap; }
.view-toggle { display: flex; gap: 6px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px; }
.card {
  display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.card-media { aspect-ratio: 1 / 1; background: var(--brand-50); display: grid; place-items: center; overflow: hidden; }
.card-media img { width: 100%; height: 100%; object-fit: cover; }
.card-media .ph { color: var(--brand-200); width: 56px; height: 56px; }
.card-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card-title { font-weight: 700; font-size: 16px; color: var(--text); line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 48px; }
.meta { display: grid; gap: 2px; font-size: 14px; }
.meta-row { display: flex; gap: 6px; align-items: baseline; }
.meta-row b { font-weight: 700; color: var(--brand); white-space: nowrap; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 999px; background: var(--brand-100); color: var(--brand); font-size: 12px; font-weight: 700; line-height: 22px; letter-spacing: .3px; white-space: nowrap; }
.chip-muted { background: #f1eef2; color: var(--muted); }
.chip-warn { background: var(--warn-bg); color: var(--warn); }
.chip-ok { background: var(--ok-bg); color: var(--ok); }
.chip-danger { background: var(--danger-bg); color: var(--danger); }
.card-actions { margin-top: auto; padding-top: 6px; }

.grid.list { grid-template-columns: 1fr; gap: 10px; }
.grid.list .card { flex-direction: row; align-items: stretch; }
.grid.list .card:hover { transform: none; }
.grid.list .card-media { width: 120px; aspect-ratio: auto; flex: none; }
.grid.list .card-body { flex-direction: row; align-items: center; gap: 18px; flex-wrap: wrap; }
.grid.list .card-title { min-height: 0; flex: 1 1 260px; }
.grid.list .card-actions { margin: 0; padding: 0; }
@media (max-width: 600px) {
  .grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .card-body { padding: 10px 12px 12px; }
  .card-title { font-size: 14px; min-height: 42px; }
  .meta { font-size: 13px; }
  .grid.list .card-media { width: 92px; }
  .grid.list .card-body { gap: 8px; }
  .toolbar .select { flex: 1 1 140px; min-width: 0; }
}

.empty { text-align: center; padding: 48px 16px; color: var(--muted); }
.empty h3 { margin-bottom: 6px; }
.skeleton { background: linear-gradient(90deg, #f3eef5 25%, #faf7fb 50%, #f3eef5 75%); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: var(--radius); min-height: 330px; }
@keyframes sk { to { background-position: -200% 0; } }

/* ---------- النوافذ ---------- */
dialog.modal { border: 0; padding: 0; border-radius: 20px; width: min(760px, calc(100% - 24px)); max-height: calc(100dvh - 24px); box-shadow: var(--shadow-lg); color: var(--text); }
dialog.modal::backdrop { background: rgba(30, 10, 36, .55); }
.modal-head { position: sticky; top: 0; z-index: 2; background: #fff; display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-head .sku { font-weight: 700; font-size: 16px; white-space: nowrap; }
.modal-head .sku b { color: var(--brand); }
.modal-head .store-link { margin-inline-start: auto; }
.modal-body { padding: 18px; display: grid; gap: 16px; }
.modal-foot { padding: 14px 18px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.detail-top { display: grid; grid-template-columns: 220px 1fr; gap: 18px; align-items: start; }
.detail-top .card-media { border-radius: var(--radius); border: 1px solid var(--line); }
@media (max-width: 600px) { .detail-top { grid-template-columns: 1fr; } .detail-top .card-media { max-width: 260px; } }
.file-list { display: grid; gap: 8px; }
.file-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.file-row .fmt { width: 52px; height: 40px; flex: none; display: grid; place-items: center; border-radius: 10px; background: var(--brand-100); color: var(--brand); font-weight: 800; font-size: 13px; }
.file-row .info { flex: 1; min-width: 0; display: grid; }
.file-row .info .fname { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-row .info .fsize { font-size: 13px; color: var(--muted); }

/* ---------- أقسام المحتوى ---------- */
.section { padding-block: 40px; }
.section h2 { font-size: 24px; margin-bottom: 14px; }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; counter-reset: s; padding: 0; margin: 0; list-style: none; }
.steps li { counter-increment: s; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; position: relative; }
.steps li::before { content: counter(s); display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--brand); color: #fff; font-weight: 700; margin-bottom: 8px; }
.steps li b { display: block; font-weight: 700; color: var(--brand); margin-bottom: 4px; }
.faq { display: grid; gap: 10px; max-width: 860px; }
.faq details { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 0 16px; }
.faq summary { cursor: pointer; padding: 14px 0; font-weight: 700; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::after { content: '+'; color: var(--brand-600); font-weight: 800; }
.faq details[open] summary::after { content: '–'; }
.faq details p { margin: 0 0 14px; color: var(--muted); }
.site-footer { border-top: 1px solid var(--line); background: #fff; padding: 22px 0; color: var(--muted); font-size: 14px; }
.site-footer .container { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center; }
.site-footer a { color: var(--brand-600); text-decoration: none; font-weight: 500; }

.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }

/* ---------- تنبيهات منبثقة ---------- */
.toasts { position: fixed; bottom: 16px; inset-inline: 16px; display: grid; justify-items: center; gap: 8px; z-index: 100; pointer-events: none; }
.toast { pointer-events: auto; background: var(--text); color: #fff; padding: 12px 18px; border-radius: 12px; box-shadow: var(--shadow-lg); font-weight: 500; max-width: 520px; }
.toast.error { background: var(--danger); }
.toast.ok { background: var(--ok); }

.progress { height: 8px; background: var(--brand-100); border-radius: 99px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--brand-600); width: 0; transition: width .2s; }
.spinner { width: 18px; height: 18px; border: 2px solid currentColor; border-top-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
