/* styles.css — تخطيط لوحة متابعة جمعية رقيم — تصميم v1.4 الاحترافي */

#app-root {
  width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* -------------------- شريط الإعدادات العلوي -------------------- */
.admin-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(105deg, var(--raqeem-primary-dark) 0%, #1A2A6E 55%, var(--raqeem-primary) 100%);
  color: #fff;
  padding: 10px 22px;
  font-size: 16px;
  box-shadow: 0 4px 20px rgba(18, 28, 74, 0.22);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  position: relative;
  z-index: 20;
}
.admin-bar::after {
  content: "";
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--raqeem-cyan), var(--raqeem-secondary), transparent);
  opacity: 0.85;
}
.admin-bar button,
.admin-bar select,
.admin-bar label {
  font-family: var(--font-arabic);
  font-size: 15px;
}
.admin-bar .spacer { flex: 1; }
.admin-bar select {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  backdrop-filter: blur(8px);
}
.admin-bar select option { color: var(--raqeem-ink); background: #fff; }

.btn {
  background: var(--raqeem-secondary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 7px 16px;
  cursor: pointer;
  font-weight: 700;
  letter-spacing: -0.01em;
  transition: background var(--duration-fast) ease, transform var(--duration-fast) ease, box-shadow var(--duration-fast) ease;
  box-shadow: 0 2px 8px rgba(59, 127, 232, 0.28);
}
.btn:hover {
  background: #2F6FD4;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 127, 232, 0.35);
}
.btn:active { transform: translateY(0); }
.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
.btn-present {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.btn-present-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: block;
}
.btn.ghost {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.4);
  box-shadow: none;
}
.btn.ghost:hover {
  background: rgba(255, 255, 255, 0.12);
  box-shadow: none;
}
.file-input-label {
  background: rgba(255, 255, 255, 0.12);
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.18);
  transition: background var(--duration-fast) ease;
}
.file-input-label:hover { background: rgba(255, 255, 255, 0.2); }
.file-input-label input { display: none; }

/* -------------------- الحاوية القابلة للتحجيم لعرض التلفاز -------------------- */
#scale-stage {
  position: relative;
  width: 1920px;
  height: 1080px;
  transform-origin: top center;
  margin: 0 auto;
  background: var(--raqeem-surface-alt);
  flex: 1;
  transition: opacity 0.18s ease;
}
@media (prefers-reduced-motion: reduce) {
  #scale-stage { transition: none; }
}
body.fit-height #stage-wrapper {
  overflow: hidden;
  display: flex;
  justify-content: center;
}

/* -------------------- الوضع العادي في المتصفح -------------------- */
.dash-normal-view {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 16px 48px;
}
.dash-normal-view .exec-body { height: auto; }
.dash-normal-view .detail-body { height: auto; }

/* -------------------- الرأس -------------------- */
.dash-header {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 18px 28px 18px 24px;
  margin: 16px 0 0;
  background:
    linear-gradient(115deg, #FFFFFF 0%, #F7F9FF 42%, #EAF0FF 100%);
  border: 1px solid rgba(213, 221, 235, 0.95);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-header);
  position: relative;
  overflow: hidden;
}
.dash-header::before {
  content: "";
  position: absolute;
  inset-inline-end: 0;
  top: 0;
  bottom: 0;
  width: 5px;
  background: linear-gradient(180deg, var(--raqeem-primary), var(--raqeem-secondary), var(--raqeem-cyan));
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
}
.dash-header::after {
  content: "";
  position: absolute;
  inset-inline-start: 35%;
  top: -80%;
  width: 280px;
  height: 280px;
  background: radial-gradient(circle, rgba(59, 127, 232, 0.10) 0%, transparent 68%);
  pointer-events: none;
}
.header-brand {
  position: relative;
  z-index: 1;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 84px;
  height: 84px;
  border-radius: 18px;
  background: linear-gradient(160deg, #FFFFFF 0%, #EEF3FF 100%);
  border: 1px solid rgba(213, 221, 235, 0.9);
  box-shadow: var(--shadow-xs);
}
.dash-header img.logo {
  height: 58px;
  width: auto;
  max-width: 68px;
  object-fit: contain;
  filter: drop-shadow(0 3px 8px rgba(44, 63, 160, 0.12));
}
.dash-header .title-block {
  flex: 1;
  position: relative;
  z-index: 1;
  min-width: 0;
}
.header-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(44, 63, 160, 0.08);
  color: var(--raqeem-primary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.header-eyebrow::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--raqeem-secondary);
  box-shadow: 0 0 0 3px rgba(59, 127, 232, 0.2);
}
.dash-header h1 {
  margin: 0;
  font-size: clamp(20px, 1.85vw, 26px);
  font-weight: 800;
  color: var(--raqeem-primary-dark);
  letter-spacing: -0.025em;
  line-height: 1.35;
}
.dash-header .subtitle {
  margin-top: 12px;
  font-size: 14px;
  color: var(--raqeem-muted);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.header-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--raqeem-border);
  border-radius: 999px;
  padding: 5px 12px 5px 10px;
  font-weight: 600;
  font-size: 13px;
  color: var(--raqeem-ink-soft);
  box-shadow: var(--shadow-xs);
  line-height: 1.3;
}
.header-badge-icon {
  display: inline-flex;
  width: 16px;
  height: 16px;
  color: var(--raqeem-secondary);
  flex-shrink: 0;
}
.header-badge-icon svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}
.header-badge-text { min-width: 0; }
.warning-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--status-watch-bg);
  color: var(--status-watch-fg);
  border: 1px solid rgba(224, 160, 18, 0.35);
  border-radius: 999px;
  padding: 5px 12px;
  font-weight: 700;
  font-size: 13px;
}
.warning-badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--status-watch-dot);
  box-shadow: 0 0 0 3px rgba(224, 160, 18, 0.22);
  flex-shrink: 0;
}
.fullscreen-btn {
  background: var(--raqeem-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 18px;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--font-arabic);
  font-size: 16px;
  box-shadow: 0 4px 14px rgba(44, 63, 160, 0.28);
  transition: background var(--duration-fast) ease, transform var(--duration-fast) ease;
}
.fullscreen-btn:hover {
  background: var(--raqeem-primary-dark);
  transform: translateY(-1px);
}

/* -------------------- المحتوى التنفيذي -------------------- */
.exec-body {
  padding: 18px 0 24px;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 16px;
  height: calc(1080px - 108px);
}

/* مؤشرات علوية */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
}
.kpi-card {
  --kpi-accent: var(--raqeem-primary);
  --kpi-accent-soft: rgba(44, 63, 160, 0.10);
  --kpi-card-bg: #FFFFFF;
  --kpi-value-color: var(--raqeem-primary-dark);
  background: var(--kpi-card-bg);
  border: 1px solid var(--raqeem-border);
  border-radius: var(--radius-md);
  padding: 14px 14px;
  box-shadow: var(--shadow-soft);
  text-align: right;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  min-height: 96px;
  transition: transform var(--duration-med) var(--ease-out), box-shadow var(--duration-med) var(--ease-out), border-color var(--duration-fast) ease;
}
.kpi-card::before {
  content: "";
  position: absolute;
  inset-inline: 0;
  top: 0;
  height: 4px;
  background: var(--kpi-accent);
}
.kpi-card::after {
  content: "";
  position: absolute;
  inset-inline-start: -18%;
  bottom: -45%;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: var(--kpi-accent-soft);
  pointer-events: none;
}
.kpi-total {
  --kpi-accent: #2C3FA0;
  --kpi-accent-soft: rgba(44, 63, 160, 0.14);
  --kpi-card-bg: #F4F6FF;
  --kpi-value-color: #1A2A6E;
}
.kpi-completed {
  --kpi-accent: #1C9B68;
  --kpi-accent-soft: rgba(28, 155, 104, 0.16);
  --kpi-card-bg: #EEF9F3;
  --kpi-value-color: #0F6B46;
}
.kpi-progress {
  --kpi-accent: #3B7FE8;
  --kpi-accent-soft: rgba(59, 127, 232, 0.16);
  --kpi-card-bg: #F0F6FF;
  --kpi-value-color: #1D4F9C;
}
.kpi-ontrack {
  --kpi-accent: #22A866;
  --kpi-accent-soft: rgba(34, 168, 102, 0.16);
  --kpi-card-bg: #EAF8F0;
  --kpi-value-color: #157A48;
}
.kpi-delayed {
  --kpi-accent: #D94A4A;
  --kpi-accent-soft: rgba(217, 74, 74, 0.16);
  --kpi-card-bg: #FDEEEE;
  --kpi-value-color: #A83232;
  border-color: #F0C8C8;
}
.kpi-funds {
  --kpi-accent: #1FA8C4;
  --kpi-accent-soft: rgba(31, 168, 196, 0.16);
  --kpi-card-bg: #EEF9FC;
  --kpi-value-color: #0E6F84;
}

.kpi-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lift);
  border-color: color-mix(in srgb, var(--kpi-accent) 35%, var(--raqeem-border));
}
.kpi-icon {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: #fff;
  color: var(--kpi-accent);
  border: 1px solid color-mix(in srgb, var(--kpi-accent) 28%, #fff);
  box-shadow: 0 2px 8px color-mix(in srgb, var(--kpi-accent) 18%, transparent);
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}
.kpi-icon svg {
  width: 22px;
  height: 22px;
  display: block;
  fill: currentColor;
}
.kpi-card-body {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  flex: 1;
}
.kpi-card .value {
  font-size: clamp(20px, 1.7vw, 28px);
  font-weight: 800;
  color: var(--kpi-value-color);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  line-height: 1.15;
}
.kpi-card .value.money {
  font-size: clamp(14px, 1.1vw, 18px);
  overflow-wrap: anywhere;
  letter-spacing: -0.01em;
}
.kpi-card .label {
  font-size: 13px;
  color: var(--raqeem-muted);
  font-weight: 600;
  line-height: 1.35;
}

/* مصفوفة المشاريع */
.matrix-panel {
  background: var(--raqeem-surface);
  border: 1px solid var(--raqeem-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.panel-title {
  padding: 12px 18px;
  font-weight: 800;
  font-size: 17px;
  color: var(--raqeem-primary-dark);
  border-bottom: 1px solid var(--raqeem-border);
  letter-spacing: -0.01em;
  background: linear-gradient(180deg, var(--raqeem-surface-muted) 0%, var(--raqeem-surface) 100%);
  display: flex;
  align-items: center;
  gap: 10px;
}
.panel-title::before {
  content: "";
  width: 4px;
  height: 18px;
  border-radius: 4px;
  background: linear-gradient(180deg, var(--raqeem-primary), var(--raqeem-secondary));
  flex-shrink: 0;
}
.chart-panel .panel-title,
.timeline-panel .panel-title,
.impact-panel .panel-title {
  padding: 0 0 10px;
  margin-bottom: 4px;
  border-bottom: none;
  background: none;
}

table.project-matrix {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 15px;
  flex: 1;
}
table.project-matrix thead th {
  background: var(--raqeem-surface-muted);
  color: var(--raqeem-ink-soft);
  font-weight: 700;
  padding: 10px 8px;
  border-bottom: 1px solid var(--raqeem-border);
  text-align: center;
  vertical-align: middle;
  line-height: 1.35;
  font-size: 13px;
  letter-spacing: -0.01em;
}
table.project-matrix tbody td {
  padding: 10px 8px;
  border-bottom: 1px solid rgba(213, 221, 235, 0.7);
  text-align: center;
  vertical-align: middle;
  cursor: pointer;
  transition: background var(--duration-fast) ease;
}
table.project-matrix thead th:first-child,
table.project-matrix tbody td:first-child {
  text-align: right;
  padding-inline-start: 16px;
  font-weight: 600;
}
table.project-matrix tbody tr { min-height: 54px; }
table.project-matrix tbody tr:nth-child(even) { background: rgba(246, 248, 252, 0.65); }
table.project-matrix tbody tr:hover {
  background: var(--raqeem-primary-soft);
}
table.project-matrix tbody tr.highlighted {
  background: rgba(59, 127, 232, 0.12);
  outline: 2px solid var(--raqeem-secondary);
  outline-offset: -2px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 11px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: -0.01em;
  border: 1px solid transparent;
}
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.6);
}
.variance-pos { color: var(--status-ontrack-fg); font-weight: 700; }
.variance-neg { color: var(--status-late-fg); font-weight: 700; }
.numeric-text {
  direction: ltr;
  unicode-bidi: isolate;
  display: inline-block;
  font-variant-numeric: tabular-nums;
}
.money-display {
  display: inline-flex;
  direction: ltr;
  align-items: baseline;
  justify-content: center;
  gap: 0.32em;
  white-space: nowrap;
}
.currency-symbol {
  direction: rtl;
  unicode-bidi: isolate;
  font-size: 0.84em;
  opacity: 0.85;
}
.completed-label { color: var(--status-ontrack-fg); font-weight: 700; }
.outputs-progress-cell { min-width: 0; }
.output-mini {
  display: block;
  white-space: nowrap;
  color: var(--raqeem-primary);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
}
.output-mini + .output-mini { margin-top: 2px; }
.output-more { color: var(--raqeem-muted); font-size: 12px; }

/* الصف السفلي */
.bottom-row {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 14px;
}
.status-progress-row {
  grid-template-columns: minmax(360px, 0.75fr) minmax(0, 1.55fr);
}
.timeline-panel,
.impact-panel {
  background: var(--raqeem-surface);
  border: 1px solid var(--raqeem-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
  padding: 16px 18px;
}
.timeline-cols {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 4px;
}
.timeline-col h4 {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--raqeem-muted);
  font-weight: 700;
  text-transform: none;
  letter-spacing: -0.01em;
}
.timeline-item {
  font-size: 14px;
  padding: 8px 10px;
  background: var(--raqeem-surface-muted);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  line-height: 1.45;
  transition: border-color var(--duration-fast) ease, background var(--duration-fast) ease;
}
.timeline-item:hover {
  border-color: var(--raqeem-border);
  background: var(--raqeem-primary-soft);
}
.impact-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 4px;
}
.impact-item {
  text-align: center;
  padding: 12px 8px;
  border-radius: var(--radius-sm);
  background: linear-gradient(160deg, #FAFCFF 0%, #EEF3FB 100%);
  border: 1px solid var(--raqeem-border);
}
.impact-item .value {
  font-size: 20px;
  font-weight: 800;
  color: var(--raqeem-primary-dark);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.impact-item .label {
  font-size: 13px;
  color: var(--raqeem-muted);
  margin-top: 4px;
  font-weight: 500;
}

/* -------------------- عرض تفاصيل المشروع -------------------- */
.detail-body {
  padding: 20px 0 24px;
  height: calc(1080px - 108px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.detail-top {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 16px;
}
.detail-top h2 {
  margin: 0;
  color: var(--raqeem-primary-dark);
  font-size: 22px;
  flex: 1;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.back-btn {
  background: var(--raqeem-surface);
  border: 1px solid var(--raqeem-border);
  border-radius: var(--radius-sm);
  padding: 9px 16px;
  cursor: pointer;
  font-family: var(--font-arabic);
  font-weight: 700;
  color: var(--raqeem-ink-soft);
  box-shadow: var(--shadow-xs);
  transition: background var(--duration-fast) ease, border-color var(--duration-fast) ease;
}
.back-btn:hover {
  background: var(--raqeem-primary-soft);
  border-color: var(--raqeem-border-strong);
}
.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  flex: 1;
}
.project-profile-grid {
  display: grid;
  grid-template-columns: 1.45fr 1fr;
  gap: 14px;
}
.project-objectives-card { grid-column: 1 / -1; }
.detail-prose {
  font-size: 15px;
  line-height: 1.85;
  color: var(--raqeem-ink);
}
.strategic-goal-value {
  font-size: 16px;
  line-height: 1.75;
  font-weight: 700;
  color: #6B4800;
  background: linear-gradient(135deg, #FFF9EB 0%, #FFF3D6 100%);
  border-inline-start: 4px solid var(--raqeem-gold);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}
.detail-list {
  margin: 0;
  padding-inline-start: 22px;
  display: grid;
  gap: 6px;
  font-size: 15px;
  line-height: 1.65;
}
.detail-empty { color: var(--raqeem-muted); font-size: 14px; }
.detail-wide-card { flex: 0 0 auto; overflow: visible; }
.detail-card {
  background: var(--raqeem-surface);
  border: 1px solid var(--raqeem-border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  box-shadow: var(--shadow-soft);
  overflow-y: auto;
}
.detail-card h3 {
  margin: 0 0 12px;
  color: var(--raqeem-primary-dark);
  font-size: 16px;
  border-bottom: 1px solid var(--raqeem-border);
  padding-bottom: 8px;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.kv-row {
  display: grid;
  grid-template-columns: minmax(180px, 0.9fr) minmax(0, 1.1fr);
  align-items: center;
  gap: 18px;
  padding: 8px 4px;
  font-size: 15px;
  border-bottom: 1px dashed var(--raqeem-border);
}
.kv-row .k { color: var(--raqeem-muted); font-weight: 500; }
.kv-row .v { font-weight: 700; text-align: right; justify-self: stretch; }
.risk-row {
  font-size: 14px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--raqeem-border);
}

/* -------------------- حالات الخطأ والتحميل -------------------- */
.empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--raqeem-muted);
  font-size: 17px;
  text-align: center;
  padding: 40px;
}
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--raqeem-ink);
  color: #fff;
  padding: 12px 22px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  z-index: 999;
  box-shadow: var(--shadow-lift);
}

.loading-state,
.error-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  padding: 40px;
  gap: 10px;
}
.spinner {
  width: 44px;
  height: 44px;
  border: 3px solid var(--raqeem-border);
  border-top-color: var(--raqeem-primary);
  border-radius: 50%;
  animation: raqeem-spin 0.85s linear infinite;
  margin-bottom: 12px;
}
@media (prefers-reduced-motion: reduce) {
  .spinner { animation: none; border-top-color: var(--raqeem-primary); }
}
@keyframes raqeem-spin { to { transform: rotate(360deg); } }
.loading-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--raqeem-primary-dark);
}
.loading-subtitle { font-size: 15px; color: var(--raqeem-muted); }
.error-icon { font-size: 40px; color: var(--status-late-fg); }
.error-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--status-late-fg);
}
.error-body {
  font-size: 16px;
  color: var(--raqeem-muted);
  max-width: 480px;
  line-height: 1.7;
}
.retry-btn { margin-top: 12px; font-size: 16px; padding: 10px 22px; }

.period-label { font-size: 15px; margin-inline-end: 4px; }

/* -------------------- إمكانية الوصول -------------------- */
button:focus-visible,
select:focus-visible,
input:focus-visible,
tr[tabindex]:focus-visible {
  outline: 3px solid var(--raqeem-secondary);
  outline-offset: 2px;
}
.legend-item-active { font-weight: 800; }
.donut-slice-highlighted { filter: drop-shadow(0 0 3px rgba(44, 63, 160, 0.35)); }

.milestone-counts-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.milestone-count-badge {
  background: var(--raqeem-surface-muted);
  border: 1px solid var(--raqeem-border);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 13px;
  font-weight: 700;
  color: var(--raqeem-ink-soft);
}
.milestone-upcoming-list { display: flex; flex-direction: column; gap: 6px; }
.milestone-upcoming-row {
  display: grid;
  grid-template-columns: 1.4fr 1.6fr 100px 110px;
  gap: 8px;
  font-size: 14px;
  padding: 8px 10px;
  background: var(--raqeem-surface-muted);
  border-radius: var(--radius-sm);
  align-items: center;
  border: 1px solid transparent;
  transition: border-color var(--duration-fast) ease;
}
.milestone-upcoming-row:hover { border-color: var(--raqeem-border); }
.milestone-project { color: var(--raqeem-muted); }
.milestone-name { font-weight: 700; }
.milestones-detail-table,
.outputs-detail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.outputs-detail-table th,
.milestones-detail-table th {
  background: var(--raqeem-surface-muted);
  padding: 8px 10px;
  text-align: right;
  font-weight: 700;
  color: var(--raqeem-ink-soft);
  border-bottom: 1px solid var(--raqeem-border);
}
.outputs-detail-table td,
.milestones-detail-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--raqeem-border);
  text-align: right;
  vertical-align: middle;
}
.output-progress {
  width: 72px;
  height: 6px;
  display: inline-block;
  margin-inline-end: 7px;
  border-radius: 999px;
  background: var(--raqeem-border);
  overflow: hidden;
  vertical-align: middle;
}
.output-progress > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--raqeem-primary), var(--raqeem-secondary));
  border-radius: inherit;
  transform-origin: right center;
  animation: progress-reveal 0.6s var(--ease-out) both;
}
.compact-empty { height: auto; padding: 12px; }

tr[role="button"] { cursor: pointer; }

/* -------------------- الرسوم البيانية -------------------- */
.chart-panel {
  background: var(--raqeem-surface);
  border: 1px solid var(--raqeem-border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  box-shadow: var(--shadow-soft);
}
.chart-empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  color: var(--raqeem-muted);
  font-size: 15px;
  text-align: center;
  padding: 16px;
}
.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin-top: 12px;
  font-size: 13px;
}
.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--raqeem-ink);
}
.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.donut-chart-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 10px 2px;
  overflow: visible;
}
.donut-svg-box { position: relative; padding: 5px; overflow: visible; }
.donut-svg { overflow: visible; display: block; }
.donut-center-text {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.donut-total {
  font-size: 26px;
  font-weight: 800;
  color: var(--raqeem-primary-dark);
  letter-spacing: -0.02em;
}
.donut-total-label { font-size: 13px; color: var(--raqeem-muted); }
.donut-slice:focus-visible { outline: 2px solid var(--raqeem-secondary); }

.bars-chart { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.bar-row {
  display: grid;
  grid-template-columns: minmax(220px, 34%) 1fr 90px;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  transition: background var(--duration-fast) ease;
}
.bar-row.highlighted {
  background: var(--raqeem-primary-soft);
  outline: 2px solid var(--raqeem-secondary);
}
.bar-row-label {
  font-size: 13px;
  line-height: 1.35;
  white-space: normal;
  overflow-wrap: anywhere;
  font-weight: 600;
}
.bar-row-track {
  position: relative;
  height: 14px;
  background: #E8ECF4;
  border-radius: 4px;
  overflow: hidden;
}
.bar-segment {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  border-radius: 4px;
  opacity: 0.92;
}
.bar-segment.planned { height: 5px; top: 0; opacity: 0.5; }
.bar-segment.actual { height: 5px; top: 8px; }
.bar-row-value {
  font-size: 13px;
  color: var(--raqeem-muted);
  text-align: left;
  direction: ltr;
  font-variant-numeric: tabular-nums;
}

.trend-panel { overflow: hidden; }
.trend-svg {
  width: 100%;
  height: auto;
  max-height: 230px;
  display: block;
}
.trend-axis-label,
.trend-x-label {
  font-size: 12px;
  fill: var(--raqeem-muted);
  font-family: var(--font-arabic);
}

.chart-tooltip {
  position: fixed;
  z-index: 2000;
  background: var(--raqeem-ink);
  color: #fff;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  pointer-events: none;
  display: none;
  white-space: nowrap;
  box-shadow: var(--shadow-lift);
}

.chart-controls {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}
.chart-controls select {
  font-family: var(--font-arabic);
  font-size: 14px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--raqeem-border);
  background: var(--raqeem-surface);
  color: var(--raqeem-ink);
  cursor: pointer;
}
.status-filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  padding: 12px 16px;
  margin: 0;
  background: linear-gradient(180deg, #F8FAFD 0%, #FFFFFF 100%);
  border-bottom: 1px solid var(--raqeem-border);
}
.status-filter-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 700;
  color: var(--raqeem-ink-soft);
  flex-shrink: 0;
}
.status-filter-label svg {
  width: 15px;
  height: 15px;
  fill: var(--raqeem-secondary);
}
.status-filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex: 1;
  min-width: 0;
}
.status-filter-chip {
  --chip-dot: var(--raqeem-border-strong);
  --chip-bg: var(--raqeem-surface-muted);
  --chip-fg: var(--raqeem-ink-soft);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--raqeem-border);
  background: var(--raqeem-surface);
  border-radius: 999px;
  padding: 6px 8px 6px 12px;
  font-size: 13px;
  cursor: pointer;
  font-family: var(--font-arabic);
  font-weight: 600;
  color: var(--raqeem-ink-soft);
  transition: background var(--duration-fast) ease, color var(--duration-fast) ease, border-color var(--duration-fast) ease, transform var(--duration-fast) ease, box-shadow var(--duration-fast) ease;
}
.status-filter-chip .chip-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--chip-dot);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--chip-dot) 22%, transparent);
  flex-shrink: 0;
}
.status-filter-chip .chip-dot-all {
  background: linear-gradient(135deg, var(--raqeem-primary), var(--raqeem-secondary));
  box-shadow: 0 0 0 3px rgba(44, 63, 160, 0.15);
}
.status-filter-chip .chip-label { line-height: 1.2; }
.status-filter-chip .chip-count {
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--raqeem-surface-muted);
  color: var(--raqeem-muted);
  font-size: 12px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-variant-numeric: tabular-nums;
}
.status-filter-chip:hover {
  border-color: color-mix(in srgb, var(--chip-dot) 45%, var(--raqeem-border));
  background: var(--chip-bg);
  transform: translateY(-1px);
}
.status-filter-chip.active {
  background: var(--chip-bg);
  color: var(--chip-fg);
  border-color: color-mix(in srgb, var(--chip-dot) 55%, var(--raqeem-border));
  box-shadow: 0 2px 10px color-mix(in srgb, var(--chip-dot) 22%, transparent);
}
.status-filter-chip.active .chip-count {
  background: color-mix(in srgb, var(--chip-dot) 18%, #fff);
  color: var(--chip-fg);
}
.status-filter-all.active {
  --chip-bg: rgba(44, 63, 160, 0.10);
  --chip-fg: var(--raqeem-primary-dark);
  --chip-dot: var(--raqeem-primary);
  background: linear-gradient(135deg, rgba(44, 63, 160, 0.10), rgba(59, 127, 232, 0.10));
  color: var(--raqeem-primary-dark);
  border-color: rgba(44, 63, 160, 0.28);
  box-shadow: 0 2px 10px rgba(44, 63, 160, 0.12);
}

/* -------------------- وضع العرض التقديمي -------------------- */
.presentation-controls {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  background: rgba(18, 28, 74, 0.88);
  backdrop-filter: blur(12px);
  padding: 8px 16px;
  border-radius: 999px;
  z-index: 1500;
  opacity: 1;
  transition: opacity 0.24s ease, transform 0.24s ease;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 28px rgba(18, 28, 74, 0.35);
}
.presentation-controls.is-hidden {
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 14px);
}
.presentation-controls button {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  padding: 5px 12px;
  border-radius: 6px;
  font-family: var(--font-arabic);
  font-weight: 600;
  transition: background var(--duration-fast) ease;
}
.presentation-controls button:hover { background: rgba(255, 255, 255, 0.14); }
.scene-fade { transition: opacity 0.4s ease; }
@media (prefers-reduced-motion: reduce) {
  .scene-fade,
  .presentation-controls { transition: none; }
}
.scene-dots {
  display: flex;
  gap: 5px;
  align-items: center;
  padding: 0 6px;
}
.scene-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
  transition: background var(--duration-fast) ease, transform var(--duration-fast) ease;
}
.scene-dot.active {
  background: #fff;
  transform: scale(1.2);
}

/* -------------------- حركات الدخول -------------------- */
@keyframes progress-reveal {
  from { transform: scaleX(0); opacity: 0.35; }
  to { transform: scaleX(1); opacity: 1; }
}
@keyframes card-enter {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes header-enter {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.dash-header { animation: header-enter 0.45s var(--ease-out) both; }
.kpi-card,
.matrix-panel,
.bottom-row,
.chart-panel,
.milestones-panel,
.timeline-panel,
.impact-panel {
  animation: card-enter 0.4s var(--ease-out) both;
}
.kpi-card:nth-child(2) { animation-delay: 0.05s; }
.kpi-card:nth-child(3) { animation-delay: 0.09s; }
.kpi-card:nth-child(4) { animation-delay: 0.13s; }
.kpi-card:nth-child(5) { animation-delay: 0.17s; }
.kpi-card:nth-child(6) { animation-delay: 0.21s; }
.matrix-panel { animation-delay: 0.12s; }
.bottom-row,
.status-progress-row { animation-delay: 0.18s; }

@media (prefers-reduced-motion: reduce) {
  .dash-header,
  .kpi-card,
  .matrix-panel,
  .bottom-row,
  .chart-panel,
  .milestones-panel,
  .timeline-panel,
  .impact-panel,
  .output-progress > span {
    animation: none;
  }
  .kpi-card,
  .btn,
  .fullscreen-btn,
  table.project-matrix tbody tr {
    transition: none;
  }
}

/* -------------------- وضع العرض 1920×1080: هوامش داخلية -------------------- */
#scale-stage .dash-header {
  margin: 16px 28px 0;
  border-radius: var(--radius-lg);
}
#scale-stage .exec-body,
#scale-stage .detail-body {
  padding: 16px 28px 24px;
}

@media (max-width: 1200px) {
  .kpi-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 800px) {
  .timeline-cols,
  .impact-grid,
  .detail-grid,
  .project-profile-grid {
    grid-template-columns: 1fr;
  }
  .project-objectives-card { grid-column: auto; }
  .bottom-row,
  .status-progress-row { grid-template-columns: 1fr; }
  .dash-header {
    flex-direction: column;
    align-items: flex-start;
    padding: 16px 18px;
  }
  .header-brand {
    width: 72px;
    height: 72px;
  }
  .dash-header::before {
    width: 100%;
    height: 4px;
    inset: auto 0 0 0;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    background: linear-gradient(90deg, var(--raqeem-primary), var(--raqeem-secondary), var(--raqeem-cyan));
  }
  .milestone-upcoming-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

/* -------------------- تحسينات الجوال -------------------- */
@media (max-width: 900px) {
  .admin-bar {
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 14px;
    align-items: stretch;
  }
  .admin-bar .spacer { display: none; }
  .admin-bar .period-label {
    width: 100%;
    margin: 0;
    font-size: 13px;
    opacity: 0.9;
  }
  .admin-bar select {
    flex: 1 1 100%;
    width: 100%;
    min-height: 42px;
    font-size: 14px;
  }
  .admin-bar .btn-present {
    flex: 1 1 100%;
    width: 100%;
    justify-content: center;
    min-height: 44px;
    font-size: 15px;
  }

  .dash-normal-view {
    padding: 0 12px 36px;
  }

  .dash-header {
    margin-top: 12px;
    gap: 14px;
  }
  .header-brand {
    width: 64px;
    height: 64px;
    border-radius: 14px;
  }
  .dash-header img.logo {
    height: 46px;
    max-width: 52px;
  }
  .header-eyebrow { font-size: 11px; }
  .dash-header h1 {
    font-size: 18px;
    line-height: 1.4;
  }
  .dash-header .subtitle {
    margin-top: 10px;
    gap: 6px;
  }
  .header-badge,
  .warning-badge {
    font-size: 12px;
    padding: 5px 10px;
    max-width: 100%;
  }
  .header-badge-text {
    overflow-wrap: anywhere;
  }

  .kpi-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .kpi-card {
    min-height: 88px;
    padding: 12px;
    gap: 10px;
  }
  .kpi-icon {
    width: 38px;
    height: 38px;
    border-radius: 11px;
  }
  .kpi-icon svg {
    width: 20px;
    height: 20px;
  }
  .kpi-card .value { font-size: 22px; }
  .kpi-card .value.money { font-size: 14px; }
  .kpi-card .label { font-size: 12px; }
  .kpi-funds {
    grid-column: 1 / -1;
  }

  .status-filter-row {
    padding: 10px 12px;
    gap: 8px;
  }
  .status-filter-label {
    font-size: 12px;
  }
  .status-filter-chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    padding-bottom: 4px;
    margin-inline: -2px;
    padding-inline: 2px;
  }
  .status-filter-chip {
    flex-shrink: 0;
    font-size: 12px;
    padding: 6px 8px 6px 10px;
  }

  /* جدول المشاريع → جدول طبيعي مع تمرير أفقي */
  .matrix-table-wrap {
    padding: 0 0 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
  }
  table.project-matrix {
    table-layout: auto;
    width: max-content;
    min-width: 980px;
    font-size: 13px;
  }
  table.project-matrix colgroup { display: none; }
  table.project-matrix thead th {
    white-space: nowrap;
    font-size: 12px;
    padding: 10px 12px;
  }
  table.project-matrix tbody td {
    white-space: nowrap;
    padding: 10px 12px;
  }
  table.project-matrix tbody td.matrix-cell-name,
  table.project-matrix thead th:first-child,
  table.project-matrix tbody td:first-child {
    white-space: normal;
    min-width: 180px;
    max-width: 240px;
    text-align: right;
  }
  .output-mini { white-space: nowrap; }

  .bar-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .bar-row-value { text-align: right; }
}

@media (max-width: 480px) {
  .kpi-card .label {
    font-size: 11px;
  }
  .kpi-card .value {
    font-size: 20px;
  }
}
