/* إدارة الاعتمادات — تصميم مختصر: صف لكل اعتماد (الاسم | الاعتماد الأول | الاعتماد الثاني | حفظ) */
.bap-page { display: flex; flex-direction: column; gap: 12px; }

.bap-head {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  padding: 12px 14px; border: 1px solid #e2e8f0; border-radius: 14px; background: #fff;
}
.bap-head h3 { margin: 0; font-size: 16px; font-weight: 700; color: #1e293b; }
.bap-count {
  border: 1px solid #fde68a; background: #fffbeb; color: #92400e;
  border-radius: 999px; padding: 2px 10px; font-size: 12px;
}
.bap-search { position: relative; flex: 1 1 220px; margin-inline-start: auto; max-width: 340px; }
.bap-search svg { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); color: #94a3b8; }
.bap-search input {
  width: 100%; border: 1px solid #e2e8f0; border-radius: 10px; background: #fff;
  padding: 7px 32px 7px 10px; font-size: 13px; outline: none;
}
.bap-search input:focus { border-color: #fbbf24; box-shadow: 0 0 0 3px #fef3c7; }

.bap-table { border: 1px solid #e2e8f0; border-radius: 14px; background: #fff; }
.bap-row {
  display: grid; align-items: center; gap: 10px;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1fr) 112px;
  padding: 10px 14px; border-top: 1px solid #f1f5f9;
}
.bap-row:first-child { border-top: 0; }
.bap-row.bap-cols {
  background: #f8fafc; color: #64748b; font-size: 12px; font-weight: 700;
  padding-top: 8px; padding-bottom: 8px; border-radius: 14px 14px 0 0;
}
.bap-row.is-dirty { background: #fffbeb; }
.bap-group {
  padding: 6px 14px; background: #f8fafc; border-top: 1px solid #e2e8f0;
  font-size: 12px; font-weight: 700; color: #4f46e5;
}
.bap-name { min-width: 0; }
.bap-name strong { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; color: #1e293b; }
.bap-badge {
  border: 1px solid #e2e8f0; background: #f8fafc; color: #64748b;
  border-radius: 999px; padding: 1px 8px; font-size: 10px; font-weight: 500;
}
.bap-field-label { display: none; font-size: 11px; color: #64748b; margin-bottom: 3px; }

/* القائمة المنسدلة متعددة الاختيار مع البحث */
.bap-picker { position: relative; min-width: 0; }
.bap-picker.is-open { z-index: 30; }
.bap-trigger {
  display: flex; align-items: center; gap: 6px; width: 100%; min-height: 36px;
  border: 1px solid #e2e8f0; border-radius: 10px; background: #fff;
  padding: 5px 10px; font-size: 13px; color: #334155; text-align: right; cursor: pointer;
}
.bap-trigger:hover { border-color: #cbd5e1; }
.bap-picker.is-open .bap-trigger { border-color: #fbbf24; box-shadow: 0 0 0 3px #fef3c7; }
.bap-trigger-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bap-trigger-text.is-empty { color: #94a3b8; }
.bap-trigger-count {
  flex-shrink: 0; border-radius: 999px; background: #f59e0b; color: #fff;
  font-size: 11px; line-height: 18px; min-width: 18px; padding: 0 5px; text-align: center;
}
.bap-chevron { flex-shrink: 0; color: #94a3b8; transition: transform .15s; }
.bap-picker.is-open .bap-chevron { transform: rotate(180deg); }
.bap-menu {
  position: absolute; top: calc(100% + 4px); right: 0; left: 0; min-width: 240px;
  border: 1px solid #e2e8f0; border-radius: 12px; background: #fff;
  box-shadow: 0 12px 28px rgba(15, 23, 42, .14); overflow: hidden;
}
.bap-menu-search { padding: 8px; border-bottom: 1px solid #f1f5f9; }
.bap-menu-search input {
  width: 100%; border: 1px solid #e2e8f0; border-radius: 8px; padding: 6px 9px; font-size: 12px; outline: none;
}
.bap-menu-search input:focus { border-color: #fbbf24; }
.bap-options { max-height: 240px; overflow-y: auto; padding: 4px; }
.bap-option {
  display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: transparent;
  border-radius: 8px; padding: 6px 8px; text-align: right; cursor: pointer;
}
.bap-option:hover { background: #f8fafc; }
.bap-option.is-on { background: #fffbeb; }
.bap-option input { width: 15px; height: 15px; accent-color: #f59e0b; flex-shrink: 0; }
.bap-option-name { flex: 1; min-width: 0; font-size: 12px; color: #334155; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bap-option-role { flex-shrink: 0; font-size: 10px; color: #94a3b8; }
.bap-menu-foot {
  display: flex; justify-content: space-between; align-items: center;
  border-top: 1px solid #f1f5f9; padding: 6px 10px; font-size: 11px; color: #64748b;
}
.bap-menu-foot button { border: 0; background: none; color: #b45309; font-size: 11px; cursor: pointer; padding: 2px 4px; }
.bap-empty { padding: 14px; text-align: center; font-size: 12px; color: #94a3b8; }

.bap-save {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; width: 100%;
  border: 0; border-radius: 10px; background: #f59e0b; color: #fff;
  padding: 8px 10px; font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.bap-save:hover { background: #d97706; }
.bap-save:disabled { opacity: .55; cursor: not-allowed; }
.bap-save.is-clean { background: #f1f5f9; color: #64748b; }
.bap-save.is-clean:hover { background: #e2e8f0; }

.bap-state { padding: 40px 14px; text-align: center; font-size: 13px; color: #94a3b8; }

@media (max-width: 900px) {
  .bap-row { grid-template-columns: 1fr 1fr; }
  .bap-row .bap-name { grid-column: 1 / -1; }
  .bap-row .bap-actions { grid-column: 1 / -1; }
  .bap-row.bap-cols { display: none; }
  .bap-field-label { display: block; }
}
@media (max-width: 560px) {
  .bap-row { grid-template-columns: 1fr; }
  .bap-search { max-width: none; }
}
