/* MIB Souq — هويّة أسواق محاصيل القضارف — نهاري فقط: ورقي فاتح + Lime Compute */
:root {
  /* ——— الأسطح: فاتحة ورقية ——— */
  --ink: #EDEFEC;          /* خلفية الصفحة */
  --panel: #FFFFFF;        /* بطاقات */
  --panel2: #F2F4F0;       /* طبقة مرفوعة / ترويسات */
  --panel3: #E3E7E1;       /* عناصر نشطة وحدود بارزة */

  /* ——— اللون المميّز: Lime Compute (مُغمَّق للتباين على الأبيض) ——— */
  --gold: #4E7D00;
  --gold-hover: #3E6600;
  --gold-bg: rgba(120, 170, 0, 0.14);
  --sesame: rgba(120, 170, 0, 0.16);
  --sunflower: #6FA500;

  /* ——— مؤشرات الاتجاه ——— */
  --ok: #2E7D46;
  --ok-bg: rgba(46, 125, 70, 0.14);
  --ok-border: rgba(46, 125, 70, 0.40);
  --red: #C43D28;
  --red-bg: rgba(196, 61, 40, 0.12);
  --red-border: rgba(196, 61, 40, 0.40);
  --warn: #4E7D00;

  /* ——— النصوص ——— */
  --paper: #1F2329;        /* نص أساسي (تباين عالٍ على الأبيض) */
  --dim: #4A515A;          /* نص فرعي وأرقام */
  --muted: #6B7280;        /* توضيحات ووحدات وتواريخ */
  --line: rgba(31, 35, 41, 0.12);
  --line-bright: rgba(78, 125, 0, 0.40);
  --on-gold: #FFFFFF;      /* نص فوق مساحة اللايم */
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  background: var(--ink);
  color: var(--paper);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
body {
  font-family: 'IBM Plex Sans Arabic', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.65;
  min-height: 100vh;
}
h1, h2, h3 { font-family: 'Noto Kufi Arabic', 'IBM Plex Sans Arabic', sans-serif; font-weight: 700; }
.mono { font-family: 'IBM Plex Mono', 'SF Mono', ui-monospace, monospace; direction: ltr; unicode-bidi: isolate; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select { font-family: inherit; }
a { color: inherit; }

/* Layout & Sidebar */
.app { display: grid; grid-template-columns: 222px 1fr; min-height: 100vh; }
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; bottom: 0; width: 100%; z-index: 40; height: auto !important; flex-direction: row !important; border-left: none !important; border-top: 1px solid var(--line); background: var(--panel) !important; box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.28); }
  .side .logo-box, .side .foot { display: none !important; }
  .side nav { flex-direction: row !important; width: 100%; justify-content: space-around; padding: 8px 4px 12px !important; }
  .side nav a { flex-direction: column; font-size: 11px; gap: 4px; padding: 7px 3px !important; color: var(--muted); }
  .side nav a.active { background: var(--gold-bg); color: var(--gold); font-weight: 700; box-shadow: none; }
  .main { padding-bottom: 86px !important; }
}

.side { background: var(--panel); border-left: 1px solid var(--line); display: flex; flex-direction: column; height: 100vh; position: sticky; top: 0; }
.logo-box { padding: 17px 16px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 11px; background: linear-gradient(180deg, rgba(182, 255, 46, 0.08), transparent); }
.logo-box .nm { font-family: 'IBM Plex Mono', monospace; font-size: 16px; letter-spacing: 1px; direction: ltr; line-height: 1.15; color: var(--paper); font-weight: 700; }
.logo-box .sb { font-size: 10.5px; color: var(--gold); font-weight: 600; }
.side nav { display: flex; flex-direction: column; padding: 12px 9px; gap: 4px; flex: 1; }
.side nav a { color: var(--dim); text-align: right; padding: 10px 13px; border-radius: 8px; font-size: 13.5px; display: flex; align-items: center; gap: 9px; width: 100%; transition: all .15s ease; text-decoration: none; font-weight: 500; }
.side nav a:hover { background: var(--panel2); color: var(--paper); }
.side nav a.active { background: var(--gold-bg); color: var(--gold); font-weight: 700; box-shadow: inset -3px 0 0 var(--gold); }
.foot { padding: 12px 16px; border-top: 1px solid var(--line); font-size: 11.5px; color: var(--muted); }
.foot form { display: inline; }
.foot button { color: var(--gold); font-size: 11.5px; padding: 0; margin-top: 4px; font-weight: 600; }
.foot button:hover { text-decoration: underline; color: var(--gold-hover); }

.main { padding: 20px 26px 36px; }
@media (max-width: 600px) { .main { padding: 14px 14px 36px; } }
.top { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.top h2 { font-size: 21px; color: var(--paper); font-weight: 700; letter-spacing: -0.2px; }
.top .dt { font-size: 12.5px; color: var(--muted); margin-top: 3px; font-weight: 500; }

/* Status Pills & Live Badges */
.pill, .live { display: inline-flex; align-items: center; gap: 7px; padding: 6px 13px; border-radius: 999px; font-size: 12px; font-weight: 600; border: 1px solid var(--line); background: var(--panel2); color: var(--paper); }
.pill .d, .live .d { width: 8px; height: 8px; border-radius: 50%; }
.pill.draft { background: var(--gold-bg); border-color: var(--line-bright); color: var(--gold); }
.pill.draft .d { background: var(--gold); box-shadow: 0 0 6px rgba(182, 255, 46, 0.5); }
.pill.pub, .live { background: var(--ok-bg); border-color: var(--ok-border); color: var(--ok); }
.pill.pub .d, .live .d { background: var(--ok); box-shadow: 0 0 6px rgba(95, 211, 138, 0.5); }
.pill.new { background: var(--panel2); color: var(--muted); border-color: var(--line); }
.pill.new .d { background: var(--muted); }
.live .d { animation: bl 1.8s infinite; }
@keyframes bl { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .35; transform: scale(0.8); } }

/* Dashboard KPI Cards */
.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
@media (max-width: 900px) { .grid { grid-template-columns: repeat(2, 1fr); gap: 10px; } }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 15px 16px; position: relative; overflow: hidden; transition: transform .15s ease, border-color .15s ease; }
.kpi:hover { border-color: var(--line-bright); transform: translateY(-1px); }
.kpi::before { content: ""; position: absolute; top: 0; inset-inline-end: 0; width: 42px; height: 3px; background: linear-gradient(90deg, var(--gold), var(--sunflower)); }
.kpi .l { font-size: 12px; color: var(--muted); font-weight: 600; margin-bottom: 5px; }
.kpi .v { font-size: 24px; font-weight: 700; font-family: 'Noto Kufi Arabic', sans-serif; line-height: 1.25; color: var(--paper); }
.kpi .c { font-size: 12px; margin-top: 5px; font-family: 'IBM Plex Mono', monospace; font-weight: 600; }
.up { color: var(--ok); } .dn { color: var(--red); } .fl { color: var(--muted); font-weight: 500; } .go { color: var(--gold); }

/* Main Cards & Content */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; margin-bottom: 16px; }
@media (max-width: 600px) { .card { padding: 14px 14px; border-radius: 12px; } }
.ch { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; border-bottom: 1px solid var(--line); padding-bottom: 10px; }
.ch h3 { font-size: 16.5px; color: var(--paper); font-weight: 700; }
.ch .sub { font-size: 12px; color: var(--muted); font-weight: 500; }

/* Tables */
.tw { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 8px; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { text-align: start; background: var(--panel2); color: var(--dim); font-weight: 600; font-size: 12.5px; padding: 10px 12px; border-bottom: 2px solid var(--line); white-space: nowrap; }
td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; color: var(--paper); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255, 255, 255, 0.03); }
tr.tot td { background: var(--gold-bg); font-weight: 700; border-top: 2px solid var(--gold); color: var(--gold); }

/* Public price table — column sizing & number alignment */
table.ptbl { table-layout: auto; width: 100%; }
table.ptbl th, table.ptbl td { padding: 11px 12px; white-space: nowrap; }
/* عمود «الصنف»: عرض طبيعي بلا التفاف، مثبَّت عند التمرير الأفقي، بفاصل واضح */
table.ptbl th.c-name, table.ptbl td:first-child {
  white-space: nowrap;
  font-weight: 700;
  color: var(--paper);
  font-size: 14px;
  padding-inline-end: 20px;
  position: sticky;
  inset-inline-start: 0;
  z-index: 1;
}
table.ptbl td:first-child { background: var(--panel); }
table.ptbl th.c-name { background: var(--panel2); }
table.ptbl tr:hover td:first-child { background: #2C3138; }
table.ptbl th.num, table.ptbl td.num { text-align: end; font-variant-numeric: tabular-nums; font-weight: 600; }
table.ptbl td.mono.num { color: var(--paper); font-size: 14px; }
table.ptbl td.c-unit { color: var(--muted); font-size: 12.5px; font-weight: 500; }
table.ptbl th:nth-child(2), table.ptbl td.c-unit,
table.ptbl th:nth-child(5), table.ptbl td:nth-child(5) { text-align: center; }
@media (max-width: 600px) {
  table.ptbl th, table.ptbl td { padding: 9px 8px; font-size: 13px; }
  table.ptbl th.c-name, table.ptbl td:first-child { font-size: 13.5px; padding-inline-end: 12px; }
  table.ptbl td.mono.num { font-size: 13px; }
}

/* Visitor counter strip (public home) */
.visit-strip { text-align: center; color: var(--muted); font-size: 12.5px; margin: 26px 0 8px; font-weight: 500; }
.visit-strip b { color: var(--paper); font-weight: 700; }
.visit-strip .sep { margin: 0 10px; color: var(--line-bright); }

/* Crop Badges & Chips */
.chip { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.c-up { background: var(--ok-bg); color: var(--ok); border: 1px solid var(--ok-border); }
.c-dn { background: var(--red-bg); color: var(--red); border: 1px solid var(--red-border); }
.c-fl { background: var(--panel2); color: var(--dim); border: 1px solid var(--line); }
.c-ex { background: var(--gold-bg); color: var(--gold); border: 1px solid var(--line-bright); }

/* Inputs & Calculators */
.inp { background: var(--ink); border: 1px solid var(--panel3); border-radius: 8px; padding: 8px 11px; color: var(--paper); font-size: 13.5px; outline: none; width: 100%; min-width: 88px; transition: all .15s ease; font-weight: 500; }
.inp:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(182, 255, 46, 0.18); }
.inp.err { border-color: var(--red); background: var(--red-bg); }
.inp.ok { border-color: var(--ok); }
.calc { background: var(--gold-bg); color: var(--gold); font-family: 'IBM Plex Mono', monospace; font-size: 13px; padding: 8px 10px; border-radius: 8px; border: 1px dashed var(--line-bright); text-align: center; min-width: 88px; font-weight: 700; }

/* Buttons */
.btn { padding: 9px 18px; border-radius: 8px; font-size: 13.5px; font-weight: 700; display: inline-flex; align-items: center; gap: 7px; transition: all .15s ease; text-decoration: none; }
.btn-p { background: var(--gold); color: var(--on-gold); box-shadow: 0 2px 10px rgba(182, 255, 46, 0.22); }
.btn-p:hover { background: var(--gold-hover); transform: translateY(-1px); }
.btn-s { background: var(--panel2); border: 1px solid var(--line); color: var(--dim); }
.btn-s:hover { border-color: var(--line-bright); background: var(--panel3); color: var(--paper); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none !important; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; align-items: center; }

/* Messages & Banners */
.flag { background: var(--gold-bg); border: 1px solid var(--line-bright); border-radius: 10px; padding: 12px 16px; font-size: 13px; color: var(--gold); margin-bottom: 16px; line-height: 1.7; display: flex; gap: 10px; align-items: flex-start; font-weight: 500; }
.flag.bad { background: var(--red-bg); border-color: var(--red-border); color: var(--red); }
.flag .ic { width: 9px; height: 10px; background: currentColor; flex-shrink: 0; margin-top: 6px; clip-path: polygon(40% 0, 100% 0, 60% 100%, 0 100%); }
.note { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; font-size: 12.5px; color: var(--dim); margin-bottom: 16px; line-height: 1.75; font-weight: 500; }
.hint { font-size: 12px; color: var(--muted); margin-top: 12px; line-height: 1.75; font-weight: 500; }
.bull { background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; border-bottom-right-radius: 4px; padding: 16px 18px; font-size: 13.5px; line-height: 1.9; max-width: 480px; white-space: pre-wrap; color: var(--paper); }

.flash { position: fixed; bottom: 22px; left: 22px; background: var(--panel3); border: 1px solid var(--line-bright); padding: 12px 20px; border-radius: 10px; font-size: 13.5px; z-index: 99; color: var(--paper); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35); font-weight: 500; }
.flash.err { background: var(--red-bg); border-color: var(--red-border); color: var(--red); }
@media (max-width: 900px) { .flash { bottom: 86px; left: 14px; right: 14px; } }

/* Authentication Box */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 22px; background: radial-gradient(circle at center, var(--panel2) 0%, var(--ink) 70%); }
.lbox { background: var(--panel); border: 1px solid var(--line-bright); border-radius: 16px; padding: 32px; width: 100%; max-width: 390px; box-shadow: 0 8px 40px rgba(0, 0, 0, 0.4); }
.lbox .lg { display: flex; align-items: center; gap: 11px; margin-bottom: 22px; }
.lbox .nm { font-family: 'IBM Plex Mono', monospace; font-size: 18px; letter-spacing: 1px; direction: ltr; line-height: 1.15; color: var(--paper); font-weight: 700; }
.lbox .sb { font-size: 11px; color: var(--gold); font-weight: 600; }
.lbox h3 { font-size: 17px; margin-bottom: 18px; color: var(--paper); font-weight: 700; }
.lbox label { display: block; font-size: 12.5px; color: var(--dim); margin-bottom: 6px; font-weight: 600; }
.lbox .fld { margin-bottom: 14px; }
.lerr { color: var(--red); font-size: 12.5px; margin-top: 10px; font-weight: 600; }
.demo { background: var(--gold-bg); border: 1px solid var(--line-bright); border-radius: 10px; padding: 12px 14px; font-size: 12px; color: var(--gold); margin-top: 18px; line-height: 1.75; font-weight: 500; }

/* Visual Charts & Graphs */
.bars { display: flex; align-items: flex-end; gap: 8px; height: 160px; margin-top: 10px; }
.bc { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.bar { width: 100%; background: var(--panel3); border-radius: 6px 6px 0 0; transition: height .3s ease; min-height: 3px; }
.bar.hi { background: linear-gradient(180deg, var(--sunflower), var(--gold)); }
.bc .lb { font-size: 11px; color: var(--dim); white-space: nowrap; font-weight: 600; }
.bc .vl { font-size: 11px; color: var(--paper); font-family: 'IBM Plex Mono', monospace; font-weight: 600; }
.lwrap { position: relative; }
svg.line { width: 100%; height: 190px; display: block; overflow: visible; }
.lg { stroke: var(--line); stroke-width: 1; }

/* Public Header Navigation — يبقى مثبَّتاً أعلى الشاشة عند التمرير */
.pub-head { position: sticky; top: 0; z-index: 50; max-width: 1080px; margin: 0 auto; padding: 16px 22px; display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; border-bottom: 1px solid var(--line); background: var(--panel); border-radius: 0 0 16px 16px; box-shadow: 0 6px 20px rgba(31, 35, 41, 0.10); }
.pub-wrap { max-width: 1080px; margin: 0 auto; padding: 22px; }
@media (max-width: 600px) {
  .pub-head { padding: 10px 14px; border-radius: 0 0 12px 12px; }
  .pub-wrap { padding: 14px 12px 36px; }
}
.pub-nav { display: flex; gap: 6px; }
.pub-nav a { padding: 8px 15px; border-radius: 8px; font-size: 13.5px; color: var(--dim); text-decoration: none; border: 1px solid transparent; transition: all .15s ease; font-weight: 500; background: var(--panel2); }
.pub-nav a:hover { color: var(--paper); background: var(--panel3); }
.pub-nav a.active { color: var(--on-gold); border-color: var(--gold); background: var(--gold); font-weight: 700; box-shadow: 0 2px 8px rgba(78, 125, 0, 0.22); }
.pub-actions { display: flex; align-items: center; gap: 8px; }
.theme-btn { width: 34px; height: 34px; border-radius: 8px; background: var(--panel2); border: 1px solid var(--line);
  color: var(--dim); font-size: 15px; display: inline-flex; align-items: center; justify-content: center; transition: all .15s ease; text-decoration: none; }
.theme-btn:hover { color: var(--paper); border-color: var(--line-bright); }

/* ——— شريط المشاركة على وسائل التواصل ——— */
.share {
  margin: 26px 0 6px; padding: 16px 18px; background: var(--panel);
  border: 1px solid var(--line); border-radius: 14px;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.share-lbl { font-size: 13px; font-weight: 700; color: var(--paper); white-space: nowrap; }
.share-lbl::before {
  content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: var(--gold); margin-inline-end: 8px; vertical-align: middle;
}
.share-btns { display: flex; gap: 8px; flex-wrap: wrap; flex: 1; }

.sb {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 14px; border-radius: 10px; font-size: 12.5px; font-weight: 600;
  color: var(--dim); background: var(--panel2); border: 1px solid var(--line);
  text-decoration: none; cursor: pointer; font-family: inherit;
  transition: transform .15s ease, background .15s ease, color .15s ease, border-color .15s ease;
}
.sb[hidden] { display: none; }  /* يتغلّب على display:inline-flex أعلاه */
.sb:hover { transform: translateY(-2px); color: var(--paper); border-color: var(--line-bright); }
.sb:active { transform: translateY(0); }
.sb:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.sb-i { display: inline-flex; line-height: 0; }

/* ألوان كل منصّة عند المرور */
.sb-wa:hover   { background: #25D366; color: #0B1F12; border-color: #25D366; }
.sb-tg:hover   { background: #29A9EB; color: #06202E; border-color: #29A9EB; }
.sb-fb:hover   { background: #1877F2; color: #FFFFFF; border-color: #1877F2; }
.sb-x:hover    { background: #EDEFEC; color: #14181C; border-color: #EDEFEC; }
.sb-copy:hover,
.sb-native:hover { background: var(--gold); color: #14181C; border-color: var(--gold); }
.sb-copy.done  { background: var(--ok-bg); color: var(--ok); border-color: var(--ok-border); }

@media (max-width: 600px) {
  .share { flex-direction: column; align-items: stretch; gap: 11px; padding: 14px; }
  .share-btns { gap: 7px; }
  .sb { flex: 1 1 auto; justify-content: center; padding: 10px 12px; }
  .sb-t { font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .sb, .sb:hover { transition: none; transform: none; }
}

/* ═══════════ ميزات أيلول 2026 ═══════════ */

/* دخول متدرّج للبطاقات — يُفعَّل فقط عند السماح بالحركة، فالمحتوى ظاهر افتراضياً */
@keyframes reveal-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: no-preference) {
  .reveal { animation: reveal-in .5s cubic-bezier(.2,.7,.3,1) both; }
  .reveal:nth-of-type(2) { animation-delay: .05s; }
  .reveal:nth-of-type(3) { animation-delay: .10s; }
  .reveal:nth-of-type(4) { animation-delay: .15s; }
  .reveal:nth-of-type(5) { animation-delay: .20s; }
  .reveal:nth-of-type(6) { animation-delay: .25s; }
  .reveal:nth-of-type(n+7) { animation-delay: .30s; }
}

/* آخر تحديث */
.upd { color: var(--gold); font-weight: 600; margin-inline-start: 4px; }

/* تصفّح الأرشيف — مجموعة مقسّمة (‹ الأقدم | التاريخ | الأحدث ›) على اليمين، «كل النشرات» على اليسار */
.arc-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.arc-pager { display: inline-flex; align-items: stretch; background: var(--panel2);
  border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.arc-pager > * + * { border-inline-start: 1px solid var(--line); }
.arc-btn { padding: 8px 14px; font-size: 12.5px; font-weight: 600; text-decoration: none; white-space: nowrap;
  background: transparent; color: var(--dim); display: inline-flex; align-items: center;
  transition: background .15s ease, color .15s ease; }
.arc-btn:hover { color: var(--paper); background: var(--panel3); }
.arc-btn.is-off { opacity: .4; pointer-events: none; }
.arc-cur { display: inline-flex; align-items: center; padding: 8px 16px; white-space: nowrap;
  font-weight: 700; color: var(--paper); font-size: 13.5px; background: var(--panel); }
.arc-all { font-size: 12.5px; color: var(--gold); text-decoration: none; font-weight: 600; white-space: nowrap; }
.arc-all:hover { text-decoration: underline; }
@media (max-width: 560px) {
  .arc-nav { justify-content: center; }
  .arc-all { order: -1; width: 100%; text-align: center; }
}

/* شبكة الأرشيف */
.arc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.arc-card { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 16px; text-decoration: none; color: inherit; transition: transform .15s ease, border-color .15s ease; overflow: hidden; }
.arc-card::before { content: ""; position: absolute; top: 0; inset-inline-end: 0; width: 42px; height: 3px;
  background: linear-gradient(90deg, var(--gold), var(--sunflower)); }
.arc-card:hover { transform: translateY(-2px); border-color: var(--line-bright); }
.arc-date { font-weight: 700; font-size: 14px; color: var(--paper); font-family: 'Noto Kufi Arabic', sans-serif; }
.arc-meta { display: flex; justify-content: space-between; align-items: baseline; margin-top: 10px; font-size: 12px; color: var(--muted); }
.arc-meta b { color: var(--paper); font-size: 15px; }
.arc-card .chip { margin-top: 10px; }

/* رابط اسم الصنف */
.crop-link { color: inherit; text-decoration: none; border-bottom: 1px dashed var(--line-bright); }
.crop-link:hover { color: var(--gold); }

/* مبدّل الصنف/المدّة في صفحة التاريخ */
.crop-switch { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 10px; }
.cs-lbl { font-size: 12px; color: var(--muted); font-weight: 600; margin-inline-end: 4px; }
.cs-chip { padding: 5px 11px; border-radius: 999px; font-size: 12px; font-weight: 600; text-decoration: none;
  background: var(--panel2); border: 1px solid var(--line); color: var(--dim); transition: all .15s ease; }
.cs-chip:hover { color: var(--paper); border-color: var(--line-bright); }
.cs-chip.is-on { background: var(--gold-bg); color: var(--gold); border-color: var(--line-bright); }

/* مفتاح ألوان الرسم */
.leg { display: flex; gap: 16px; margin-top: 12px; font-size: 12px; color: var(--dim); }
.leg span { display: inline-flex; align-items: center; gap: 6px; }
.leg i { width: 14px; height: 3px; border-radius: 2px; display: inline-block; }

/* حاسبة القيمة */
.calc-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.calc-row label { display: block; font-size: 12px; color: var(--muted); font-weight: 600; }
.calc-row .inp { margin-top: 5px; }
.calc-out { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.calc-out > div { background: var(--gold-bg); border: 1px dashed var(--line-bright); border-radius: 10px; padding: 12px 14px; }
.calc-k { display: block; font-size: 11.5px; color: var(--muted); font-weight: 600; margin-bottom: 4px; }
.calc-v { font-size: 16px; font-weight: 700; color: var(--gold); }
@media (max-width: 560px) { .calc-row, .calc-out { grid-template-columns: 1fr; } }

/* صندوق الاشتراك */
.sub-card { border-color: var(--line-bright); background: linear-gradient(180deg, var(--gold-bg), transparent), var(--panel); }
.sub-form { display: flex; gap: 8px; flex-wrap: wrap; }
.sub-form .inp { flex: 1; min-width: 180px; direction: ltr; text-align: right; }
.sub-form .btn { flex-shrink: 0; }

/* ——— تنبيهات النشرة: جرس التفعيل + تنويه «نشرة جديدة» ——— */
.mib-bell {
  position: fixed; bottom: 20px; right: 20px; z-index: 65;
  display: inline-flex; align-items: center; gap: 8px; max-width: calc(100vw - 40px);
  padding: 13px 22px; border-radius: 999px; font: inherit; font-size: 14px; font-weight: 800;
  background: var(--gold); color: var(--on-gold); border: 0; cursor: pointer; white-space: nowrap;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.38);
  transform: translateY(30px) scale(.88); opacity: 0;
  transition: transform .4s cubic-bezier(.18,.9,.3,1.2), opacity .35s ease, background .15s ease;
}
.mib-bell.show { transform: none; opacity: 1; animation: mib-bell-pop .55s cubic-bezier(.2,.9,.3,1.4); }
.mib-bell:hover { background: var(--gold-hover); }
.mib-bell:active { transform: scale(.95); }
.mib-bell:focus-visible { outline: 3px solid var(--paper); outline-offset: 3px; }

/* حلقة نابضة تلفت الانتباه */
.mib-bell::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; z-index: -1;
  box-shadow: 0 0 0 2px var(--gold);
}
.mib-bell.show::after { animation: mib-halo 2s ease-out infinite; }

/* رنين الجرس */
.mib-bell-i { display: inline-block; font-size: 18px; line-height: 1; transform-origin: 50% 12%; }
.mib-bell.show .mib-bell-i { animation: mib-ring 3s ease-in-out .8s infinite; }
.mib-bell.attn .mib-bell-i { animation: mib-ring 1s ease-in-out infinite; }
.mib-bell:hover .mib-bell-i,
.mib-bell:hover::after { animation-play-state: paused; }

/* فقاعة النداء فوق الجرس */
.mib-bell-cal {
  position: fixed; bottom: 76px; right: 20px; z-index: 66;
  max-width: min(300px, calc(100vw - 40px));
  display: flex; align-items: flex-start; gap: 8px; cursor: pointer;
  padding: 12px 14px; border-radius: 14px; font-size: 12.5px; font-weight: 600; line-height: 1.7;
  background: var(--panel); color: var(--paper); border: 1px solid var(--line-bright);
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.44);
  transform: translateY(12px) scale(.95); opacity: 0;
  transition: transform .35s cubic-bezier(.18,.9,.3,1.2), opacity .3s ease;
}
.mib-bell-cal.in { transform: none; opacity: 1; }
.mib-bell-cal::after {
  content: ""; position: absolute; bottom: -7px; right: 28px; width: 13px; height: 13px;
  background: var(--panel); border-right: 1px solid var(--line-bright); border-bottom: 1px solid var(--line-bright);
  transform: rotate(45deg);
}
.mib-bell-cal-x {
  flex-shrink: 0; width: 20px; height: 20px; border-radius: 50%;
  font-size: 14px; line-height: 18px; color: var(--muted); background: var(--panel2);
}
.mib-bell-cal-x:hover { color: var(--paper); }
@media (max-width: 480px) {
  .mib-bell-cal { left: 14px; right: 14px; max-width: none; bottom: 80px; }
  .mib-bell-cal::after { right: auto; left: 50%; margin-inline-start: -6px; }
}
@media (prefers-reduced-motion: reduce) {
  .mib-bell-cal { transition: none; }
  .mib-bell.attn .mib-bell-i { animation: none; }
}

@keyframes mib-bell-pop {
  0% { transform: scale(.6); } 60% { transform: scale(1.12); } 100% { transform: scale(1); }
}
@keyframes mib-halo {
  0%   { opacity: .55; transform: scale(1); }
  70%  { opacity: 0;   transform: scale(1.7); }
  100% { opacity: 0;   transform: scale(1.7); }
}
@keyframes mib-ring {
  0%, 55%, 100% { transform: rotate(0); }
  58% { transform: rotate(22deg); }  62% { transform: rotate(-18deg); }
  66% { transform: rotate(13deg); }  70% { transform: rotate(-9deg); }
  74% { transform: rotate(6deg); }   78% { transform: rotate(-3deg); }
  82% { transform: rotate(0); }
}

.mib-toast {
  position: fixed; inset-block-start: 74px; inset-inline: 14px; z-index: 60; margin: 0 auto;
  max-width: 420px; text-align: center; text-decoration: none;
  padding: 12px 16px; border-radius: 12px; font-size: 13px; font-weight: 600;
  background: var(--panel3); color: var(--paper); border: 1px solid var(--line-bright);
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.35);
  transform: translateY(-16px); opacity: 0; transition: transform .35s ease, opacity .35s ease;
}
.mib-toast.in { transform: none; opacity: 1; }
@media (max-width: 480px) {
  .mib-bell { left: 14px; right: 14px; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) {
  .mib-bell, .mib-toast { transition: none; }
  .mib-bell.show, .mib-bell.show::after, .mib-bell.show .mib-bell-i { animation: none; }
}

/* ═══════════════════ تطبيق الجوّال (PWA) ═══════════════════ */

/* حواف الشاشة الآمنة + إحساس تطبيق أصلي */
body {
  padding-bottom: env(safe-area-inset-bottom);
  overscroll-behavior-y: none;
  -webkit-tap-highlight-color: transparent;
}
@supports (padding: max(0px)) {
  .pub-head { padding-inline: max(22px, env(safe-area-inset-left)) max(22px, env(safe-area-inset-right)); }
}
.btn, .pub-nav a, .tab, .sb, .arc-btn, .cs-chip { touch-action: manipulation; }
.btn:active, .arc-card:active, .kpi:active, .sb:active, .cs-chip:active { transform: scale(0.985); }

/* وضع standalone (مُثبَّت على الشاشة الرئيسية) */
:root[data-standalone="1"] .pub-head {
  padding-top: max(12px, env(safe-area-inset-top));
  border-radius: 0;
}
:root[data-standalone="1"] .pub-actions a[href="/login"] { display: none; }  /* لا حاجة للوحة الإدخال داخل التطبيق */

/* ——— شريط التنقّل السفلي — جوّال فقط ——— */
.tabbar { display: none; }
@media (max-width: 640px) {
  .pub-head .pub-nav { display: none; }
  .pub-head { position: sticky; }

  .tabbar {
    position: fixed; inset-inline: 0; bottom: 0; z-index: 60;
    display: grid; grid-template-columns: repeat(3, 1fr);
    background: var(--panel);
    border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -6px 20px rgba(31, 35, 41, 0.10);
  }
  .tab {
    position: relative;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    padding: 9px 4px 8px; min-height: 56px;
    color: var(--muted); text-decoration: none;
    font-size: 11px; font-weight: 600; letter-spacing: -0.1px;
    transition: color .15s ease;
  }
  .tab svg { opacity: .75; transition: opacity .15s ease, transform .15s ease; }
  .tab:active svg { transform: scale(0.9); }
  .tab.is-on { color: var(--gold); }
  .tab.is-on svg { opacity: 1; }
  .tab.is-on::before {
    content: ""; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
    width: 26px; height: 3px; border-radius: 0 0 3px 3px; background: var(--gold);
  }

  /* أفسح مكاناً للشريط + ارفع العناصر العائمة فوقه */
  .pub-wrap { padding-bottom: calc(72px + env(safe-area-inset-bottom)) !important; }
  .mib-bell { bottom: calc(74px + env(safe-area-inset-bottom)); }
  .mib-bell-cal { bottom: calc(130px + env(safe-area-inset-bottom)); }
  .flash { bottom: calc(74px + env(safe-area-inset-bottom)); }
  .visit-strip { margin-bottom: 0; }
}

/* ——— دعوة تثبيت التطبيق (Android / سطح المكتب) — شريط علوي واضح ——— */
.mib-install {
  position: fixed; z-index: 68; inset-inline: 0; top: 0;
  display: flex; align-items: center; gap: 12px;
  background: linear-gradient(180deg, var(--gold-bg), var(--panel) 60%), var(--panel);
  border-bottom: 1px solid var(--line-bright);
  padding: 12px 16px; padding-top: max(12px, env(safe-area-inset-top));
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.22);
  transform: translateY(-100%); opacity: 0;
  transition: transform .35s cubic-bezier(.18,.9,.3,1.2), opacity .3s ease;
}
.mib-install.in { transform: none; opacity: 1; }
.mib-install-i {
  flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--gold); color: var(--on-gold); font-size: 18px; font-weight: 900;
}
.mib-install-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.mib-install-t { font-size: 14.5px; font-weight: 800; color: var(--paper); }
.mib-install-s { font-size: 12px; color: var(--muted); }
.mib-install-go {
  flex-shrink: 0; font: inherit; font-size: 13.5px; font-weight: 800;
  color: var(--on-gold); background: var(--gold); border-radius: 10px;
  padding: 10px 18px; box-shadow: 0 4px 14px rgba(78, 125, 0, 0.3);
}
.mib-install-go:hover { background: var(--gold-hover); }
.mib-install-x {
  flex-shrink: 0; width: 30px; height: 30px; border-radius: 50%;
  font-size: 17px; line-height: 1; color: var(--muted); background: var(--panel2);
}
.mib-install-x:hover { color: var(--paper); }
@media (max-width: 640px) {
  .mib-install-s { display: none; }
  .mib-install-t { font-size: 13.5px; }
  .mib-install-go { padding: 9px 14px; }
}

/* ——— تلميح iOS: أضف إلى الشاشة الرئيسية ——— */
.mib-ios-tip {
  position: fixed; z-index: 67; inset-inline: 14px; bottom: 14px;
  max-width: 420px; margin: 0 auto;
  background: var(--panel); border: 1px solid var(--line-bright); border-radius: 16px;
  padding: 14px 16px; box-shadow: 0 18px 44px rgba(0, 0, 0, 0.46);
  transform: translateY(20px); opacity: 0;
  transition: transform .35s cubic-bezier(.18,.9,.3,1.2), opacity .3s ease;
}
.mib-ios-tip.in { transform: none; opacity: 1; }
.mib-ios-tip-b { display: flex; flex-direction: column; gap: 4px; padding-inline-end: 22px; }
.mib-ios-tip-b b { font-size: 13.5px; color: var(--paper); font-weight: 800; }
.mib-ios-tip-b span { font-size: 12.5px; color: var(--dim); line-height: 1.7; }
.mib-ios-tip-x {
  position: absolute; inset-block-start: 10px; inset-inline-end: 10px;
  width: 24px; height: 24px; border-radius: 50%;
  font-size: 15px; line-height: 1; color: var(--muted); background: var(--panel2);
}
.mib-ios-share {
  display: inline-block; width: 12px; height: 12px; vertical-align: -2px;
  background: currentColor; color: var(--gold);
  -webkit-mask: no-repeat center / contain; mask: no-repeat center / contain;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 3l4 4h-3v9h-2V7H8l4-4zM5 12h2v7h10v-7h2v7a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-7z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 3l4 4h-3v9h-2V7H8l4-4zM5 12h2v7h10v-7h2v7a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-7z'/%3E%3C/svg%3E");
}

/* زرّ داخل mib-toast (تحديث جاهز) */
button.mib-toast { border: 1px solid var(--line-bright); cursor: pointer; font: inherit; }

@media (prefers-reduced-motion: reduce) {
  .mib-install, .mib-ios-tip { transition: none; }
}

/* ——— بطاقة «حمّل التطبيق» ——— */
.get-app { border-color: var(--line-bright); background: linear-gradient(180deg, var(--gold-bg), transparent), var(--panel); }
.ga-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.ga-install[hidden] { display: none; }
.store-badge {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 7px 16px; min-height: 46px; border-radius: 11px;
  background: #000; color: #fff; text-decoration: none;
  border: 1px solid rgba(255, 255, 255, 0.16);
  transition: transform .15s ease, border-color .15s ease;
}
.store-badge:hover { transform: translateY(-2px); border-color: rgba(255, 255, 255, 0.4); }
.store-badge:active { transform: translateY(0); }
.store-badge svg { flex-shrink: 0; }
.store-badge span { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.15; }
.store-badge small { font-size: 8.5px; letter-spacing: .6px; text-transform: uppercase; opacity: .82; }
.store-badge b { font-size: 15px; font-weight: 700; }
.ga-hint span { font-family: 'IBM Plex Mono', monospace; }
@media (max-width: 600px) {
  .ga-row { gap: 8px; }
  .ga-install, .store-badge { flex: 1 1 150px; justify-content: center; }
}

/* صفحة /download */
.dl-meta { margin-top: 12px; font-size: 11.5px; color: var(--muted); display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.dl-meta .sep { color: var(--line-bright); }
.dl-meta code { background: var(--panel2); border: 1px solid var(--line); border-radius: 6px; padding: 2px 7px; color: var(--dim); }
.dl-steps { margin: 16px 0 4px; padding-inline-start: 20px; font-size: 13px; color: var(--paper); line-height: 1.95; }
.dl-steps li { margin-bottom: 3px; }

/* تلميح إمكانية التمرير الأفقي للجداول على الشاشات الضيّقة */
@media (max-width: 600px) {
  .tw {
    background:
      linear-gradient(to right, var(--panel) 30%, rgba(39, 44, 51, 0)) left / 28px 100% no-repeat,
      linear-gradient(to left, var(--panel) 30%, rgba(39, 44, 51, 0)) right / 28px 100% no-repeat,
      radial-gradient(farthest-side at 0 50%, rgba(0, 0, 0, 0.28), rgba(0, 0, 0, 0)) left / 14px 100% no-repeat,
      radial-gradient(farthest-side at 100% 50%, rgba(0, 0, 0, 0.28), rgba(0, 0, 0, 0)) right / 14px 100% no-repeat;
    background-attachment: local, local, scroll, scroll;
  }
}
