/* لوحة الإحصائيات — للحاسوب فقط؛ على الهاتف يُخفى التبويب والقسم كلاهما */
@media (max-width: 900px) { .desktop-only { display: none !important; } }

.st-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 18px; align-items: start; }
.st-main { display: grid; gap: 16px; min-width: 0; }
.st-side { position: sticky; top: 84px; }
.st-card h3 { margin: 0 0 10px; font-size: 15px; font-weight: 800; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.st-card h3 small { color: var(--ink-soft); font-weight: 600; font-size: 12px; }

/* الفلاتر */
.st-filters { display: grid; gap: 10px; }
.st-presets { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.st-presets .btn.is-on { background: var(--brand-grad); color: #fff; border-color: transparent; box-shadow: 0 6px 18px rgba(34, 211, 238, .25); }
.st-date { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-soft); }
.st-date input { width: 150px; padding: 6px 8px; }
.st-selects { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.st-selects label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-soft); }
.st-selects select { min-width: 160px; padding: 6px 8px; }
.st-range-label { font-size: 12.5px; color: var(--brand-dark); font-weight: 700; margin-inline-start: auto; }

/* المربعات */
.st-kpis { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
.st-kpi { position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px 10px; background: var(--surface); backdrop-filter: var(--blur); animation: stPop .5s var(--ease-spring) both; }
.st-kpi::before { content: ''; position: absolute; inset: 0 0 auto; height: 3px; background: var(--brand-grad); opacity: .9; }
.st-kpi.ok::before { background: linear-gradient(90deg, #22c55e, #86efac); }
.st-kpi.bad::before { background: linear-gradient(90deg, #e0445b, #fca5a5); }
.st-kpi.warn::before { background: linear-gradient(90deg, #f59e0b, #fde68a); }
.st-kpi.fees::before { background: linear-gradient(90deg, #8b5cf6, #c4b5fd); }
.st-kpi b { display: block; font-size: 22px; font-weight: 900; letter-spacing: -.01em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.st-kpi span { display: block; font-size: 12px; color: var(--ink-soft); margin-top: 4px; }
.st-kpi small { position: absolute; top: 10px; left: 12px; font-size: 11px; color: var(--ink-faint); font-weight: 700; }
@keyframes stPop { from { opacity: 0; transform: translateY(10px) scale(.97); } to { opacity: 1; transform: none; } }

/* الشبكة */
.st-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.st-span2 { grid-column: 1 / -1; }
.st-chart svg, .st-histo, .st-line { width: 100%; height: auto; display: block; }
.st-empty { color: var(--ink-faint); font-size: 13px; text-align: center; padding: 18px 0; margin: 0; }
.st-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--ink-soft); margin-top: 8px; align-items: center; }
.st-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-inline-end: 6px; vertical-align: -1px; }
.st-legend i.delivered, .st-legend i.orders { background: var(--brand); }
.st-legend i.orders { background: var(--brand); }
.st-legend i.delivered { background: #22c55e; }
.st-legend i.returned { background: #e0445b; }
.st-legend i.pending { background: #f59e0b; }
.st-legend i.company { background: var(--brand); }
.st-legend i.self { background: #a78bfa; }
.st-legend-h { margin-inline-start: auto; font-weight: 700; color: var(--ink); }

/* الحلقة */
.st-donut { display: grid; gap: 6px; justify-items: center; }
.st-ring { width: 180px; height: 180px; display: block; }
.st-ring .ring-bg { fill: none; stroke: var(--line); stroke-width: 14; }
.st-ring .ring { fill: none; stroke-width: 14; stroke-linecap: butt; transition: stroke-dasharray 1.1s cubic-bezier(.2, .7, .2, 1); }
.st-ring .ring.delivered { stroke: #22c55e; }
.st-ring .ring.returned { stroke: #e0445b; }
.st-ring .ring.pending { stroke: #f59e0b; }
.st-ring .ring-big { fill: var(--ink); font-size: 26px; font-weight: 900; font-family: inherit; }
.st-ring .ring-small { fill: var(--ink-soft); font-size: 11px; font-family: inherit; }

/* الخط الزمني */
.st-line .grid { stroke: var(--line-soft); stroke-width: 1; }
.st-line .axis { fill: var(--ink-faint); font-size: 10px; font-family: inherit; }
.st-line .area { fill: url(#none); fill: rgba(34, 211, 238, .12); }
.st-line .series { fill: none; stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; transition: stroke-dashoffset 1.4s ease-out; }
.st-line .series.orders { stroke: var(--brand); }
.st-line .series.delivered { stroke: #22c55e; }
.st-line .series.returned { stroke: #e0445b; }
.st-line .dot { opacity: .9; }
.st-line .dot.orders { fill: var(--brand); }
.st-line .dot.delivered { fill: #22c55e; }
.st-line .dot.returned { fill: #e0445b; }
.st-line .dot:hover { r: 5; }

/* أعمدة أفقية */
.st-bars { display: grid; gap: 7px; }
.st-bar { display: grid; grid-template-columns: 150px 1fr 120px; align-items: center; gap: 10px; font-size: 12.5px; }
.st-bar-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); font-weight: 700; }
.st-bar-track { height: 12px; border-radius: 999px; background: var(--line-soft); overflow: hidden; }
.st-bar-track i { display: block; height: 100%; width: 0; border-radius: 999px; background: var(--brand-grad); transition: width 1s cubic-bezier(.2, .7, .2, 1); }
.st-bar-track i.reason { background: linear-gradient(90deg, #e0445b, #fb923c); }
.st-bar-track i.speed { background: linear-gradient(90deg, #22c55e, #22d3ee); }
.st-bar b { font-weight: 700; color: var(--ink-soft); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left; direction: rtl; }

/* سرعة التوصيل */
.st-scale { margin-inline-start: auto; font-size: 12px; color: var(--ink-soft); display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.st-scale input { width: 150px; padding: 4px 8px; font-size: 12.5px; }
.st-speed-row { display: grid; grid-template-columns: 1.2fr 1fr; gap: 18px; align-items: start; }
.st-histo .axis { fill: var(--ink-faint); font-size: 10px; font-family: inherit; }
.st-histo .axis.strong { fill: var(--ink); font-weight: 800; font-size: 12px; }
.st-histo rect { transition: y .9s cubic-bezier(.2, .7, .2, 1), height .9s cubic-bezier(.2, .7, .2, 1); }
.st-histo .h-company { fill: var(--brand); }
.st-histo .h-self { fill: #a78bfa; }

/* التصدير */
.st-export-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.st-export .muted { margin: 8px 0 0; font-size: 12px; }

/* الخارطة */
.st-map { position: relative; }
.st-iraq { width: 100%; height: auto; display: block; filter: drop-shadow(0 12px 24px rgba(0, 0, 0, .35)); }
.st-iraq .gov { cursor: pointer; }
.st-iraq .gov-shape { fill: var(--brand); stroke: rgba(255, 255, 255, .55); stroke-width: 1.2; stroke-linejoin: round; transition: fill-opacity .3s, filter .3s; }
:root[data-theme="light"] .st-iraq .gov-shape { stroke: rgba(16, 25, 43, .55); }
.st-iraq .gov.lit .gov-shape, .st-iraq .gov.active .gov-shape { fill-opacity: .85 !important; filter: drop-shadow(0 0 10px var(--brand)); }
.st-iraq .gov.active .gov-shape { stroke: #fff; stroke-width: 2.2; }
.st-iraq .gov-name { fill: var(--ink); font-size: 12px; font-weight: 800; font-family: inherit; pointer-events: none; paint-order: stroke; stroke: var(--bg); stroke-width: 3px; stroke-linejoin: round; }
.st-iraq .gov-dot { fill: #fff; stroke: var(--brand); stroke-width: 2; transition: r .2s, fill .2s; }
.st-iraq .gov.lit .gov-dot, .st-iraq .gov.active .gov-dot { fill: var(--gold); stroke: #fff; r: 6.5; }
.st-iraq .gov-pulse { fill: none; stroke: var(--brand); stroke-width: 2; opacity: 0; animation: stPulse 2.6s ease-out infinite; pointer-events: none; }
@keyframes stPulse { 0% { r: 4.5; opacity: .9; } 100% { r: 18; opacity: 0; } }
.st-gov-panel { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 12px; animation: stPop .35s var(--ease-spring) both; }
.st-gov-panel h4 { margin: 0 0 8px; font-size: 16px; font-weight: 900; display: flex; align-items: baseline; gap: 10px; }
.st-gov-panel h4 small { font-size: 12px; color: var(--ink-soft); font-weight: 600; }
.st-stack { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: var(--line-soft); margin-bottom: 10px; }
.st-stack i { display: block; width: 0; transition: width .9s cubic-bezier(.2, .7, .2, 1); }
.st-stack i.delivered { background: #22c55e; } .st-stack i.returned { background: #e0445b; } .st-stack i.pending { background: #f59e0b; }
.st-gov-nums { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 10px; }
.st-gov-nums div { border: 1px solid var(--line-soft); border-radius: 12px; padding: 8px; text-align: center; background: var(--surface-2); }
.st-gov-nums b { display: block; font-size: 17px; font-weight: 900; font-variant-numeric: tabular-nums; }
.st-gov-nums b.ok { color: var(--ok); } .st-gov-nums b.bad { color: var(--danger); } .st-gov-nums b.warn { color: var(--warn); }
.st-gov-nums span { font-size: 11px; color: var(--ink-soft); }
.st-gov-reasons { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12px; color: var(--ink-soft); margin-bottom: 10px; }
.st-gov-reasons em { font-style: normal; background: var(--danger-bg); border: 1px solid var(--danger-line); color: var(--ink); border-radius: 999px; padding: 2px 9px; }
.st-gov-reasons em b { color: var(--danger); margin-inline-start: 4px; }

@media (max-width: 1200px) { .st-wrap { grid-template-columns: 1fr; } .st-side { position: static; } .st-kpis { grid-template-columns: repeat(4, 1fr); } }
@media (prefers-reduced-motion: reduce) { .st-kpi, .st-gov-panel { animation: none; } .st-iraq .gov-pulse { animation: none; } }
