/* ============================================================================
   الأساور — ثيم سايبر مستقبلي زجاجي (Cyber Glass)
   خلفية داكنة بتوهجات نيون هادئة، بطاقات زجاجية شفافة، شريط تنقل سفلي على الجوال.
   كل الألوان متغيّرات (:root) كي تبقى كل صفحات الموقع منسجمة.
   ============================================================================ */
:root {
  --bg: #060914; --bg-2: #0b1226;
  --surface: rgba(255, 255, 255, .055); --surface-2: rgba(255, 255, 255, .085); --surface-solid: #0e1630;
  --ink: #e9f1ff; --ink-2: #93a6c7; --line: rgba(160, 190, 255, .17); --line-strong: rgba(160, 190, 255, .32);
  --accent: #22d3ee; --accent-2: #8b5cf6; --accent-3: #ec4899; --accent-ink: #04121a; --accent-soft: rgba(34, 211, 238, .14);
  --good: #34f5a3; --good-soft: rgba(52, 245, 163, .13);
  --bad: #ff6b8b; --bad-soft: rgba(255, 107, 139, .14);
  --warn: #ffd166; --warn-soft: rgba(255, 209, 102, .14);
  --info: #7aa2ff; --info-soft: rgba(122, 162, 255, .15);
  --radius: 18px; --blur: 18px;
  --shadow: 0 12px 40px rgba(0, 0, 0, .38), inset 0 1px 0 rgba(255, 255, 255, .08);
  --glow: 0 0 0 1px rgba(34, 211, 238, .38), 0 0 26px rgba(34, 211, 238, .24);
  --grad: linear-gradient(135deg, #22d3ee 0%, #6ea8ff 55%, #a78bfa 100%);
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; scrollbar-width: thin; scrollbar-color: rgba(120, 160, 255, .35) transparent; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body { margin: 0; min-height: 100vh; position: relative; overflow-x: hidden; background: transparent; color: var(--ink);
  font-family: 'Tajawal', 'Segoe UI', Tahoma, sans-serif; font-size: 16px; line-height: 1.55; }

/* خلفية: توهجات نيون + شبكة خفيفة */
body::before { content: ''; position: fixed; inset: -15%; z-index: -2; pointer-events: none;
  background:
    radial-gradient(42% 36% at 12% 8%, rgba(34, 211, 238, .22), transparent 70%),
    radial-gradient(36% 42% at 92% 12%, rgba(139, 92, 246, .24), transparent 70%),
    radial-gradient(46% 46% at 68% 98%, rgba(236, 72, 153, .15), transparent 70%),
    linear-gradient(180deg, #070b18, #050711); }
body::after { content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image: linear-gradient(rgba(120, 160, 255, .05) 1px, transparent 1px), linear-gradient(90deg, rgba(120, 160, 255, .05) 1px, transparent 1px);
  background-size: 46px 46px; -webkit-mask-image: radial-gradient(ellipse at 50% 0%, #000 0%, transparent 78%); mask-image: radial-gradient(ellipse at 50% 0%, #000 0%, transparent 78%); }
@media (min-width: 821px) and (prefers-reduced-motion: no-preference) {
  body::before { animation: aurora 32s ease-in-out infinite alternate; }
  @keyframes aurora { from { transform: translate3d(0, 0, 0) scale(1); } to { transform: translate3d(2.5%, 2%, 0) scale(1.06); } }
}
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: rgba(34, 211, 238, .35); }
.num { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }
span.num, b.num, dd.num, small.num { display: inline-block; }
td.num, th.num { white-space: nowrap; }

/* ---------------------------------------------------------------- الهيكل */
.topbar { position: sticky; top: 0; z-index: 20; background: rgba(7, 11, 28, .62); border-bottom: 1px solid var(--line);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(160%); backdrop-filter: blur(var(--blur)) saturate(160%); padding-top: env(safe-area-inset-top); }
.topbar-in { max-width: 1280px; margin: 0 auto; padding: 0 16px; display: flex; align-items: center; gap: 14px; min-height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; text-decoration: none; white-space: nowrap; letter-spacing: .2px; }
.brand-mark { width: 34px; height: 34px; border-radius: 11px; background: var(--grad); color: #03121a; display: grid; place-items: center; font-size: 19px;
  box-shadow: 0 0 22px rgba(34, 211, 238, .5), inset 0 1px 0 rgba(255, 255, 255, .5); }
.nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { display: inline-flex; align-items: center; gap: 7px; padding: 9px 14px; border-radius: 12px; text-decoration: none; color: var(--ink-2); font-weight: 700; white-space: nowrap; transition: .18s; }
.nav a .ic { font-size: 15px; opacity: .9; }
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a.on { color: #eaffff; background: linear-gradient(135deg, rgba(34, 211, 238, .22), rgba(139, 92, 246, .22)); box-shadow: inset 0 0 0 1px rgba(34, 211, 238, .4), 0 0 18px rgba(34, 211, 238, .16); }
.who { color: var(--ink-2); font-size: 14px; display: flex; gap: 10px; align-items: center; white-space: nowrap; }
main { max-width: 1280px; margin: 0 auto; padding: 24px 16px 90px; }
h1 { font-size: 26px; margin: 0 0 4px; font-weight: 800; letter-spacing: .2px; }
h2 { font-size: 18px; margin: 0 0 12px; font-weight: 800; }
.sub { color: var(--ink-2); margin: 0 0 18px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.row.between { justify-content: space-between; }
.grow { flex: 1; }

/* ---------------------------------------------------------------- زجاج: البطاقات */
.card, .tw, .opt { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(150%); backdrop-filter: blur(var(--blur)) saturate(150%); }
.card { padding: 18px; position: relative; }
.card::before { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; padding: 1px;
  background: linear-gradient(135deg, rgba(34, 211, 238, .35), transparent 35%, transparent 65%, rgba(139, 92, 246, .35));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; opacity: .55; }
.card .tw, .card .opt { -webkit-backdrop-filter: none; backdrop-filter: none; box-shadow: none; background: rgba(255, 255, 255, .035); }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .card, .tw, .opt, .topbar { background: rgba(14, 22, 48, .92); }
}
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); }
.stat { padding: 16px 18px; }
.stat b { display: block; font-size: 26px; line-height: 1.2; font-family: 'Orbitron', 'Tajawal', sans-serif; font-weight: 700; }
.stat span { color: var(--ink-2); font-size: 14px; }

/* ---------------------------------------------------------------- عناصر التحكم */
.btn { border: 1px solid var(--line); background: var(--surface); border-radius: 14px; padding: 9px 16px; cursor: pointer; font-weight: 700; min-height: 42px; transition: .18s;
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.btn:hover { background: var(--surface-2); border-color: var(--line-strong); box-shadow: 0 0 18px rgba(34, 211, 238, .14); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--grad); border-color: transparent; color: var(--accent-ink); box-shadow: 0 6px 22px rgba(34, 211, 238, .28), inset 0 1px 0 rgba(255, 255, 255, .45); }
.btn.primary:hover { box-shadow: 0 8px 30px rgba(34, 211, 238, .5), inset 0 1px 0 rgba(255, 255, 255, .45); filter: brightness(1.06); transform: translateY(-1px); }
.btn.sm { padding: 5px 11px; min-height: 34px; font-size: 14px; border-radius: 11px; }
.btn.danger { color: var(--bad); border-color: rgba(255, 107, 139, .3); }
.btn.danger:hover { background: var(--bad-soft); }
.btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; transform: none; filter: grayscale(.4); }
input[type=text], input[type=number], input[type=password], input[type=tel], input[type=search], select, textarea {
  width: 100%; border: 1px solid var(--line); background: rgba(4, 9, 26, .55); border-radius: 13px; padding: 9px 13px; min-height: 42px; transition: .18s; font-size: 16px; }
input::placeholder, textarea::placeholder { color: rgba(147, 166, 199, .6); }
textarea { min-height: 110px; resize: vertical; }
select option, select optgroup { background: #0e1630; color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(34, 211, 238, .18), 0 0 22px rgba(34, 211, 238, .18); }
.btn:focus-visible, .chip:focus-visible, summary:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input[type=checkbox] { accent-color: var(--accent); width: 18px; height: 18px; }
label.f { display: block; font-weight: 700; font-size: 14px; margin-bottom: 5px; color: var(--ink-2); }
.field { margin-bottom: 12px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 7px 15px; cursor: pointer; font-weight: 700; transition: .18s; color: var(--ink); }
.chip:hover { border-color: var(--line-strong); background: var(--surface-2); }
.chip.on { background: var(--accent-soft); border-color: var(--accent); color: #c9fbff; box-shadow: 0 0 20px rgba(34, 211, 238, .24); }
.tag { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); }
.tag.good { background: var(--good-soft); color: var(--good); border-color: rgba(52, 245, 163, .3); }
.tag.bad { background: var(--bad-soft); color: var(--bad); border-color: rgba(255, 107, 139, .3); }
.tag.warn { background: var(--warn-soft); color: var(--warn); border-color: rgba(255, 209, 102, .3); }
.tag.info { background: var(--info-soft); color: var(--info); border-color: rgba(122, 162, 255, .3); }

/* ---------------------------------------------------------------- الجداول */
.tw { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
.tw > table { min-width: 560px; }
th, td { padding: 10px 13px; text-align: right; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { background: rgba(255, 255, 255, .045); font-size: 13px; color: var(--ink-2); font-weight: 700; white-space: nowrap; position: sticky; top: 0; letter-spacing: .3px; }
tr:last-child td { border-bottom: 0; }
tr.group td { background: var(--surface-2); font-weight: 800; }
td.n, th.n { text-align: left; }
td input.cell { min-height: 36px; padding: 4px 9px; width: 130px; text-align: left; direction: ltr; border-radius: 10px; }
td input.cell.sm { width: 70px; }
td.clickable { cursor: pointer; }
tr.click:hover td { background: rgba(34, 211, 238, .07); cursor: pointer; }
.tw td:first-child { min-width: 170px; }
.muted { color: var(--ink-2); }
.up { color: var(--bad); } .down { color: var(--good); }

/* ---------------------------------------------------------------- إشعار + نوافذ */
#toast { position: fixed; bottom: 22px; inset-inline: 0; display: grid; place-items: center; pointer-events: none; z-index: 70; }
#toast div { background: rgba(10, 18, 42, .88); color: var(--ink); border: 1px solid rgba(34, 211, 238, .45); padding: 11px 18px; border-radius: 14px; margin-top: 8px; max-width: 92vw;
  box-shadow: 0 10px 34px rgba(0, 0, 0, .5), 0 0 24px rgba(34, 211, 238, .22); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
.modal-bg { position: fixed; inset: 0; background: rgba(3, 6, 18, .66); -webkit-backdrop-filter: blur(7px); backdrop-filter: blur(7px); z-index: 60; display: grid; place-items: center; padding: 16px; }
.modal { background: rgba(13, 21, 46, .88); border: 1px solid var(--line-strong); border-radius: 24px; padding: 22px; width: min(600px, 100%); max-height: 90vh; overflow: auto;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .6), 0 0 40px rgba(34, 211, 238, .12); -webkit-backdrop-filter: blur(26px) saturate(150%); backdrop-filter: blur(26px) saturate(150%); }

/* ---------------------------------------------------------------- تسجيل الدخول */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login .card { width: min(400px, 100%); padding: 26px; box-shadow: var(--shadow), 0 0 60px rgba(34, 211, 238, .12); }
.login .brand { font-size: 20px; }

/* ---------------------------------------------------------------- بطاقات الاختيار والأسعار */
.opt { padding: 16px; cursor: pointer; transition: .18s; }
.opt:hover { border-color: var(--line-strong); }
.opt.on { border-color: var(--accent); background: var(--accent-soft); box-shadow: var(--glow); }
.price { font-family: 'Orbitron', 'Tajawal', sans-serif; font-size: 27px; font-weight: 700; line-height: 1.25; letter-spacing: .4px;
  background: linear-gradient(90deg, #67e8f9 0%, #a5b4fc 60%, #e9d5ff 100%); -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 14px rgba(34, 211, 238, .35)); }
.price small { font-family: 'Tajawal', sans-serif; font-size: 13px; color: var(--ink-2); -webkit-text-fill-color: var(--ink-2); font-weight: 600; display: block; letter-spacing: 0; }
.steps { display: flex; gap: 6px; margin-bottom: 16px; overflow-x: auto; }
.steps span { padding: 6px 13px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--ink-2); font-weight: 700; font-size: 14px; white-space: nowrap; }
.steps span.on { background: var(--grad); color: var(--accent-ink); border-color: transparent; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 15px; }
.kv dt { color: var(--ink-2); } .kv dd { margin: 0; font-weight: 700; }
.notice { padding: 11px 15px; border-radius: 14px; background: var(--warn-soft); color: var(--warn); margin: 10px 0; font-size: 14px; border: 1px solid rgba(255, 209, 102, .28); }
.notice.bad { background: var(--bad-soft); color: var(--bad); border-color: rgba(255, 107, 139, .3); }
.notice.good { background: var(--good-soft); color: var(--good); border-color: rgba(52, 245, 163, .3); }

.stepper { display: inline-flex; align-items: center; gap: 4px; }
.stepper .btn { min-width: 36px; padding: 4px 8px; }
.stepper input.cell { width: 64px; text-align: center; }
select.swap { width: 100%; min-width: 220px; max-width: 460px; min-height: 38px; padding: 4px 10px; }
input.money { text-align: left; direction: ltr; font-family: 'Orbitron', 'Tajawal', sans-serif; letter-spacing: .3px; }

/* بنود قابلة للفتح */
.grpwrap { margin-top: 14px; display: grid; gap: 10px; }
.grpbox > summary { cursor: pointer; padding: 12px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 15px; font-size: 16px; list-style: none; display: flex; gap: 10px; align-items: center; min-height: 48px; transition: .18s;
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.grpbox > summary:hover { border-color: var(--line-strong); }
.grpbox > summary::-webkit-details-marker { display: none; }
.grpbox > summary::before { content: '◂'; color: var(--accent); font-size: 14px; text-shadow: 0 0 10px var(--accent); }
.grpbox[open] > summary { border-color: rgba(34, 211, 238, .5); box-shadow: 0 0 22px rgba(34, 211, 238, .15); border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.grpbox[open] > summary::before { content: '▾'; }
.grpbox > summary .grp-sum { margin-inline-start: auto; font-family: 'Orbitron', sans-serif; font-size: 14px; }
.grpbox > .tw { border-top: 0; border-top-left-radius: 0; border-top-right-radius: 0; background: rgba(255, 255, 255, .03); -webkit-backdrop-filter: none; backdrop-filter: none; }

/* ---------------------------------------------------------------- الجوال */
@media (max-width: 820px) {
  /* شريط تنقل سفلي زجاجي */
  .nav { position: fixed; inset-inline: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 40; padding: 6px; gap: 2px; justify-content: space-around; overflow: visible;
    background: rgba(9, 15, 36, .74); border: 1px solid var(--line-strong); border-radius: 24px;
    box-shadow: 0 14px 44px rgba(0, 0, 0, .55), 0 0 30px rgba(34, 211, 238, .1); -webkit-backdrop-filter: blur(22px) saturate(170%); backdrop-filter: blur(22px) saturate(170%); }
  .nav a { flex: 1; flex-direction: column; justify-content: center; gap: 1px; padding: 7px 4px; font-size: 11.5px; border-radius: 18px; min-width: 0; line-height: 1.2; }
  .nav a .ic { font-size: 20px; }
  main { padding: 16px 12px calc(104px + env(safe-area-inset-bottom)); }
  #toast { bottom: calc(96px + env(safe-area-inset-bottom)); }
  .topbar-in { padding: 0 12px; min-height: 54px; }
  .who span { display: none; }
  /* backdrop-filter على الشريط العلوي يجعله مرجع التثبيت لشريط التنقل السفلي (fixed) — نزيله هنا */
  .topbar { -webkit-backdrop-filter: none; backdrop-filter: none; background: rgba(7, 11, 28, .94); }
}
@media (max-width: 720px) {
  :root { --radius: 16px; --blur: 12px; }
  h1 { font-size: 22px; } h2 { font-size: 17px; }
  .card { padding: 14px; }
  .btn { min-height: 46px; } .btn.sm { min-height: 40px; }
  .stepper .btn { min-width: 40px; min-height: 40px; }
  th, td { padding: 8px 8px; }
  td input.cell { width: 110px; } td input.cell.sm { width: 58px; } .stepper input.cell { width: 56px; }
  .tw > table { min-width: 460px; } .tw td:first-child { min-width: 150px; }
  select.swap { min-width: 0; max-width: 100%; }
  .price { font-size: 22px; }
  .row { gap: 10px; }
  .chip { padding: 8px 14px; }
  .opt { padding: 14px; }
  /* نوافذ كورقة سفلية */
  .modal-bg { place-items: end center; padding: 0; }
  .modal { width: 100%; max-height: 92vh; border-radius: 24px 24px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); }
}
@media (max-width: 380px) {
  h1 { font-size: 20px; }
  .brand span:last-child { display: none; }
  .nav a { font-size: 10.5px; }
}

/* ---------------------------------------------------------------- الطباعة: أبيض نظيف */
@media print {
  :root { --bg: #fff; --surface: #fff; --surface-2: #f3f3f3; --ink: #111; --ink-2: #555; --line: #cfcfcf; --line-strong: #bbb; --accent: #b45309; --accent-soft: #fdf0d9; }
  html, body { background: #fff !important; color: #111; }
  body::before, body::after { display: none !important; }
  .topbar, .no-print, #toast, .nav { display: none !important; }
  .card, .tw, .opt, .modal { background: #fff !important; box-shadow: none !important; border-color: #bbb !important; -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }
  .card::before { display: none; }
  .price { background: none; -webkit-text-fill-color: #b45309; color: #b45309; filter: none; }
  .price small { -webkit-text-fill-color: #555; }
  main { padding: 0; max-width: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* جدول العرض على الجوال: كل صف بطاقة (الاسم أولاً ثم العدد والكلفة والحذف) */
@media (max-width: 720px) {
  .tw > table.stack { min-width: 0; }
  table.stack, table.stack tbody { display: block; }
  table.stack thead { display: none; }
  table.stack tr { display: grid; grid-template-columns: auto 1fr auto; gap: 8px 10px; align-items: center; padding: 11px 10px; border-bottom: 1px solid var(--line); }
  table.stack tr:last-child { border-bottom: 0; }
  table.stack td { display: block; padding: 0; border: 0; min-width: 0 !important; text-align: right; }
  table.stack td:first-child, table.stack td[colspan] { grid-column: 1 / -1; }
  table.stack td.n { text-align: left; }
  table.stack td:last-child:not(:first-child) { grid-column: 3; justify-self: end; }
  table.stack select.swap { max-width: 100%; }
}

/* ---------------------------------------------------------------- ألوان الأسعار: المفرد أخضر • الجملة أحمر • الربح ذهبي */
:root { --retail: #7df5b8; --whole: #ff8fa5; --profit: #ffd166; }
.t-retail { color: var(--retail); } .t-whole { color: var(--whole); } .t-profit { color: var(--profit); }
td.t-retail, td.t-whole, td.t-profit { font-weight: 700; }
td.t-retail { text-shadow: 0 0 14px rgba(125, 245, 184, .25); }
td.t-whole { text-shadow: 0 0 14px rgba(255, 143, 165, .2); }
td.t-profit { text-shadow: 0 0 14px rgba(255, 209, 102, .22); }
th.t-retail, th.t-whole, th.t-profit { border-bottom: 2px solid currentColor; }
.price.retail { background: linear-gradient(90deg, #b6f7d6 0%, #34f5a3 100%); -webkit-background-clip: text; background-clip: text; filter: drop-shadow(0 0 14px rgba(52, 245, 163, .35)); }
.price.whole { background: linear-gradient(90deg, #ffd0d9 0%, #ff7a95 100%); -webkit-background-clip: text; background-clip: text; filter: drop-shadow(0 0 12px rgba(255, 107, 139, .3)); }
.price.profit { background: linear-gradient(90deg, #fff0c2 0%, #ffc83d 100%); -webkit-background-clip: text; background-clip: text; filter: drop-shadow(0 0 12px rgba(255, 200, 61, .3)); }
.chip .t-retail { text-shadow: 0 0 12px rgba(125, 245, 184, .3); }
.legend { display: flex; gap: 16px; flex-wrap: wrap; margin: 0 0 14px; font-size: 14px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend i { width: 11px; height: 11px; border-radius: 50%; display: inline-block; box-shadow: 0 0 10px currentColor; background: currentColor; }
@media print { .t-retail, .t-whole, .t-profit { color: #111 !important; text-shadow: none !important; } th.t-retail, th.t-whole, th.t-profit { border-bottom-color: #bbb; } }

/* توفر المواد */
.avail-cell { width: 64px; text-align: center !important; }
label.avail { display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 6px; }
label.avail input { width: 22px; height: 22px; accent-color: var(--retail); cursor: pointer; }
tr.na td { opacity: .5; }
tr.na td.avail-cell { opacity: 1; }
tr.na td:nth-child(2) b, tr.na td:nth-child(2) { text-decoration-line: line-through; text-decoration-color: rgba(255, 107, 139, .6); }
tr.na td:nth-child(2) .tag { text-decoration: none; display: inline-block; }

/* ---------------------------------------------------------------- تابلت: جداول أضيق وخط أصغر */
@media screen and (min-width: 721px) and (max-width: 1024px) {
  .tw > table { min-width: 0; font-size: 14px; }
  th, td { padding: 8px 8px; }
  .tw td:first-child { min-width: 120px; }
  td input.cell { width: 100px; } td input.cell.sm { width: 56px; }
  main { padding-inline: 16px; }
}

/* ---------------------------------------------------------------- جوال: كل صف جدول بطاقة بعناوين فوق القيم (لا تمرير أفقي) */
@media screen and (max-width: 720px) {
  .tw:has(> table.cards) { overflow-x: visible; background: none; border: 0; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
  .tw > table.cards { min-width: 0; font-size: 15px; }
  table.cards, table.cards tbody { display: block; }
  table.cards thead { display: none; }
  table.cards tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; align-items: end; padding: 13px 14px; margin-bottom: 10px;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
  table.cards tr.group { display: block; padding: 8px 14px; margin: 14px 0 8px; background: var(--surface-2); border-radius: 12px; }
  table.cards tr.click:active { background: var(--accent-soft); }
  table.cards td { display: block; padding: 0; border: 0; min-width: 0 !important; width: auto !important; text-align: right; overflow-wrap: anywhere; }
  table.cards td.n, table.cards th.n { text-align: right; }
  table.cards td[data-label]::before { content: attr(data-label); display: block; font-size: 12px; font-weight: 700; color: var(--ink-2); margin-bottom: 2px; }
  table.cards td:first-child, table.cards td.nm, table.cards td[colspan], table.cards td.act { grid-column: 1 / -1; }
  table.cards td:first-child:not([data-label]), table.cards td.nm { font-weight: 700; font-size: 16px; }
  table.cards td.nm { order: -2; } table.cards td.nm::before { display: none; }
  table.cards td.avail-cell { order: -1; grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; text-align: right !important; }
  table.cards td.avail-cell::before { margin: 0; }
  table.cards td.act { display: flex; gap: 8px; justify-content: flex-end; }
  table.cards td.act::before { display: none; }
  table.cards td input.cell, table.cards td input.cell.sm { width: 100%; }
  table.cards td:first-child[data-label]:not(.avail-cell)::before { display: none; }
  table.cards tr:last-child td { border-bottom: 0; }
}

/* ---------------------------------------------------------------- الشعار */
.brand-logo { height: 56px; width: auto; object-fit: contain; filter: drop-shadow(0 0 7px rgba(255, 255, 255, .6)) drop-shadow(0 0 18px rgba(255, 255, 255, .4)); }
.login-logo { width: 170px; max-width: 60%; height: auto; filter: drop-shadow(0 0 9px rgba(255, 255, 255, .6)) drop-shadow(0 0 24px rgba(255, 255, 255, .4)); }
.qhead { display: flex; gap: 14px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
@media (max-width: 720px) { .brand-logo { height: 56px; width: auto; object-fit: contain; filter: drop-shadow(0 0 7px rgba(255, 255, 255, .6)) drop-shadow(0 0 18px rgba(255, 255, 255, .4)); } }

/* ---------------------------------------------------------------- جدول المبادرة: مضغوط على الحاسبة، بطاقات على التابلت والجوال */
table.init th, table.init td { padding: 9px 7px; font-size: 14px; }
table.init td.act { white-space: nowrap; }
@media screen and (min-width: 721px) and (max-width: 1100px) {
  .tw:has(> table.init) { overflow-x: visible; background: none; border: 0; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
  .tw > table.init { min-width: 0; }
  table.init, table.init tbody { display: block; }
  table.init thead { display: none; }
  table.init tr { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px 14px; align-items: end; padding: 13px 14px; margin-bottom: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
  table.init td { display: block; padding: 0; border: 0; min-width: 0 !important; text-align: right; }
  table.init td.n { text-align: right; }
  table.init td[data-label]::before { content: attr(data-label); display: block; font-size: 12px; font-weight: 700; color: var(--ink-2); margin-bottom: 2px; }
  table.init td:first-child, table.init td.act { grid-column: 1 / -1; }
  table.init td:first-child::before, table.init td.act::before { display: none; }
  table.init td.act { display: flex; gap: 8px; justify-content: flex-end; }
}

/* قائمة الأسعار: المواصفات الكاملة */
.specgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.spec-card { break-inside: avoid; page-break-inside: avoid; }
.spec-card .kv { grid-template-columns: 130px 1fr; }
@media (max-width: 820px) { .specgrid { grid-template-columns: 1fr; } .spec-card .kv { grid-template-columns: 110px 1fr; } }
@media print { .specgrid { grid-template-columns: repeat(2, 1fr); } }

/* ---------------------------------------------------------------- ورقة PDF لكل منظومة */
.sheet { max-width: 820px; margin: 0 auto; padding: 26px 30px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.sh-head { display: flex; align-items: center; gap: 14px; border-bottom: 3px solid var(--accent); padding-bottom: 12px; margin-bottom: 14px; }
.sh-head img { height: 64px; width: auto; }
.sh-co { font-size: 20px; font-weight: 800; }
.sh-date { margin-inline-start: auto; font-size: 13px; }
.sh-title { font-size: 24px; margin: 6px 0 12px; }
.sheet h2 { font-size: 17px; margin: 18px 0 8px; }
.sh-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 12px 0; }
.sh-stat { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.sh-stat b { display: block; font-size: 20px; }
.sh-stat span { font-size: 13px; color: var(--ink-2); }
.sh-price { display: flex; align-items: baseline; gap: 10px; padding: 12px 16px; border: 2px solid var(--accent); border-radius: 14px; margin: 12px 0; }
.sh-price b { font-size: 28px; color: var(--retail); }
.sh-fin { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 12px 0; }
.sh-fin > div { border: 2px solid var(--accent); border-radius: 12px; padding: 10px 12px; }
.sh-fin span { display: block; font-size: 12.5px; color: var(--ink-2); }
.sh-fin b { display: block; font-size: 20px; color: var(--retail); }
.sh-fin small { color: var(--ink-2); }
.sh-table { width: 100%; border-collapse: collapse; }
.sh-table th, .sh-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: right; vertical-align: top; font-size: 14.5px; position: static; background: none; }
.sh-table th { width: 170px; color: var(--ink-2); white-space: normal; }
.sh-list { margin: 0; padding-inline-start: 20px; font-size: 14px; line-height: 1.9; }
.sh-foot { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 10px; font-size: 13.5px; text-align: center; }
@media (max-width: 720px) { .sheet { padding: 16px 14px; } .sh-stats, .sh-fin { grid-template-columns: repeat(2, 1fr); } .sh-table th { width: 110px; } .sh-title { font-size: 20px; } }
@media print {
  .sheet { border: 0; padding: 0; max-width: none; background: #fff; }
  .sh-stat, .sh-fin > div, .sh-price { border-color: #bbb; }
  .sh-price b, .sh-fin b { color: #b45309; }
  .sh-stats, .sh-fin { grid-template-columns: repeat(4, 1fr); }
  .sh-table th { width: 170px; }
  @page { size: A4; margin: 14mm; }
}

/* ورقة PDF: نسخة بيضاء خارج الشاشة بعرض A4 تُصوَّر عند «تحميل PDF» */
.sheet.light { --surface: #fff; --surface-2: #f3f3f3; --ink: #111; --ink-2: #555; --line: #cfcfcf; --accent: #b45309; --retail: #b45309; background: #fff; color: #111; border: 0; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
.sheet.light .sh-stat, .sheet.light .sh-fin > div, .sheet.light .sh-price { border-color: #bbb; background: #fff; }
.sheet.light .sh-head img { background: transparent; }
.sheet.pdf-render { position: fixed; left: -10000px; top: 0; width: 794px; max-width: none; margin: 0; padding: 28px 34px; border-radius: 0; direction: rtl; }
.sheet.pdf-render .sh-stats, .sheet.pdf-render .sh-fin { grid-template-columns: repeat(4, 1fr); }
.sheet.pdf-render .sh-table th { width: 170px; }
.sheet.pdf-render, .sheet.pdf-render * { letter-spacing: 0 !important; }   /* التباعد يكسر وصل الحروف العربية عند التصوير */

/* اسم المشروع العام تحت لوكو صفحة الدخول (لوكو الشركة لا يظهر هنا) */
.platform-name { font-family: 'Tajawal', sans-serif; font-size: 28px; font-weight: 800; color: var(--ink); margin: 6px 0 4px; letter-spacing: 0; text-align: center; }
