/* اتنقل من templates/data_sources.html عشان المتصفح يخزّنه (Cache) */
.ds-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); margin-bottom: 8px; }
.ds-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 18px; border-top: 3px solid var(--brand); }
.ds-card h3 { margin: 0 0 6px; font-size: 1.02rem; color: var(--brand); }
.chip { display: inline-block; font-size: 0.78rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; }
.chip.ok, .chip.fresh { background: var(--gain-wash); color: var(--gain); }
.chip.warn, .chip.partial, .chip.awaiting_verification { background: var(--gold-wash); color: #7A5310; }
.chip.cost, .chip.stale { background: var(--cost-wash); color: var(--cost); }
.chip.neutral, .chip.empty { background: var(--surface-soft); color: var(--ink-soft); }
.ds-table td, .ds-table th { font-family: var(--font-body); text-align: start; vertical-align: top; }
.ds-table td.num-cell { font-family: var(--font-mono); direction: ltr; }

/* ---------- كروت حداثة البيانات ---------- */
.ds-card { display: flex; flex-direction: column; gap: 2px; box-shadow: var(--shadow-sm); }
.ds-card.is-fresh { border-top-color: var(--gain); }
.ds-card.is-partial { border-top-color: var(--gold-bright); }
.ds-card.is-stale { border-top-color: var(--cost); }
.ds-card.is-cbe { border-top-color: var(--gold-bright); }
.ds-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.ds-card-head h3 { margin: 0; }
.ds-card-head .chip { flex: none; }
.ds-date { margin: 12px 0 0; font-family: var(--font-mono); font-size: 1.35rem; font-weight: 700; color: var(--ink); }
.ds-sub { margin: 0; font-size: 0.8rem; color: var(--ink-faint); }
time.date, .date { direction: ltr; unicode-bidi: isolate; font-family: var(--font-mono); white-space: nowrap; }
.ds-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.nbadge { display: inline-flex; align-items: baseline; gap: 4px; padding: 3px 10px; border-radius: 999px; font-size: 0.78rem; font-weight: 600; border: 1px solid transparent; }
.nbadge b { font-family: var(--font-mono); font-size: 0.92rem; }
.nbadge.ok { background: var(--gain-wash); color: var(--gain); }
.nbadge.warn { background: var(--gold-wash); color: #7A5310; }
.nbadge.cost { background: var(--cost-wash); color: var(--cost); }
.nbadge.neutral { background: var(--surface-soft); color: var(--ink-soft); border-color: var(--line); }
.ds-facts { margin: 12px 0 0; display: grid; gap: 6px; }
.ds-facts div { display: flex; justify-content: space-between; gap: 10px; padding-bottom: 6px; border-bottom: 1px dashed var(--line); font-size: 0.84rem; }
.ds-facts div:last-child { border-bottom: 0; padding-bottom: 0; }
.ds-facts dt { color: var(--ink-soft); }
.ds-facts dd { margin: 0; font-weight: 600; text-align: end; }
.ds-facts dd small { display: block; font-weight: 400; color: var(--ink-faint); font-size: 0.74rem; }

/* ---------- درجات الموثوقية ---------- */
.tier-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.tier { --tc: var(--brand); --tw: var(--brand-wash); position: relative; overflow: hidden; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-md); padding: 18px 18px 16px; box-shadow: var(--shadow-sm); }
.tier::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--tc); }
.tier-ok { --tc: var(--gain); --tw: var(--gain-wash); }
.tier-warn { --tc: #C8901F; --tw: var(--gold-wash); }
.tier-muted { --tc: #7C8899; --tw: var(--surface-soft); }
.tier-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.tier-ic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--tw); color: var(--tc); }
.tier-num { font-family: var(--font-display); font-size: 2rem; font-weight: 800; color: var(--tc); line-height: 1; display: inline-flex; align-items: baseline; gap: 5px; }
.tier-num small { font-family: var(--font-body); font-size: 0.78rem; font-weight: 600; color: var(--ink-faint); }
.tier h3 { margin: 0 0 6px; font-size: 1.05rem; color: var(--ink); }
.tier p { margin: 0; font-size: 0.88rem; line-height: 1.8; color: var(--ink-soft); }

/* ---------- مراحل نشر أي رقم (تحت كروت الموثوقية) ---------- */
.callout-steps { margin: 18px 0 0; padding: 0; list-style: none; counter-reset: st; display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.callout-steps li { counter-increment: st; position: relative; padding: 10px 12px 10px 12px; padding-inline-start: 40px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-sm); font-size: 0.85rem; line-height: 1.7; }
.callout-steps li::before { content: counter(st); position: absolute; inset-inline-start: 10px; top: 10px; width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center; background: var(--brand); color: #fff; font-size: 0.75rem; font-weight: 700; }

/* ---------- جدول المصادر ---------- */
.src-link { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; color: var(--brand); text-decoration: none; border-bottom: 1px dashed currentColor; }
.src-link:hover { color: var(--brand-bright); border-bottom-style: solid; }
.src-link .ext { flex: none; opacity: 0.75; }
/* الموبايل: كل مصدر كارت صغير بدل صف جدول (الاسم كان بيتكسر كلمة في كل سطر وآخر عمود بيتقص) */
@media (max-width: 640px) {
  .src-table thead { display: none; }
  .src-table, .src-table tbody { display: block; }
  .src-table tr { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; padding: 12px 4px; border-bottom: 1px solid var(--line); }
  .src-table td { display: block; padding: 0; border: 0; }
  .src-table td:first-child { grid-column: 1; }
  .src-table td:nth-child(2) { grid-column: 2; grid-row: 1; justify-self: end; }
  .src-table td[data-label] { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 0.84rem; white-space: normal; }
  .src-table td[data-label]::before { content: attr(data-label); color: var(--ink-faint); font-size: 0.78rem; }
}

/* ---------- آخر تغيّرات الأسعار ---------- */
.chg-filters { display: grid; grid-template-columns: minmax(220px, 2fr) repeat(2, minmax(150px, 1fr)); gap: 10px 12px; align-items: end; margin-bottom: 12px; }
.chg-filters[hidden] { display: none; }
.chg-filters .field { margin: 0; }
.chg-count { grid-column: 1 / -1; margin: 0; font-size: 0.8rem; color: var(--ink-faint); }
.chg-table { table-layout: fixed; width: 100%; }
.chg-table th, .chg-table td { padding: 14px 12px; text-align: right; vertical-align: top; line-height: 1.7; }
.chg-table th:nth-child(1) { width: 112px; }
.chg-table th:nth-child(2) { width: 26%; }
.chg-table th:nth-child(3) { width: 150px; }
.chg-table tbody tr + tr td { border-top: 1px solid var(--line); }
.chg-date { white-space: nowrap; font-size: 0.85rem; }
.chg-who b { display: block; color: var(--ink); }
.chg-who span { display: block; font-size: 0.86rem; color: var(--ink-soft); }
.chg-src { display: inline-block; margin-top: 4px; font-size: 0.76rem; color: var(--brand-bright); }
.chg-src-secondary { color: var(--ink-faint); }
.act-badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 0.76rem; font-weight: 700; }
.act-added { background: #DCFCE7; color: #166534; }
.act-changed { background: #FEF3C7; color: #92400E; }
.act-removed { background: #FEE2E2; color: #991B1B; }
.kind-tag { display: block; margin-top: 6px; font-size: 0.76rem; color: var(--ink-faint); }
.chg-items { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.chg-item { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 5px 10px; border-radius: 8px; background: var(--surface-soft); font-size: 0.86rem; }
.chg-item.is-same { opacity: 0.6; }
.chg-item.is-gone { background: #FEF2F2; }
.chg-lbl { color: var(--ink-soft); }
.chg-val { display: inline-flex; align-items: baseline; gap: 6px; white-space: nowrap; }
.chg-val .n { direction: ltr; unicode-bidi: isolate; font-family: var(--font-mono); }
.chg-val b { color: var(--ink); }
.chg-val s { color: var(--ink-faint); }
.chg-val small { color: #991B1B; font-size: 0.72rem; }
.chg-arrow { color: var(--ink-faint); }
.chg-dir { font-size: 0.7rem; }
.chg-dir.up { color: #166534; }
.chg-dir.down { color: #991B1B; }
.chg-more { margin-top: 6px; }
.chg-more summary { cursor: pointer; font-size: 0.8rem; font-weight: 600; color: var(--brand); }
.chg-more .chg-items { margin-top: 6px; }
.chg-note { margin: 6px 0 0; font-size: 0.78rem; color: var(--ink-faint); }
.chg-more-btn { margin-top: 12px; }
@media (max-width: 760px) {
  .chg-filters { grid-template-columns: 1fr 1fr; }
  .chg-search { grid-column: 1 / -1; }
  .chg-table thead { display: none; }
  .chg-table, .chg-table tbody, .chg-table tr, .chg-table td { display: block; width: auto; }
  .chg-table tr { padding: 12px 2px; }
  .chg-table tbody tr + tr td { border-top: 0; }
  .chg-table tbody tr + tr { border-top: 1px solid var(--line); }
  .chg-table td { padding: 4px 0; }
  .chg-date { font-size: 0.78rem; color: var(--ink-faint); }
}
.chg-table tr[hidden] { display: none !important; }
